{"id":1826,"date":"2014-02-04T11:21:09","date_gmt":"2014-02-04T11:21:09","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=1826"},"modified":"2014-02-04T11:24:55","modified_gmt":"2014-02-04T11:24:55","slug":"repackage-an-installer-using-packages","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=1826","title":{"rendered":"Repackage an Installer Using Packages"},"content":{"rendered":"<p>One of the challenges that can crop up with deploying software packages can be repackaging packages and metapackages, especially packages that don\u2019t have all of the installer data contained inside themselves.\u00a0<a href=\"https:\/\/derflounder.wordpress.com\/2011\/08\/07\/repackaging-ilife-11-for-deploystudio\/\">A good example of the latter is iLife \u201911<\/a>, where the installer package is small and instead acts as a master conductor to install other packages.<\/p>\n<p>Another issue are applications that require multiple installs to get fully up to date. An example here would be Microsoft Office 2011, which has an installer that will install a full version of Office 2011 but then additional installer packages must be installed to get Office fully updated and patched.<\/p>\n<p>To address this, you can use\u00a0<a href=\"http:\/\/s.sudre.free.fr\/Software\/Packages\/about.html\">Packages<\/a>\u2018 ability to add resources to a Packages-built package. See below the jump for an an example using an Office 2011 SP 3 installer package and the\u00a0<a href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=40352\">Office 2011 14.3.8 Update<\/a>\u00a0to build a unified Office 2011 SP 3 14.3.8 installer package.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>1.\u00a0<a href=\"http:\/\/derflounder.wordpress.com\/2012\/09\/26\/removing-the-office-2011-installers-application-quit-function\/\">Remove the Office 2011 installers\u2019 application quit function<\/a>.<\/p>\n<p>2. Set up a new Packages project and select\u00a0<b>Raw Package<\/b>.<\/p>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-8-20-52-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 8.20.52 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-8-20-52-pm-tm.jpg?w=480&amp;h=318\" width=\"480\" height=\"318\" \/><\/a><\/p>\n<p>3. In this case, I\u2019m naming the project\u00a0<b>Microsoft Office 2011 SP 3 14.3.8<\/b><\/p>\n<p><b><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-8-36-58-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 8.36.58 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-8-36-58-pm-tm.jpg?w=480&amp;h=318\" width=\"480\" height=\"318\" \/><\/a><\/b>\u00a0<b><br \/>\n<\/b><\/p>\n<p>4. Once the Packages project opens, click on the\u00a0<b>Project<\/b>\u00a0tab. You\u2019ll want to make sure that the your information is correctly set here (if you don\u2019t know what to put in, check the\u00a0<b>Help<\/b>\u00a0menu for the\u00a0<b>Packages User Guide<\/b>. The information you need is in\u00a0<b>Chapter 4 \u2013 Configuring a project<\/b>.)<b><br \/>\n<\/b><\/p>\n<p>In this example, I\u2019m not changing any of the options from what is set by default.<\/p>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-8-42-52-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 8.42.52 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-8-42-52-pm-tm.jpg?w=480&amp;h=297\" width=\"480\" height=\"297\" \/><\/a><\/p>\n<p>5. Next, click on the\u00a0<b>Settings<\/b>\u00a0tab. In the case of my project, I want to install with root privileges and not require a logout, restart or shutdown.<\/p>\n<p>To accomplish this, I\u2019m choosing the following options in the\u00a0<b>Settings<\/b>\u00a0section:<\/p>\n<p>In the\u00a0<b>Post-Installation Behavior<\/b>\u00a0section, set\u00a0<b>On Success<\/b>: to\u00a0<b>Do Nothing<\/b><br \/>\nIn the\u00a0<b>Options<\/b>\u00a0section, check the box for\u00a0<b>Require admin password for installation<\/b>.<\/p>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-08-19-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 10.08.19 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-08-19-pm-tm.jpg?w=480&amp;h=297\" width=\"480\" height=\"297\" \/><\/a><\/p>\n<p>6. Click on the\u00a0<b>Scripts<\/b>\u00a0tab in your Packages project.<\/p>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-8-57-31-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 8.57.31 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-8-57-31-pm-tm.jpg?w=480&amp;h=297\" width=\"480\" height=\"297\" \/><\/a><\/p>\n<p>7. Select your installers and drag them into the\u00a0<b>Additional Resources<\/b>\u00a0section of your Packages project.<\/p>\n<p>In the case of my example, I\u2019m selecting the following installers:<\/p>\n<p><b>Office 2011 14.3.0 with Service Pack 3 Installer.pkg<\/b><br \/>\n<b>Office 2011 14.3.8 Update.pkg<\/b><\/p>\n<p>&nbsp;<\/p>\n<p><b><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-9-21-17-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 9.21.17 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-9-21-17-pm-tm.jpg?w=480&amp;h=297\" width=\"480\" height=\"297\" \/><\/a><\/b>\u00a0<b><br \/>\n<\/b><\/p>\n<p>8. The last piece is telling the installers to run. For this, you\u2019ll need a\u00a0<b>postinstall<\/b>\u00a0script. Here\u2019s the one I\u2019m using:<b><\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">#!\/bin\/bash<br \/>\n&nbsp; <br \/>\n# Determine OS version<br \/>\nosvers=$(sw_vers -productVersion | awk -F. '{print $2}')<br \/>\n&nbsp; <br \/>\n# Determine working directory<br \/>\n&nbsp; <br \/>\ninstall_dir=`dirname $0`<br \/>\n&nbsp; <br \/>\n# Install Office 2011 using the specified installer packages in the working directory<br \/>\n&nbsp; <br \/>\n\/usr\/sbin\/installer -dumplog -verbose -pkg $install_dir\/&quot;Office 2011 14.3.0 with Service Pack 3 Installer.pkg&quot; -target &quot;$3&quot;<br \/>\n\/usr\/sbin\/installer -dumplog -verbose -pkg $install_dir\/&quot;Office 2011 14.3.8 Update.pkg&quot; -target &quot;$3&quot;<\/div><\/div>\n<p>Notice that\u00a0<b>$install_dir<\/b>\u00a0in the\u00a0<strong>postinstall<\/strong>\u00a0script refers to the path to the package\u2019s working directory. That\u2019s where Packages will be storing these installers, inside the Package-built installer\u2019s embedded directory where it stores the items defined in the\u00a0<b>Additional Resources<\/b>section.<\/p>\n<p>The\u00a0<b>-target<\/b>\u00a0value is defined as\u00a0<b>\u201c$3\u2033<\/b>\u00a0because some information is passed along by the Packages-built installer to its included scripts when those scripts are run by the installation process. (For more information, see the\u00a0<a href=\"http:\/\/s.sudre.free.fr\/Stuff\/PackageMaker_Howto.html\">PackageMaker How-To available here<\/a>\u00a0and search on the page for\u00a0<b>$3<\/b>)<\/p>\n<p>In this case,\u00a0<b>-target<\/b>\u00a0being defined as\u00a0<b>\u201c$3\u2033<\/b>\u00a0means that the\u00a0<strong>postinstall<\/strong>\u00a0script will install the two Office 2011 packages onto the desired drive.<\/p>\n<p>The script also governs what order the installers run in, so the main Office 2011 installer runs first and the update runs next after the first job finishes. The\u00a0<b>-dumplog<\/b>\u00a0and\u00a0<b>-verbose<\/b>\u00a0flags are to help you track the progress of installation if you\u2019re looking at the installer log.<\/p>\n<p>9. Once you\u2019ve got the\u00a0<b>postinstall<\/b>\u00a0script built, run the following command to make the script executable:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">sudo chmod a+x \/path\/to\/postinstall<\/div><\/div>\n<p>10. Once completed, add the\u00a0<b>postinstall<\/b>\u00a0script to your Packages project.<\/p>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-9-23-52-pm.png\"><img decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 9.23.52 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-9-23-52-pm.png?w=595&amp;h=373\" \/><\/a><\/p>\n<p>11. Last step, go ahead and build the package. (If you don\u2019t know to build, check the\u00a0<b>Help<\/b>\u00a0menu for the\u00a0<b>Packages User Guide<\/b>. The information you need is in\u00a0<b>Chapter 3 \u2013 Creating a raw package project<\/b>\u00a0and\u00a0<b>Chapter 10 \u2013 Building a project<\/b>.)<\/p>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-26-17-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 10.26.17 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-26-17-pm-tm.jpg?w=480&amp;h=301\" width=\"480\" height=\"301\" \/><\/a><\/p>\n<div><b>Signing the installer<\/b><\/div>\n<p>&nbsp;<\/p>\n<p>An additional advantage of re-packaging using\u00a0<a href=\"http:\/\/s.sudre.free.fr\/Software\/Packages\/about.html\">Packages<\/a>\u00a0is that Packages by default\u00a0<a href=\"http:\/\/s.sudre.free.fr\/Stuff\/Ivanhoe\/FLAT.html\">creates flat packages<\/a>, which can be signed with a\u00a0<a href=\"https:\/\/developer.apple.com\/developer-id\/\">Developer ID<\/a>. This will allow your packages to be accepted by\u00a0<a href=\"http:\/\/en.wikipedia.org\/wiki\/Gatekeeper_(OS_X)\">Gatekeeper<\/a>. Signing the Packages-built flat package provides a way to accommodate Gatekeeper if you have installer packages which otherwise aren\u2019t signed or can\u2019t be signed.<\/p>\n<p>To sign your installers, you will need to have an Apple Developer Connection membership. If you\u2019re an ADC member,\u00a0<a href=\"https:\/\/jamfnation.jamfsoftware.com\/article.html?id=301\">you can obtain an Developer ID Installer certificate from Apple using Xcode<\/a>.<\/p>\n<p>Once you have your Developer ID Installer certificate installed, you can sign the Packages-built package with the following command:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">productsign --sign &quot;Developer ID Installer: FirstName LastName&quot; \/path\/from\/package_name.pkg \/path\/to\/signedpackage_name.pkg<\/div><\/div>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-02-36-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 10.02.36 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-02-36-pm-tm.jpg?w=480&amp;h=48\" width=\"480\" height=\"48\" \/><\/a><\/p>\n<p>In the case of this example, I\u2019m signing it with the following command:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">productsign --sign &quot;Developer ID Installer: Rich Trouton&quot; &quot;\/path\/from\/Microsoft Office 2011 SP 3 14.3.8.pkg&quot; &quot;\/path\/to\/Microsoft Office 2011 SP 3 14.3.8.pkg&quot;<\/div><\/div>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-00-03-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 10.00.03 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-00-03-pm-tm.jpg?w=480&amp;h=97\" width=\"480\" height=\"97\" \/><\/a><\/p>\n<p>The signing process will create a duplicate of the Packages-built package and sign the copy with the Developer ID Installer certificate.<\/p>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-29-02-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 10.29.02 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-29-02-pm-tm.jpg?w=480&amp;h=290\" width=\"480\" height=\"290\" \/><\/a><\/p>\n<p>To verify that your package has been signed, check your installer package to verify that it has a lock icon in the top-right corner.<\/p>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-05-06-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 10.05.06 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-05-06-pm-tm.jpg?w=480&amp;h=340\" width=\"480\" height=\"340\" \/><\/a><\/p>\n<p>Next, click the lock icon to verify that the certificate is showing up as a valid Apple Developer ID Installer certificate.<\/p>\n<p><a href=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-04-59-pm.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Screen Shot 2013-11-02 at 10.04.59 PM\" src=\"http:\/\/derflounder.files.wordpress.com\/2013\/11\/screen-shot-2013-11-02-at-10-04-59-pm-tm.jpg?w=480&amp;h=340\" width=\"480\" height=\"340\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the challenges that can crop up with deploying software packages can be repackaging packages and metapackages, especially packages that don\u2019t [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1826","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1826"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1826\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}