├── .gitignore ├── LICENSE-2.0.txt ├── Makefile ├── README ├── app2luggage.rb ├── examples └── README ├── luggage.make └── prototype.plist /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.dmg 3 | *.pkg 4 | *.gz 5 | *.bz2 6 | *.tar 7 | *~ 8 | -------------------------------------------------------------------------------- /LICENSE-2.0.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009 Joe Block 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Sample package that packages luggage.make and prototype.plist 17 | 18 | include luggage.make 19 | 20 | TITLE=luggage 21 | REVERSE_DOMAIN=net.apesseekingknowledge 22 | PAYLOAD=pack-luggage.make pack-prototype.plist \ 23 | pack-usr-local-bin-app2luggage.rb 24 | 25 | help:: 26 | @-echo 27 | @-echo "Installation" 28 | @-echo 29 | @-echo "To copy luggage's files to /usr/local/share/luggage: make bootstrap_files" 30 | @-echo 31 | 32 | l_usr_local_share_luggage: l_usr_local_share 33 | @sudo mkdir -p ${WORK_D}/usr/local/share/luggage 34 | @sudo chown root:wheel ${WORK_D}/usr/local/share/luggage 35 | @sudo chmod 755 ${WORK_D}/usr/local/share/luggage 36 | 37 | pack-prototype.plist: l_usr_local_share_luggage 38 | @sudo ${INSTALL} -m 644 -o root -g wheel prototype.plist ${WORK_D}/usr/local/share/luggage/prototype.plist 39 | 40 | pack-luggage.make: l_usr_local_share_luggage 41 | @sudo ${INSTALL} -m 644 -o root -g wheel luggage.make ${WORK_D}/usr/local/share/luggage/luggage.make 42 | 43 | # copy the luggage files into place on the local machine so we can build a pkg. 44 | bootstrap_files: bootstrap_directory 45 | @sudo ${INSTALL} -m 644 -o root -g wheel luggage.make /usr/local/share/luggage/luggage.make 46 | @sudo ${INSTALL} -m 644 -o root -g wheel prototype.plist /usr/local/share/luggage/prototype.plist 47 | @sudo ${INSTALL} -m 755 -o root -g wheel app2luggage.rb /usr/local/bin/app2luggage.rb 48 | @if [ ! -x "/usr/local/bin/packagemaker" ]; then \ 49 | packagemaker=`find /Applications -name PackageMaker`; \ 50 | if [ $$packagemaker ]; then \ 51 | sudo ln -s $$packagemaker /usr/local/bin/packagemaker; \ 52 | fi \ 53 | fi 54 | 55 | bootstrap_directory: 56 | @sudo mkdir -p /usr/local/share/luggage 57 | @sudo mkdir -p /usr/local/bin 58 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | The Luggage is a project to create a wrapper to make Apple PKG format 2 | packages. 3 | 4 | It does not use the PackageMaker GUI, but it does require that the developer 5 | tools be installed so it can call the command line version. 6 | 7 | Advantages: 8 | You can get peer review of a package by examining the diffs between versions 9 | of your Makefile. No more wading through a zillion annoying GUI panes. 10 | 11 | Full documentation can be found at https://github.com/unixorn/luggage/wiki 12 | 13 | Example packages can be found at https://github.com/unixorn/luggage-examples 14 | 15 | Note : This version adds a command line option to remove the application prior to installation (app2luggage.rb). 16 | 17 | 18 | -------------------------------------------------------------------------------- /app2luggage.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | # 3 | # Copyright 2010 Joe Block 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # Additional modifications contributed by the following people in no particular order : 18 | # - Henri Shustak 19 | # 20 | # Version History : 21 | # v1.0 - Initial release. 22 | # v1.1 - Added an option which provides automatic removal of the appliaction prior to installation. 23 | # v1.2 - Minor bug fix relating to working directories which contain spaces. 24 | # v1.3 - Added an option which when enabled will instruct the installer to not install if the application is found on target system. 25 | # 26 | # Minor bug fix relating to directories which contain spaces added by Henri Shustak 2011 27 | # 28 | # If this breaks your system, you get to keep the parts. 29 | 30 | require 'ftools' 31 | require 'rubygems' 32 | 33 | begin 34 | require 'trollop' 35 | rescue LoadError 36 | puts "app2luggage.rb requires the trollop gem" 37 | puts "do 'sudo gem install trollop' and try again." 38 | exit 1 39 | end 40 | 41 | def generateMakefile() 42 | rawMakefile =<<"END_MAKEFILE" 43 | # 44 | # Package #{$installed_app} 45 | # 46 | # Makefile generated by app2luggage.rb 47 | # 48 | 49 | include #{$opts[:luggage_path]} 50 | 51 | TITLE=#{$package_id} 52 | REVERSE_DOMAIN=#{$opts[:reverse_domain]} 53 | PAYLOAD=\\ 54 | pack-script-preflight \\ 55 | install-app2luggage-#{$app_name} 56 | 57 | 58 | install-app2luggage-#{$app_name}: l_Applications #{$tarball_name} 59 | @sudo ${TAR} xjf #{$tarball_name} -C ${WORK_D}/Applications 60 | @sudo chown -R root:admin "${WORK_D}/Applications/#{$installed_app}" 61 | 62 | END_MAKEFILE 63 | if File.exist?('./Makefile') then 64 | puts "there's already a Makefile here. Bailing out." 65 | exit 3 66 | else 67 | File.open("Makefile", "w") do |content| 68 | content.write(rawMakefile) 69 | end 70 | end 71 | end 72 | 73 | def generatePreflight() 74 | if $opts[:remove_exisiting_version] then 75 | 76 | rawPreflight =<<"END_PREFLIGHT" 77 | #!/usr/bin/env bash 78 | # Automatically generated preflight script to remove 79 | # the application prior to installation of with this 80 | # package. 81 | if [ -e "$3/Applications/#{$installed_app}" ] ; then 82 | rm -Rf "$3/Applications/#{$installed_app}" 83 | exit ${?} 84 | fi 85 | exit 0 86 | 87 | END_PREFLIGHT 88 | else 89 | # GUI will just exit with error - as there is some issue with InstallationCheck and VolumeCheck picking up the target volume information 90 | if $opts[:no_overwrite] then 91 | rawPreflight =<<"END_PREFLIGHT" 92 | #!/bin/bash 93 | # Automatically generated preflight script which 94 | # will return -1 if the application to install is found within 95 | # the target drives /Application directory. 96 | if [ -e "$3/Applications/#{$installed_app}" ] ; then 97 | `logger -s -i -t Installer "Application \"#{$installed_app}\" is already installed on system. This package will not overwrite the currently installed version."` 98 | exit -1 99 | fi 100 | exit 0 101 | 102 | END_PREFLIGHT 103 | else 104 | rawPreflight =<<"END_PREFLIGHT" 105 | #!/bin/bash 106 | # Automatically generated preflight script which 107 | # will not do anything but return success. 108 | exit 0 109 | 110 | END_PREFLIGHT 111 | end 112 | end 113 | if File.exist?('./preflight') then 114 | puts "there's already a preflight script here. Bailing out." 115 | exit 3 116 | else 117 | File.open("preflight", "w") do |content| 118 | content.write(rawPreflight) 119 | `chmod 755 "./preflight"` 120 | end 121 | end 122 | end 123 | 124 | 125 | def clean_name(name) 126 | # get rid of toxic spaces 127 | cleaned = name.gsub(' ','_') 128 | return cleaned 129 | end 130 | 131 | def bundleApplication() 132 | app_dir = File.dirname($opts[:application]) 133 | # spaces are toxic. 134 | scratch_tarball = "#{$app_name}.#{$build_date}.tar" 135 | if $opts[:debug] >= 10 136 | puts "app_name: #{$app_name}" 137 | puts "app_dir: #{app_dir}" 138 | puts "tarball_name: #{$tarball_name}" 139 | end 140 | # check for a pre-existing tarball so we don't step on existing files 141 | if File.exist?("#{$app_name}.tar.bz2") 142 | print "#{$app_name}.tar.bz2 already exists. Skipping tarball creation." 143 | return 144 | end 145 | if File.exist?("#{$app_name}.tar") 146 | print "#{$app_name}.tar already exists. Skipping tarball creation." 147 | return 148 | end 149 | # Use Apple's tar so we don't get bitten by resource forks. We only care 150 | # because on 10.6 they started stashing compressed binaries there. Yay. 151 | `/usr/bin/tar cf "#{scratch_tarball}" -C "#{app_dir}" "#{File.basename($opts[:application])}"` 152 | `bzip2 -9v "#{scratch_tarball}"` 153 | end 154 | 155 | $opts = Trollop::options do 156 | version "app2luggage 0.1 (c) 2010 Joe Block" 157 | banner <<-EOS 158 | Automagically wrap an Application into a tar.bz2 and spew out a Luggage-compatible Makefile. 159 | Usage: 160 | app2luggage [options] --application=AppName.app 161 | 162 | where [options] are: 163 | EOS 164 | 165 | opt :application, "Application to package", :type => String 166 | opt :create_tarball, "Create tarball for app", :default => true 167 | opt :debug, "Set debug level", :default => 0 168 | opt :directory_name, "Directory to put Makefile, tarball & dmg into", :type => String 169 | opt :luggage_path, "path to luggage.make", :type => String, :default => "/usr/local/share/luggage/luggage.make" 170 | opt :make_dmg, "Create dmg after creating subdir", :default => true 171 | opt :make_pkg, "Create pkg file after creating subdir", :default => false 172 | opt :package_id, "Package id (no spaces!)", :type => String 173 | opt :package_version, "Package version (numeric!)", :type => :int 174 | opt :remove_exisiting_version, "Remove the previous version of the application prior to installation", :default => false 175 | opt :no_overwrite, "Only install if previous version of the application was not found within target volume \"/Applications/\" directory", :default => false 176 | opt :reverse_domain, "Your domain in reverse format, eg com.example.corp", :type => String 177 | end 178 | 179 | # Sanity check args 180 | Trollop::die :application, "#{$opts[:application]} must exist" unless File.exist?($opts[:application]) if $opts[:application] 181 | Trollop::die :application, "must specify an application to package" if $opts[:application] == nil 182 | Trollop::die :luggage_path, "#{$opts[:luggage_path]} doesn't exist" unless File.exist?($opts[:luggage_path]) if $opts[:luggage_path] 183 | Trollop::die :package_id, "must specify a package id" if $opts[:package_id] == nil 184 | Trollop::die :reverse_domain, "must specify a reversed domain" if $opts[:reverse_domain] == nil 185 | Trollop::die :remove_exisiting_version, "and argument no-overwrite are incompatible with each other" if ($opts[:no_overwrite] == true && $opts[:remove_exisiting_version] == true) 186 | 187 | $build_date = `date -u "+%Y-%m-%d"`.chomp 188 | $app_name = clean_name(File.basename($opts[:application])) 189 | $package_id = clean_name($opts[:package_id]) 190 | $installed_app = File.basename($opts[:application]) 191 | $tarball_name = "#{$app_name}.#{$build_date}.tar.bz2" 192 | 193 | # debuggery. 194 | if $opts[:debug] > 0 195 | require 'pp' 196 | puts "$opts: #{pp $opts}" 197 | puts "$package_id: #{$package_id}" 198 | puts "$build_date: #{$build_date}" 199 | puts "$app_name: #{$app_name}" 200 | puts "$installed_app: #{$installed_app}" 201 | puts "$tarball_name: #{$tarball_name}" 202 | end 203 | 204 | if $opts[:directory_name] != nil then 205 | target_dir = $opts[:directory_name] 206 | else 207 | target_dir = $package_id 208 | end 209 | 210 | if File.directory?(target_dir) then 211 | puts "#{target_dir} already exists. Exiting so we don't step on your data" 212 | exit 5 213 | end 214 | 215 | Dir.mkdir(target_dir) 216 | Dir.chdir(target_dir) 217 | 218 | bundleApplication() if $opts[:create_tarball] 219 | generatePreflight() 220 | generateMakefile() 221 | %x(sudo make dmg) if $opts[:make_dmg] 222 | %x(sudo make pkg) if $opts[:make_pkg] 223 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | The examples have all been moved to a separate repository. 2 | 3 | See https://github.com/unixorn/luggage-examples 4 | -------------------------------------------------------------------------------- /luggage.make: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009 Joe Block 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | export STAMP:=$(shell date +%Y%m%d) 17 | export YY:=$(shell date +%Y) 18 | export MM:=$(shell date +%m) 19 | export DD:=$(shell date +%d) 20 | export BUILD_DATE=$(shell date -u "+%Y-%m-%dT%H:%M:%SZ") 21 | 22 | # mai plist haz a flavor 23 | PLIST_FLAVOR=plist 24 | PACKAGE_PLIST=.package.plist 25 | 26 | PACKAGE_TARGET_OS=10.4 27 | PLIST_TEMPLATE=prototype.plist 28 | PLIST_PATH=/usr/local/share/luggage/prototype.plist 29 | TITLE=CHANGE_ME 30 | REVERSE_DOMAIN=com.replaceme 31 | PACKAGE_ID=${REVERSE_DOMAIN}.${TITLE} 32 | 33 | # Set PACKAGE_VERSION in your Makefile if you don't want version set to 34 | # today's date 35 | PACKAGE_VERSION=${STAMP} 36 | PACKAGE_MAJOR_VERSION=${YY} 37 | PACKAGE_MINOR_VERSION=${MM}${DD} 38 | 39 | # Set PACKAGE_NAME in your Makefile if you don't want it to be TITLE-PACKAGEVERSION. 40 | PACKAGE_NAME=${TITLE}-${PACKAGE_VERSION} 41 | PACKAGE_FILE=${PACKAGE_NAME}.pkg 42 | DMG_NAME=${PACKAGE_NAME}.dmg 43 | ZIP_NAME=${PACKAGE_FILE}.zip 44 | 45 | # Only use Apple tools for file manipulation, or deal with a world of pain 46 | # when your resource forks get munched. This is particularly important on 47 | # 10.6 since it stores compressed binaries in the resource fork. 48 | TAR=/usr/bin/tar 49 | CP=/bin/cp 50 | INSTALL=/usr/bin/install 51 | DITTO=/usr/bin/ditto 52 | 53 | NCPUS:=$(shell expr $$(sysctl -n hw.ncpu) + 2) 54 | 55 | PKGBUILD=/usr/bin/pkgbuild 56 | 57 | # Optionally, build packages with packagemaker, set USE_PKGBUILD=0 58 | PACKAGEMAKER=/usr/local/bin/packagemaker 59 | 60 | # Use productbuild to create flat distribution bundles - pkg-dist 61 | PRODUCTBUILD=/usr/bin/productbuild 62 | PKG_DIST=${TITLE}_dist-${PACKAGE_VERSION}.pkg 63 | 64 | # Must be on an HFS+ filesystem. Yes, I know some network servers will do 65 | # their best to preserve the resource forks, but it isn't worth the aggravation 66 | # to fight with them. 67 | LUGGAGE_TMP=/tmp/the_luggage 68 | OUTPUT_D=. 69 | SCRATCH_D=${LUGGAGE_TMP}/${PACKAGE_NAME} 70 | 71 | SCRIPT_D=${SCRATCH_D}/scripts 72 | RESOURCE_D=${SCRATCH_D}/resources 73 | EN_LPROJ_D=${RESOURCE_D}/en.lproj 74 | WORK_D=${SCRATCH_D}/root 75 | PAYLOAD_D=${SCRATCH_D}/payload 76 | BUILD_D=${SCRATCH_D}/build 77 | 78 | # packagemaker parameters 79 | # 80 | # packagemaker will helpfully apply the permissions it finds on the system 81 | # if one of the files in the payload exists on the disk, rather than the ones 82 | # you've carefully set up in the package root, so I turn that crap off with 83 | # --no-recommend. You can disable this by overriding PM_EXTRA_ARGS in your 84 | # package's Makefile. 85 | 86 | PM_EXTRA_ARGS=--verbose --no-recommend --no-relocate 87 | PM_FILTER=--filter "/CVS$$" --filter "/\.svn$$" --filter "/\.cvsignore$$" --filter "/\.cvspass$$" --filter "/(\._)?\.DS_Store$$" --filter "/\.git$$" --filter "/\.gitignore$$" 88 | 89 | # package build parameters 90 | # 91 | # just like packagemaker, pkgbuild munges permissions unless you tell it not to. 92 | 93 | PB_EXTRA_ARGS=--ownership preserve --quiet 94 | 95 | 96 | # pkgbuild can build payload free packages, but you have to say if you want one. 97 | 98 | ifeq (${NO_PAYLOAD}, 1) 99 | PB_EXTRA_ARGS+=" --nopayload" 100 | endif 101 | 102 | # Set to false if you want your package to install to volumes other than the boot volume 103 | ROOT_ONLY=true 104 | # Override if you want to require a restart after installing your package. 105 | PM_RESTART=None 106 | PAYLOAD= 107 | 108 | # hdiutil parameters 109 | # 110 | # hdiutil will create a compressed disk image with the UDZO and UDBZ formats, 111 | # or a bland, uncompressed, read-only image with UDRO. Wouldn't you rather 112 | # trade a little processing time for some disk savings now that you can make 113 | # packages and images with reckless abandon? 114 | # 115 | # The UDZO format is selected as the default here for compatibility, but you 116 | # can override it to achieve higher compression. If you want to switch away 117 | # from UDZO, it is probably best to override DMG_FORMAT in your makefile. 118 | # 119 | # Format notes: 120 | # The UDRO format is an uncompressed, read-only disk image that is compatible 121 | # with Mac OS X 10.0 and later. 122 | # The UDZO format is gzip-based, defaults to gzip level 1, and is compatible 123 | # with Mac OS X 10.2 and later. 124 | # The UDBZ format is bzip2-based and is compatible with Mac OS X 10.4 and later. 125 | 126 | DMG_FORMAT_CODE=UDZO 127 | ZLIB_LEVEL=9 128 | DMG_FORMAT_OPTION=-imagekey zlib-level=${ZLIB_LEVEL} 129 | DMG_FORMAT=${DMG_FORMAT_CODE} ${DMG_FORMAT_OPTION} 130 | DMG_FS="HFS+" 131 | 132 | # Set .PHONY declarations so things don't break if someone has files in 133 | # their workdir with the same names as our special stanzas 134 | 135 | .PHONY: clean 136 | .PHONY: debug 137 | .PHONY: dmg 138 | .PHONY: grind_package 139 | .PHONY: package_root 140 | .PHONY: payload_d 141 | .PHONY: pkg 142 | .PHONY: scratchdir 143 | .PHONY: superclean 144 | 145 | # Convenience variables 146 | USER_TEMPLATE=${WORK_D}/System/Library/User\ Template 147 | USER_TEMPLATE_PREFERENCES=${USER_TEMPLATE}/English.lproj/Library/Preferences 148 | USER_TEMPLATE_PICTURES=${USER_TEMPLATE}/English.lproj/Pictures 149 | 150 | 151 | LUGGAGE_LOCAL:=$(dir $(word $(words $(MAKEFILE_LIST)), \ 152 | $(MAKEFILE_LIST)))/luggage.local 153 | -include $(LUGGAGE_LOCAL) 154 | 155 | 156 | # target stanzas 157 | 158 | help:: 159 | @-echo 160 | @-echo "Usage" 161 | @-echo 162 | @-echo "make clean - clean up work files." 163 | @-echo "make dmg - roll a pkg, then stuff it into a dmg file." 164 | @-echo "make zip - roll a pkg, then stuff it into a zip file." 165 | @-echo "make pkg - roll a pkg." 166 | @-echo "make pkgls - list the bill of materials that will be generated by the pkg." 167 | @-echo 168 | 169 | # set up some work directories 170 | 171 | payload_d: 172 | @sudo mkdir -p ${PAYLOAD_D} 173 | 174 | package_root: 175 | @sudo mkdir -p ${WORK_D} 176 | 177 | # packagemaker chokes if the pkg doesn't contain any payload, making script-only 178 | # packages fail to build mysteriously if you don't remember to include something 179 | # in it, so we're including the /usr/local directory, since it's harmless. 180 | # this pseudo_payload can easily be overridden in your makefile 181 | 182 | ifeq (${USE_PKGBUILD}, 0) 183 | pseudo_payload: l_usr_local; 184 | else 185 | pseudo_payload: ; 186 | endif 187 | 188 | scriptdir: pseudo_payload 189 | @sudo mkdir -p ${SCRIPT_D} 190 | 191 | resourcedir: 192 | @sudo mkdir -p ${RESOURCE_D} 193 | 194 | builddir: 195 | @sudo mkdir -p ${BUILD_D} 196 | @sudo chmod 755 ${BUILD_D} 197 | @sudo chown ${USER} ${BUILD_D} 198 | 199 | # add sidecar items, not install payload, into the Resources directory 200 | # sidecar items may support the installer: welcome file, strings files 201 | # sidecar items may also be used by scripts but not installed 202 | enlprojdir: resourcedir 203 | @sudo mkdir -p ${EN_LPROJ_D} 204 | 205 | scratchdir: 206 | @sudo mkdir -p ${SCRATCH_D} 207 | 208 | outputdir: 209 | [[ ${OUTPUT_D} == "." ]] || sudo mkdir -p ${OUTPUT_D} 210 | [[ ${OUTPUT_D} == "." ]] || sudo chmod 775 ${OUTPUT_D} 211 | 212 | # user targets 213 | 214 | clean: 215 | @sudo rm -fr ${SCRATCH_D} .luggage.pkg.plist ${PACKAGE_PLIST} 216 | 217 | superclean: 218 | @sudo rm -fr ${LUGGAGE_TMP} 219 | 220 | dmg: scratchdir outputdir compile_package 221 | @echo "Wrapping ${PACKAGE_NAME}..." 222 | @sudo hdiutil create -volname ${PACKAGE_NAME} \ 223 | -srcfolder ${PAYLOAD_D} \ 224 | -uid 99 -gid 99 \ 225 | -ov \ 226 | -fs ${DMG_FS} \ 227 | -format ${DMG_FORMAT} \ 228 | ${SCRATCH_D}/${DMG_NAME} 229 | sudo ${CP} ${SCRATCH_D}/${DMG_NAME} ${OUTPUT_D}/ 230 | 231 | zip: scratchdir compile_package 232 | @echo "Zipping ${PACKAGE_NAME}..." 233 | @${DITTO} -c -k \ 234 | --noqtn --noacl \ 235 | --sequesterRsrc \ 236 | ${PAYLOAD_D} \ 237 | ${SCRATCH_D}/${ZIP_NAME} 238 | sudo ${CP} ${SCRATCH_D}/${ZIP_NAME} ${OUTPUT_D}/ 239 | 240 | modify_packageroot: 241 | @echo "If you need to override permissions or ownerships, override modify_packageroot in your Makefile" 242 | 243 | prep_pkg: compile_package 244 | 245 | pkg: outputdir prep_pkg 246 | 247 | pkg-dist: prep_pkg create_flatdist 248 | 249 | ifeq (${USE_PKGBUILD}, 0) 250 | pkgls: pkgls_pm ; 251 | else 252 | pkgls: pkgls_pb ; 253 | endif 254 | 255 | pkgls_pm: prep_pkg 256 | @echo 257 | @echo 258 | lsbom -p fmUG ${PAYLOAD_D}/${PACKAGE_FILE}/Contents/Archive.bom 259 | 260 | pkgls_pb: prep_pkg 261 | @echo 262 | @echo 263 | lsbom -p fmUG `pkgutil --bom ${PAYLOAD_D}/${PACKAGE_FILE}` 264 | 265 | payload: payload_d package_root scratchdir scriptdir resourcedir 266 | $(MAKE) -f $(word 1,$(MAKEFILE_LIST)) -e ${PAYLOAD} 267 | @-echo 268 | 269 | compile_package_pm: payload .luggage.pkg.plist modify_packageroot 270 | @-sudo rm -fr ${PAYLOAD_D}/${PACKAGE_FILE} 271 | @echo "Creating ${PAYLOAD_D}/${PACKAGE_FILE} with ${PACKAGEMAKER}" 272 | sudo ${PACKAGEMAKER} --root ${WORK_D} \ 273 | --id ${PACKAGE_ID} \ 274 | ${PM_FILTER} \ 275 | --target ${PACKAGE_TARGET_OS} \ 276 | --title ${TITLE} \ 277 | --info ${SCRATCH_D}/luggage.pkg.plist \ 278 | --scripts ${SCRIPT_D} \ 279 | --resources ${RESOURCE_D} \ 280 | --version ${PACKAGE_VERSION} \ 281 | ${PM_EXTRA_ARGS} --out ${PAYLOAD_D}/${PACKAGE_FILE} 282 | sudo ${CP} ${PAYLOAD_D}/${PACKAGE_FILE} ${OUTPUT_D}/ 283 | 284 | compile_package_pb: payload .luggage.pkg.component.plist kill_relocate modify_packageroot 285 | @-sudo rm -fr ${PAYLOAD_D}/${PACKAGE_FILE} 286 | @echo "Creating ${PAYLOAD_D}/${PACKAGE_FILE} with ${PKGBUILD}." 287 | sudo ${PKGBUILD} --root ${WORK_D} \ 288 | --component-plist ${SCRATCH_D}/luggage.pkg.component.plist \ 289 | --identifier ${PACKAGE_ID} \ 290 | ${PM_FILTER} \ 291 | --scripts ${SCRIPT_D} \ 292 | --version ${PACKAGE_VERSION} \ 293 | ${PB_EXTRA_ARGS} \ 294 | ${PAYLOAD_D}/${PACKAGE_FILE} 295 | sudo ${CP} ${PAYLOAD_D}/${PACKAGE_FILE} ${OUTPUT_D}/ 296 | 297 | create_flatdist: 298 | @-sudo rm -fr ${PAYLOAD_D}/${PKG_DIST} 299 | @echo "Creating flat distribution package ${PKG_DIST}..." 300 | @-sudo ${PRODUCTBUILD} --quiet \ 301 | --package ${PAYLOAD_D}/${PACKAGE_FILE} \ 302 | ${PAYLOAD_D}/${PKG_DIST} 303 | sudo ${CP} -R ${PAYLOAD_D}/${PKG_DIST} ${OUTPUT_D}/ 304 | 305 | ifeq (${USE_PKGBUILD}, 0) 306 | compile_package: compile_package_pm ; 307 | else 308 | compile_package: compile_package_pb ; 309 | endif 310 | 311 | ${PACKAGE_PLIST}: ${PLIST_PATH} 312 | # override this stanza if you have a different plist you want to use as 313 | # a custom local template. 314 | @cat ${PLIST_PATH} > ${OUTPUT_D}/${PACKAGE_PLIST} 315 | 316 | .luggage.pkg.plist: ${PACKAGE_PLIST} 317 | @cat ${PACKAGE_PLIST} | \ 318 | sed "s/{DD}/${DD}/g" | \ 319 | sed "s/{MM}/${MM}/g" | \ 320 | sed "s/{YY}/${YY}/g" | \ 321 | sed "s/{PACKAGE_MAJOR_VERSION}/${PACKAGE_MAJOR_VERSION}/g" | \ 322 | sed "s/{PACKAGE_MINOR_VERSION}/${PACKAGE_MINOR_VERSION}/g" | \ 323 | sed "s/{BUILD_DATE}/${BUILD_DATE}/g" | \ 324 | sed "s/{PACKAGE_ID}/${PACKAGE_ID}/g" | \ 325 | sed "s/{PACKAGE_VERSION}/${PACKAGE_VERSION}/g" | \ 326 | sed "s/{PM_RESTART}/${PM_RESTART}/g" | \ 327 | sed "s/{PLIST_FLAVOR}/${PLIST_FLAVOR}/g" | \ 328 | sed "s/{ROOT_ONLY}/${ROOT_ONLY}/g" \ 329 | > ${SCRATCH_D}/.luggage.pkg.plist 330 | @sudo ${CP} ${SCRATCH_D}/.luggage.pkg.plist ${SCRATCH_D}/luggage.pkg.plist 331 | @rm ${SCRATCH_D}/.luggage.pkg.plist ${PACKAGE_PLIST} 332 | 333 | .luggage.pkg.component.plist: 334 | @sudo ${PKGBUILD} --quiet --analyze --root ${WORK_D} \ 335 | ${PM_FILTER} \ 336 | ${SCRATCH_D}/luggage.pkg.component.plist 337 | @if [[ ! -f ${SCRATCH_D}/luggage.pkg.component.plist ]]; then echo "Error disabling bundle relocation: No component plist found!" 2>&1; else \ 338 | echo "Disabling bundle relocation." 2>&1;\ 339 | fi 340 | 341 | define PYTHON_PLISTER 342 | import plistlib 343 | component = plistlib.readPlist('${SCRATCH_D}/luggage.pkg.component.plist') 344 | for payload in component: 345 | if payload.get('BundleIsRelocatable'): 346 | payload['BundleIsRelocatable'] = False 347 | plistlib.writePlist(component, '${SCRATCH_D}/luggage.pkg.component.plist') 348 | endef 349 | 350 | export PYTHON_PLISTER 351 | 352 | kill_relocate: 353 | @-sudo /usr/bin/python -c "$${PYTHON_PLISTER}" 354 | 355 | # Target directory rules 356 | 357 | l_root: package_root 358 | @sudo mkdir -p ${WORK_D} 359 | @sudo chmod 755 ${WORK_D} 360 | @sudo chown root:wheel ${WORK_D} 361 | 362 | l_private: l_root 363 | @sudo mkdir -p ${WORK_D}/private 364 | @sudo chown -R root:wheel ${WORK_D}/private 365 | @sudo chmod -R 755 ${WORK_D}/private 366 | 367 | l_private_bin: l_private 368 | @sudo mkdir -p ${WORK_D}/private/bin 369 | @sudo chown -R root:wheel ${WORK_D}/private/bin 370 | @sudo chmod -R 755 ${WORK_D}/private/bin 371 | 372 | l_private_etc: l_private 373 | @sudo mkdir -p ${WORK_D}/private/etc 374 | @sudo chown -R root:wheel ${WORK_D}/private/etc 375 | @sudo chmod -R 755 ${WORK_D}/private/etc 376 | 377 | l_private_sbin: l_private 378 | @sudo mkdir -p ${WORK_D}/private/sbin 379 | @sudo chown -R root:wheel ${WORK_D}/private/sbin 380 | @sudo chmod -R 755 ${WORK_D}/private/sbin 381 | 382 | l_private_etc_hooks: l_etc_hooks 383 | 384 | l_private_etc_openldap: l_etc_openldap 385 | 386 | l_private_etc_puppet: l_etc_puppet 387 | 388 | l_private_var: l_var 389 | 390 | l_private_var_lib: l_var_lib 391 | 392 | l_private_var_lib_puppet: l_var_lib_puppet 393 | 394 | l_private_var_db: l_var_db 395 | 396 | l_private_var_db_dslocal: l_var_db_dslocal 397 | 398 | l_private_var_db_dslocal_nodes: l_var_db_dslocal_nodes 399 | 400 | l_private_var_db_dslocal_nodes_Default: l_var_db_dslocal_nodes_Default 401 | 402 | l_private_var_db_dslocal_nodes_Default_groups: l_var_db_dslocal_nodes_Default_groups 403 | 404 | l_private_var_db_dslocal_nodes_Default_users: l_var_db_dslocal_nodes_Default_users 405 | 406 | l_private_var_root: l_var_root 407 | 408 | l_private_var_root_Library: l_var_root_Library 409 | 410 | l_private_var_root_Library_Preferences: l_var_root_Library_Preferences 411 | 412 | l_etc_hooks: l_private_etc 413 | @sudo mkdir -p ${WORK_D}/private/etc/hooks 414 | @sudo chown -R root:wheel ${WORK_D}/private/etc/hooks 415 | @sudo chmod -R 755 ${WORK_D}/private/etc/hooks 416 | 417 | l_etc_openldap: l_private_etc 418 | @sudo mkdir -p ${WORK_D}/private/etc/openldap 419 | @sudo chmod 755 ${WORK_D}/private/etc/openldap 420 | @sudo chown root:wheel ${WORK_D}/private/etc/openldap 421 | 422 | l_etc_puppet: l_private_etc 423 | @sudo mkdir -p ${WORK_D}/private/etc/puppet 424 | @sudo chown -R root:wheel ${WORK_D}/private/etc/puppet 425 | @sudo chmod -R 755 ${WORK_D}/private/etc/puppet 426 | 427 | l_usr: l_root 428 | @sudo mkdir -p ${WORK_D}/usr 429 | @sudo chown -R root:wheel ${WORK_D}/usr 430 | @sudo chmod -R 755 ${WORK_D}/usr 431 | 432 | l_usr_bin: l_usr 433 | @sudo mkdir -p ${WORK_D}/usr/bin 434 | @sudo chown -R root:wheel ${WORK_D}/usr/bin 435 | @sudo chmod -R 755 ${WORK_D}/usr/bin 436 | 437 | l_usr_lib: l_usr 438 | @sudo mkdir -p ${WORK_D}/usr/lib 439 | @sudo chown -R root:wheel ${WORK_D}/usr/lib 440 | @sudo chmod -R 755 ${WORK_D}/usr/lib 441 | 442 | l_usr_lib_ruby_site_ruby_1_8: l_usr 443 | @sudo mkdir -p ${WORK_D}/usr/lib/ruby/site_ruby/1.8 444 | @sudo chown -R root:wheel ${WORK_D}/usr/lib/ruby/site_ruby/1.8 445 | @sudo chmod -R 755 ${WORK_D}/usr/lib/ruby/site_ruby/1.8 446 | 447 | l_usr_local: l_usr 448 | @sudo mkdir -p ${WORK_D}/usr/local 449 | @sudo chown -R root:wheel ${WORK_D}/usr/local 450 | @sudo chmod -R 755 ${WORK_D}/usr/local 451 | 452 | l_usr_local_bin: l_usr_local 453 | @sudo mkdir -p ${WORK_D}/usr/local/bin 454 | @sudo chown -R root:wheel ${WORK_D}/usr/local/bin 455 | @sudo chmod -R 755 ${WORK_D}/usr/local/bin 456 | 457 | l_usr_local_include: l_usr_local 458 | @sudo mkdir -p ${WORK_D}/usr/local/include 459 | @sudo chown -R root:wheel ${WORK_D}/usr/local/include 460 | @sudo chmod -R 755 ${WORK_D}/usr/local/include 461 | 462 | l_usr_local_lib: l_usr_local 463 | @sudo mkdir -p ${WORK_D}/usr/local/lib 464 | @sudo chown -R root:wheel ${WORK_D}/usr/local/lib 465 | @sudo chmod -R 755 ${WORK_D}/usr/local/lib 466 | 467 | l_usr_local_man: l_usr_local 468 | @sudo mkdir -p ${WORK_D}/usr/local/man 469 | @sudo chown -R root:wheel ${WORK_D}/usr/local/man 470 | @sudo chmod -R 755 ${WORK_D}/usr/local/man 471 | 472 | l_usr_local_sbin: l_usr_local 473 | @sudo mkdir -p ${WORK_D}/usr/local/sbin 474 | @sudo chown -R root:wheel ${WORK_D}/usr/local/sbin 475 | @sudo chmod -R 755 ${WORK_D}/usr/local/sbin 476 | 477 | l_usr_local_share: l_usr_local 478 | @sudo mkdir -p ${WORK_D}/usr/local/share 479 | @sudo chown -R root:wheel ${WORK_D}/usr/local/share 480 | @sudo chmod -R 755 ${WORK_D}/usr/local/share 481 | 482 | l_usr_man: l_usr_share 483 | @sudo mkdir -p ${WORK_D}/usr/share/man 484 | @sudo chown -R root:wheel ${WORK_D}/usr/share/man 485 | @sudo chmod -R 0755 ${WORK_D}/usr/share/man 486 | 487 | l_usr_man_man1: l_usr_man 488 | @sudo mkdir -p ${WORK_D}/usr/share/man/man1 489 | @sudo chown -R root:wheel ${WORK_D}/usr/share/man/man1 490 | @sudo chmod -R 0755 ${WORK_D}/usr/share/man/man1 491 | 492 | l_usr_man_man2: l_usr_man 493 | @sudo mkdir -p ${WORK_D}/usr/share/man/man2 494 | @sudo chown -R root:wheel ${WORK_D}/usr/share/man/man2 495 | @sudo chmod -R 0755 ${WORK_D}/usr/share/man/man2 496 | 497 | l_usr_man_man3: l_usr_man 498 | @sudo mkdir -p ${WORK_D}/usr/share/man/man3 499 | @sudo chown -R root:wheel ${WORK_D}/usr/share/man/man3 500 | @sudo chmod -R 0755 ${WORK_D}/usr/share/man/man3 501 | 502 | l_usr_man_man4: l_usr_man 503 | @sudo mkdir -p ${WORK_D}/usr/share/man/man4 504 | @sudo chown -R root:wheel ${WORK_D}/usr/share/man/man4 505 | @sudo chmod -R 0755 ${WORK_D}/usr/share/man/man4 506 | 507 | l_usr_man_man5: l_usr_man 508 | @sudo mkdir -p ${WORK_D}/usr/share/man/man5 509 | @sudo chown -R root:wheel ${WORK_D}/usr/share/man/man5 510 | @sudo chmod -R 0755 ${WORK_D}/usr/share/man/man5 511 | 512 | l_usr_man_man6: l_usr_man 513 | @sudo mkdir -p ${WORK_D}/usr/share/man/man6 514 | @sudo chown -R root:wheel ${WORK_D}/usr/share/man/man6 515 | @sudo chmod -R 0755 ${WORK_D}/usr/share/man/man6 516 | 517 | l_usr_man_man7: l_usr_man 518 | @sudo mkdir -p ${WORK_D}/usr/share/man/man7 519 | @sudo chown -R root:wheel ${WORK_D}/usr/share/man/man7 520 | @sudo chmod -R 0755 ${WORK_D}/usr/share/man/man7 521 | 522 | l_usr_man_man8: l_usr_man 523 | @sudo mkdir -p ${WORK_D}/usr/share/man/man8 524 | @sudo chown -R root:wheel ${WORK_D}/usr/share/man/man8 525 | @sudo chmod -R 0755 ${WORK_D}/usr/share/man/man8 526 | 527 | l_usr_sbin: l_usr 528 | @sudo mkdir -p ${WORK_D}/usr/sbin 529 | @sudo chown -R root:wheel ${WORK_D}/usr/sbin 530 | @sudo chmod -R 755 ${WORK_D}/usr/sbin 531 | 532 | l_usr_share: l_usr 533 | @sudo mkdir -p ${WORK_D}/usr/share 534 | @sudo chown -R root:wheel ${WORK_D}/usr/share 535 | @sudo chmod -R 755 ${WORK_D}/usr/share 536 | 537 | l_usr_share_doc: l_usr_share 538 | @sudo mkdir -p ${WORK_D}/usr/share/doc 539 | @sudo chown -R root:wheel ${WORK_D}/usr/share/doc 540 | @sudo chmod -R 755 ${WORK_D}/usr/share/doc 541 | 542 | l_var: l_private 543 | @sudo mkdir -p ${WORK_D}/private/var 544 | @sudo chown -R root:wheel ${WORK_D}/private/var 545 | @sudo chmod -R 755 ${WORK_D}/private/var 546 | 547 | l_var_lib: l_root 548 | @sudo mkdir -p ${WORK_D}/private/var/lib 549 | @sudo chown -R root:wheel ${WORK_D}/private/var/lib 550 | @sudo chmod -R 755 ${WORK_D}/private/var/lib 551 | 552 | l_var_lib_puppet: l_root 553 | @sudo mkdir -p ${WORK_D}/private/var/lib/puppet 554 | @sudo chown -R root:wheel ${WORK_D}/private/var/lib/puppet 555 | @sudo chmod -R 755 ${WORK_D}/private/var/lib/puppet 556 | 557 | l_var_db: l_var 558 | @sudo mkdir -p ${WORK_D}/private/var/db 559 | @sudo chown -R root:wheel ${WORK_D}/private/var/db 560 | @sudo chmod -R 755 ${WORK_D}/private/var/db 561 | 562 | l_var_db_ConfigurationProfiles: l_var_db 563 | @sudo mkdir -p ${WORK_D}/private/var/db/ConfigurationProfiles 564 | @sudo chown root:wheel ${WORK_D}/private/var/db/ConfigurationProfiles 565 | @sudo chmod 755 ${WORK_D}/private/var/db/ConfigurationProfiles 566 | 567 | l_var_db_ConfigurationProfiles_Setup: l_var_db_ConfigurationProfiles 568 | @sudo mkdir -p ${WORK_D}/private/var/db/ConfigurationProfiles/Setup 569 | @sudo chown root:wheel ${WORK_D}/private/var/db/ConfigurationProfiles/Setup 570 | @sudo chmod 700 ${WORK_D}/private/var/db/ConfigurationProfiles/Setup 571 | 572 | l_var_db_dslocal: l_var_db 573 | @sudo mkdir -p ${WORK_D}/private/var/db/dslocal 574 | @sudo chown -R root:wheel ${WORK_D}/private/var/db/dslocal 575 | @sudo chmod -R 755 ${WORK_D}/private/var/db/dslocal 576 | 577 | l_var_db_dslocal_nodes: l_var_db_dslocal 578 | @sudo mkdir -p ${WORK_D}/private/var/db/dslocal/nodes 579 | @sudo chown -R root:wheel ${WORK_D}/private/var/db/dslocal/nodes 580 | @sudo chmod -R 755 ${WORK_D}/private/var/db/dslocal/nodes 581 | 582 | l_var_db_dslocal_nodes_Default: l_var_db_dslocal_nodes 583 | @sudo mkdir -p ${WORK_D}/private/var/db/dslocal/nodes/Default 584 | @sudo chown -R root:wheel ${WORK_D}/private/var/db/dslocal/nodes/Default 585 | @sudo chmod -R 600 ${WORK_D}/private/var/db/dslocal/nodes/Default 586 | 587 | l_var_db_dslocal_nodes_Default_groups: l_var_db_dslocal_nodes_Default 588 | @sudo mkdir -p ${WORK_D}/private/var/db/dslocal/nodes/Default/groups 589 | @sudo chown -R root:wheel ${WORK_D}/private/var/db/dslocal/nodes/Default/groups 590 | @sudo chmod -R 700 ${WORK_D}/private/var/db/dslocal/nodes/Default/groups 591 | 592 | l_var_db_dslocal_nodes_Default_users: l_var_db_dslocal_nodes_Default 593 | @sudo mkdir -p ${WORK_D}/private/var/db/dslocal/nodes/Default/users 594 | @sudo chown -R root:wheel ${WORK_D}/private/var/db/dslocal/nodes/Default/users 595 | @sudo chmod -R 700 ${WORK_D}/private/var/db/dslocal/nodes/Default/users 596 | 597 | l_var_root: l_var 598 | @sudo mkdir -p ${WORK_D}/private/var/root 599 | @sudo chown -R root:wheel ${WORK_D}/private/var/root 600 | @sudo chmod -R 750 ${WORK_D}/private/var/root 601 | 602 | l_var_root_Library: l_var_root 603 | @sudo mkdir -p ${WORK_D}/private/var/root/Library 604 | @sudo chown -R root:wheel ${WORK_D}/private/var/root/Library 605 | @sudo chmod -R 700 ${WORK_D}/private/var/root/Library 606 | 607 | l_var_root_Library_Preferences: l_var_root_Library 608 | @sudo mkdir -p ${WORK_D}/private/var/root/Library/Preferences 609 | @sudo chown -R root:wheel ${WORK_D}/private/var/root/Library/Preferences 610 | @sudo chmod -R 700 ${WORK_D}/private/var/root/Library/Preferences 611 | 612 | l_Applications: l_root 613 | @sudo mkdir -p ${WORK_D}/Applications 614 | @sudo chown root:admin ${WORK_D}/Applications 615 | @sudo chmod 775 ${WORK_D}/Applications 616 | 617 | l_Applications_Utilities: l_root 618 | @sudo mkdir -p ${WORK_D}/Applications/Utilities 619 | @sudo chown root:admin ${WORK_D}/Applications/Utilities 620 | @sudo chmod 755 ${WORK_D}/Applications/Utilities 621 | 622 | l_Library: l_root 623 | @sudo mkdir -p ${WORK_D}/Library 624 | @sudo chown root:admin ${WORK_D}/Library 625 | @sudo chmod 1775 ${WORK_D}/Library 626 | 627 | l_Library_Application_Support: l_Library 628 | @sudo mkdir -p ${WORK_D}/Library/Application\ Support 629 | @sudo chown root:admin ${WORK_D}/Library/Application\ Support 630 | @sudo chmod 755 ${WORK_D}/Library/Application\ Support 631 | 632 | l_Library_Application_Support_Adobe: l_Library 633 | @sudo mkdir -p ${WORK_D}/Library/Application\ Support/Adobe 634 | @sudo chown root:admin ${WORK_D}/Library/Application\ Support/Adobe 635 | @sudo chmod 775 ${WORK_D}/Library/Application\ Support/Adobe 636 | 637 | l_Library_Application_Support_Oracle: l_Library 638 | @sudo mkdir -p ${WORK_D}/Library/Application\ Support/Oracle 639 | @sudo chown root:admin ${WORK_D}/Library/Application\ Support/Oracle 640 | @sudo chmod 755 ${WORK_D}/Library/Application\ Support/Oracle 641 | 642 | l_Library_Application_Support_Oracle_Java: l_Library_Application_Support_Oracle 643 | @sudo mkdir -p ${WORK_D}/Library/Application\ Support/Oracle/Java 644 | @sudo chown root:admin ${WORK_D}/Library/Application\ Support/Oracle/Java 645 | @sudo chmod 755 ${WORK_D}/Library/Application\ Support/Oracle/Java 646 | 647 | l_Library_Application_Support_Oracle_Java_Deployment: l_Library_Application_Support_Oracle_Java 648 | @sudo mkdir -p ${WORK_D}/Library/Application\ Support/Oracle/Java/Deployment 649 | @sudo chown root:admin ${WORK_D}/Library/Application\ Support/Oracle/Java/Deployment 650 | @sudo chmod 755 ${WORK_D}/Library/Application\ Support/Oracle/Java/Deployment 651 | 652 | l_Library_Desktop_Pictures: l_Library 653 | @sudo mkdir -p ${WORK_D}/Library/Desktop\ Pictures 654 | @sudo chown root:admin ${WORK_D}/Library/Desktop\ Pictures 655 | @sudo chmod 775 ${WORK_D}/Library/Desktop\ Pictures 656 | 657 | l_Library_Fonts: l_Library 658 | @sudo mkdir -p ${WORK_D}/Library/Fonts 659 | @sudo chown root:admin ${WORK_D}/Library/Fonts 660 | @sudo chmod 775 ${WORK_D}/Library/Fonts 661 | 662 | l_Library_LaunchAgents: l_Library 663 | @sudo mkdir -p ${WORK_D}/Library/LaunchAgents 664 | @sudo chown root:wheel ${WORK_D}/Library/LaunchAgents 665 | @sudo chmod 755 ${WORK_D}/Library/LaunchAgents 666 | 667 | l_Library_LaunchDaemons: l_Library 668 | @sudo mkdir -p ${WORK_D}/Library/LaunchDaemons 669 | @sudo chown root:wheel ${WORK_D}/Library/LaunchDaemons 670 | @sudo chmod 755 ${WORK_D}/Library/LaunchDaemons 671 | 672 | l_Library_Preferences: l_Library 673 | @sudo mkdir -p ${WORK_D}/Library/Preferences 674 | @sudo chown root:admin ${WORK_D}/Library/Preferences 675 | @sudo chmod 775 ${WORK_D}/Library/Preferences 676 | 677 | l_Library_Preferences_OpenDirectory: l_Library_Preferences 678 | @sudo mkdir -p ${WORK_D}/Library/Preferences/OpenDirectory 679 | @sudo chown root:wheel ${WORK_D}/Library/Preferences/OpenDirectory 680 | @sudo chmod 755 ${WORK_D}/Library/Preferences/OpenDirectory 681 | 682 | l_Library_Preferences_OpenDirectory_Configurations: l_Library_Preferences_OpenDirectory 683 | @sudo mkdir -p ${WORK_D}/Library/Preferences/OpenDirectory/Configurations 684 | @sudo chown root:wheel ${WORK_D}/Library/Preferences/OpenDirectory/Configurations 685 | @sudo chmod 755 ${WORK_D}/Library/Preferences/OpenDirectory/Configurations 686 | 687 | l_Library_Preferences_OpenDirectory_Configurations_LDAPv3: l_Library_Preferences_OpenDirectory_Configurations 688 | @sudo mkdir -p ${WORK_D}/Library/Preferences/OpenDirectory/Configurations/LDAPv3 689 | @sudo chown root:wheel ${WORK_D}/Library/Preferences/OpenDirectory/Configurations/LDAPv3 690 | @sudo chmod 750 ${WORK_D}/Library/Preferences/OpenDirectory/Configurations/LDAPv3 691 | 692 | l_Library_Preferences_DirectoryService: l_Library_Preferences 693 | @sudo mkdir -p ${WORK_D}/Library/Preferences/DirectoryService 694 | @sudo chown root:admin ${WORK_D}/Library/Preferences/DirectoryService 695 | @sudo chmod 775 ${WORK_D}/Library/Preferences/DirectoryService 696 | 697 | l_Library_PreferencePanes: l_Library 698 | @sudo mkdir -p ${WORK_D}/Library/PreferencePanes 699 | @sudo chown root:wheel ${WORK_D}/Library/PreferencePanes 700 | @sudo chmod 755 ${WORK_D}/Library/PreferencePanes 701 | 702 | l_Library_Printers: l_Library 703 | @sudo mkdir -p ${WORK_D}/Library/Printers 704 | @sudo chown root:admin ${WORK_D}/Library/Printers 705 | @sudo chmod 775 ${WORK_D}/Library/Printers 706 | 707 | l_Library_Printers_PPDs: l_Library_Printers 708 | @sudo mkdir -p ${WORK_D}/Library/Printers/PPDs/Contents/Resources 709 | @sudo chown root:admin ${WORK_D}/Library/Printers/PPDs 710 | @sudo chmod 775 ${WORK_D}/Library/Printers/PPDs 711 | 712 | l_PPDs: l_Library_Printers_PPDs 713 | 714 | l_Library_Receipts: l_Library 715 | @sudo mkdir -p ${WORK_D}/Library/Receipts 716 | @sudo chown root:admin ${WORK_D}/Library/Receipts 717 | @sudo chmod 775 ${WORK_D}/Library/Receipts 718 | 719 | l_Library_ScreenSavers: l_Library 720 | @sudo mkdir -p ${WORK_D}/Library/Screen\ Savers 721 | @sudo chown root:wheel ${WORK_D}/Library/Screen\ Savers 722 | @sudo chmod 755 ${WORK_D}/Library/Screen\ Savers 723 | 724 | l_Library_User_Pictures: l_Library 725 | @sudo mkdir -p ${WORK_D}/Library/User\ Pictures 726 | @sudo chown root:admin ${WORK_D}/Library/User\ Pictures 727 | @sudo chmod 775 ${WORK_D}/Library/User\ Pictures 728 | 729 | l_Library_CorpSupport: l_Library 730 | @sudo mkdir -p ${WORK_D}/Library/CorpSupport 731 | @sudo chown root:admin ${WORK_D}/Library/CorpSupport 732 | @sudo chmod 775 ${WORK_D}/Library/CorpSupport 733 | 734 | l_Library_Python: l_Library 735 | @sudo mkdir -p ${WORK_D}/Library/Python 736 | @sudo chown root:admin ${WORK_D}/Library/Python 737 | @sudo chmod 775 ${WORK_D}/Library/Python 738 | 739 | l_Library_Python_26: l_Library_Python 740 | @sudo mkdir -p ${WORK_D}/Library/Python/2.6 741 | @sudo chown root:admin ${WORK_D}/Library/Python/2.6 742 | @sudo chmod 775 ${WORK_D}/Library/Python/2.6 743 | 744 | l_Library_Python_26_site_packages: l_Library_Python_26 745 | @sudo mkdir -p ${WORK_D}/Library/Python/2.6/site-packages 746 | @sudo chown root:admin ${WORK_D}/Library/Python/2.6/site-packages 747 | @sudo chmod 775 ${WORK_D}/Library/Python/2.6/site-packages 748 | 749 | l_Library_Ruby: l_Library 750 | @sudo mkdir -p ${WORK_D}/Library/Ruby 751 | @sudo chown root:admin ${WORK_D}/Library/Ruby 752 | @sudo chmod 775 ${WORK_D}/Library/Ruby 753 | 754 | l_Library_Ruby_Site: l_Library_Ruby 755 | @sudo mkdir -p ${WORK_D}/Library/Ruby/Site 756 | @sudo chown root:admin ${WORK_D}/Library/Ruby/Site 757 | @sudo chmod 775 ${WORK_D}/Library/Ruby/Site 758 | 759 | l_Library_Ruby_Site_1_8: l_Library_Ruby_Site 760 | @sudo mkdir -p ${WORK_D}/Library/Ruby/Site/1.8 761 | @sudo chown root:admin ${WORK_D}/Library/Ruby/Site/1.8 762 | @sudo chmod 775 ${WORK_D}/Library/Ruby/Site/1.8 763 | 764 | l_Library_StartupItems: l_Library 765 | @sudo mkdir -p ${WORK_D}/Library/StartupItems 766 | @sudo chown root:wheel ${WORK_D}/Library/StartupItems 767 | @sudo chmod 755 ${WORK_D}/Library/StartupItems 768 | 769 | l_System: l_root 770 | @sudo mkdir -p ${WORK_D}/System 771 | @sudo chown -R root:wheel ${WORK_D}/System 772 | @sudo chmod -R 755 ${WORK_D}/System 773 | 774 | l_System_Library: l_System 775 | @sudo mkdir -p ${WORK_D}/System/Library 776 | @sudo chown -R root:wheel ${WORK_D}/System/Library 777 | @sudo chmod -R 755 ${WORK_D}/System/Library 778 | 779 | l_System_Library_Extensions: l_System_Library 780 | @sudo mkdir -p ${WORK_D}/System/Library/Extensions 781 | @sudo chown -R root:wheel ${WORK_D}/System/Library/Extensions 782 | @sudo chmod -R 755 ${WORK_D}/System/Library/Extensions 783 | 784 | l_System_Library_User_Template: l_System_Library 785 | @sudo mkdir -p ${USER_TEMPLATE}/English.lproj 786 | @sudo chown -R root:wheel ${USER_TEMPLATE}/English.lproj 787 | @sudo chmod 700 ${USER_TEMPLATE} 788 | @sudo chmod -R 755 ${USER_TEMPLATE}/English.lproj 789 | 790 | l_System_Library_User_Template_Library: l_System_Library_User_Template 791 | @sudo mkdir -p ${USER_TEMPLATE}/English.lproj/Library 792 | @sudo chown root:wheel ${USER_TEMPLATE}/English.lproj/Library 793 | @sudo chmod 700 ${USER_TEMPLATE}/English.lproj/Library 794 | 795 | l_System_Library_User_Template_Pictures: l_System_Library_User_Template 796 | @sudo mkdir -p ${USER_TEMPLATE_PICTURES} 797 | @sudo chown root:wheel ${USER_TEMPLATE_PICTURES} 798 | @sudo chmod 700 ${USER_TEMPLATE_PICTURES} 799 | 800 | l_System_Library_User_Template_Preferences: l_System_Library_User_Template_Library 801 | @sudo mkdir -p ${USER_TEMPLATE_PREFERENCES} 802 | @sudo chown root:wheel ${USER_TEMPLATE_PREFERENCES} 803 | @sudo chmod -R 700 ${USER_TEMPLATE_PREFERENCES} 804 | 805 | l_System_Library_User_Template_Library_Application_Support: l_System_Library_User_Template_Library 806 | @sudo mkdir -p ${USER_TEMPLATE}/English.lproj/Library/Application\ Support 807 | @sudo chown root:wheel ${USER_TEMPLATE}/English.lproj/Library/Application\ Support 808 | @sudo chmod 700 ${USER_TEMPLATE}/English.lproj/Library/Application\ Support 809 | 810 | l_System_Library_User_Template_Library_Application_Support_Firefox: l_System_Library_User_Template_Library_Application_Support 811 | @sudo mkdir -p ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox 812 | @sudo chown root:wheel ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox 813 | @sudo chmod 700 ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox 814 | 815 | l_System_Library_User_Template_Library_Application_Support_Firefox_Profiles: l_System_Library_User_Template_Library_Application_Support_Firefox 816 | @sudo mkdir -p ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox/Profiles 817 | @sudo chown root:wheel ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox/Profiles 818 | @sudo chmod 700 ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox/Profiles 819 | 820 | l_System_Library_User_Template_Library_Application_Support_Firefox_Profiles_Default: l_System_Library_User_Template_Library_Application_Support_Firefox_Profiles 821 | @sudo mkdir -p ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox/Profiles/a7e8aa9f.default 822 | @sudo chown root:wheel ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox/Profiles/a7e8aa9f.default 823 | @sudo chmod 700 ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox/Profiles/a7e8aa9f.default 824 | 825 | l_System_Library_User_Template_Library_Application_Support_Oracle: l_System_Library_User_Template_Library 826 | @sudo mkdir -p ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle 827 | @sudo chown root:wheel ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle 828 | @sudo chmod 700 ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle 829 | 830 | l_System_Library_User_Template_Library_Application_Support_Oracle_Java: l_System_Library_User_Template_Library_Application_Support_Oracle 831 | @sudo mkdir -p ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle/Java 832 | @sudo chown root:wheel ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle/Java 833 | @sudo chmod 700 ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle/Java 834 | 835 | l_System_Library_User_Template_Library_Application_Support_Oracle_Java_Deployment: l_System_Library_User_Template_Library_Application_Support_Oracle_Java 836 | @sudo mkdir -p ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle/Java/Deployment 837 | @sudo chown root:wheel ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle/Java/Deployment 838 | @sudo chmod 700 ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle/Java/Deployment 839 | 840 | # These user domain locations are for use in rare circumstances, and 841 | # as a last resort only for repackaging applications that use them. 842 | # A notice will be issued during the build process. 843 | l_Users: l_root 844 | @sudo mkdir -p ${WORK_D}/Users 845 | @sudo chown root:admin ${WORK_D}/Users 846 | @sudo chmod 755 ${WORK_D}/Users 847 | @echo "Creating \"Users\" directory" 848 | 849 | l_Users_Shared: l_Users 850 | @sudo mkdir -p ${WORK_D}/Users/Shared 851 | @sudo chown root:wheel ${WORK_D}/Users/Shared 852 | @sudo chmod 1777 ${WORK_D}/Users/Shared 853 | @echo "Creating \"Users/Shared\" directory" 854 | 855 | # file packaging rules 856 | bundle-%: % payload_d 857 | sudo ${CP} "${<}" ${PAYLOAD_D} 858 | 859 | pack-open-directory-%: % l_Library_Preferences_OpenDirectory 860 | sudo install -m 600 -o root -g wheel "${<}" ${WORK_D}/Library/Preferences/OpenDirectory 861 | 862 | pack-open-directory-configurations-%: % l_Library_Preferences_OpenDirectory_Configurations 863 | sudo install -m 600 -o root -g wheel "${<}" ${WORK_D}/Library/Preferences/OpenDirectory/Configurations 864 | 865 | pack-open-directory-configurations-ldapv3-%: % l_Library_Preferences_OpenDirectory_Configurations_LDAPv3 866 | sudo install -m 600 -o root -g wheel "${<}" ${WORK_D}/Library/Preferences/OpenDirectory/Configurations/LDAPv3 867 | 868 | pack-directory-service-preference-%: % l_Library_Preferences_DirectoryService 869 | sudo install -m 600 -o root -g admin "${<}" ${WORK_D}/Library/Preferences/DirectoryService 870 | 871 | pack-site-python-%: % l_Library_Python_26_site_packages 872 | @sudo ${INSTALL} -m 644 -g admin -o root "${<}" ${WORK_D}/Library/Python/2.6/site-packages 873 | 874 | pack-siteruby-%: % l_Library_Ruby_Site_1_8 875 | @sudo ${INSTALL} -m 644 -g wheel -o root "${<}" ${WORK_D}/Library/Ruby/Site/1.8 876 | 877 | pack-Library-Application-Support-Oracle-Java-Deployment-%: % l_Library_Application_Support_Oracle_Java_Deployment 878 | @sudo ${INSTALL} -m 644 -g admin -o root "${<}" ${WORK_D}/Library/Application\ Support/Oracle/Java/Deployment 879 | 880 | pack-Library-Fonts-%: % l_Library_Fonts 881 | @sudo ${INSTALL} -m 664 -g admin -o root "${<}" ${WORK_D}/Library/Fonts 882 | 883 | pack-Library-LaunchAgents-%: % l_Library_LaunchAgents 884 | @sudo ${INSTALL} -m 644 -g wheel -o root "${<}" ${WORK_D}/Library/LaunchAgents 885 | 886 | pack-Library-LaunchDaemons-%: % l_Library_LaunchDaemons 887 | @sudo ${INSTALL} -m 644 -g wheel -o root "${<}" ${WORK_D}/Library/LaunchDaemons 888 | 889 | pack-Library-Preferences-%: % l_Library_Preferences 890 | @sudo ${INSTALL} -m 644 -g admin -o root "${<}" ${WORK_D}/Library/Preferences 891 | 892 | pack-Library-ScreenSavers-%: % l_Library_ScreenSavers 893 | @sudo ${DITTO} --noqtn "${<}" ${WORK_D}/Library/Screen\ Savers/"${<}" 894 | @sudo chown -R root:wheel ${WORK_D}/Library/Screen\ Savers/"${<}" 895 | @sudo chmod 755 ${WORK_D}/Library/Screen\ Savers/"${<}" 896 | 897 | pack-ppd-%: % l_PPDs 898 | @sudo ${INSTALL} -m 664 -g admin -o root "${<}" ${WORK_D}/Library/Printers/PPDs/Contents/Resources 899 | 900 | pack-script-pb-%: % scriptdir 901 | @echo "******************************************************************" 902 | @echo "" 903 | @echo "Using ${PKGBUILD}, make sure scripts are" 904 | @echo "named preinstall/postinstall" 905 | @echo "" 906 | @echo "Also check your pack-script-* stanzas in PAYLOAD" 907 | @echo "" 908 | @echo "******************************************************************" 909 | @sudo ${INSTALL} -o root -g wheel -m 755 "${<}" ${SCRIPT_D} 910 | 911 | pack-script-pm-%: % scriptdir 912 | @echo "******************************************************************" 913 | @echo "" 914 | @echo "Using ${PACKAGEMAKER}, make sure script names and PAYLOAD are" 915 | @echo "named preflight/postflight" 916 | @echo "" 917 | @echo "Also check your pack-script-* stanzas in PAYLOAD" 918 | @echo "" 919 | @echo "******************************************************************" 920 | @sudo ${INSTALL} -o root -g wheel -m 755 "${<}" ${SCRIPT_D} 921 | 922 | ifeq (${USE_PKGBUILD}, 0) 923 | pack-script-%: pack-script-pm-% ; 924 | else 925 | pack-script-%: pack-script-pb-% ; 926 | endif 927 | 928 | 929 | pack-resource-%: % resourcedir 930 | @sudo ${INSTALL} -m 755 "${<}" ${RESOURCE_D} 931 | 932 | pack-en-resource-%: % enlprojdir 933 | @echo "Packing a non-payload item into the installer Resources directory." 934 | @sudo ${INSTALL} -m 755 "${<}" ${EN_LPROJ_D} 935 | 936 | pack-user-template-plist-%: % l_System_Library_User_Template_Preferences 937 | @sudo ${INSTALL} -m 644 "${<}" ${USER_TEMPLATE_PREFERENCES} 938 | 939 | pack-user-picture-%: % l_Library_Desktop_Pictures 940 | @sudo ${INSTALL} -m 644 "${<}" ${WORK_D}/Library/Desktop\ Pictures 941 | 942 | pack-User-Template-Library-Application-Support-Firefox-Profiles-Default-%: % l_System_Library_User_Template_Library_Application_Support_Firefox_Profiles_Default 943 | @sudo ${INSTALL} -m 644 "${<}" ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Firefox/Profiles/a7e8aa9f.default 944 | 945 | pack-User-Template-Library-Application-Support-Oracle-Java-Deployment-%: % l_System_Library_User_Template_Library_Application_Support_Oracle_Java_Deployment 946 | @sudo ${INSTALL} -m 644 -g wheel -o root "${<}" ${USER_TEMPLATE}/English.lproj/Library/Application\ Support/Oracle/Java/Deployment 947 | 948 | # posixy file stanzas 949 | 950 | pack-bin-%: % l_private_bin 951 | @sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/private/bin 952 | 953 | pack-etc-%: % l_private_etc 954 | @sudo ${INSTALL} -m 644 -g wheel -o root "${<}" ${WORK_D}/private/etc 955 | 956 | pack-etc-openldap-%: % l_etc_openldap 957 | @sudo install -m 644 -o root -g wheel "${<}" "${PKGROOT}"/etc/openldap 958 | 959 | pack-sbin-%: % l_private_sbin 960 | @sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/private/sbin 961 | 962 | pack-usr-bin-%: % l_usr_bin 963 | @sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/bin 964 | 965 | pack-usr-sbin-%: % l_usr_sbin 966 | @sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/sbin 967 | 968 | pack-usr-local-bin-%: % l_usr_local_bin 969 | @sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/local/bin 970 | 971 | pack-usr-local-sbin-%: % l_usr_local_sbin 972 | @sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/local/sbin 973 | 974 | pack-var-db-ConfigurationProfiles-Setup-%: % l_var_db_ConfigurationProfiles_Setup 975 | sudo ${INSTALL} -m 644 "${<}" ${WORK_D}/private/var/db/ConfigurationProfiles/Setup 976 | 977 | pack-var-db-dslocal-nodes-Default-groups-%: % l_private_var_db_dslocal_nodes_Default_groups 978 | @echo "Packing file ${<} into the DSLocal Default node." 979 | @echo "You may wish to consider alternatives to this." 980 | @sudo ${INSTALL} -m 600 -g wheel -o root "${<}" ${WORK_D}/private/var/db/dslocal/nodes/Default/groups 981 | 982 | pack-var-db-dslocal-nodes-Default-users-%: % l_private_var_db_dslocal_nodes_Default_users 983 | @echo "Packing file ${<} into the DSLocal Default node." 984 | @echo "You may wish to consider alternatives to this." 985 | @sudo ${INSTALL} -m 600 -g wheel -o root "${<}" ${WORK_D}/private/var/db/dslocal/nodes/Default/users 986 | 987 | pack-var-root-Library-Preferences-%: % l_private_var_root_Library_Preferences 988 | @sudo ${INSTALL} -m 600 -g wheel -o root "${<}" ${WORK_D}/private/var/root/Library/Preferences 989 | 990 | pack-man-%: % l_usr_man 991 | @sudo ${INSTALL} -m 0644 -g wheel -o root "${<}" ${WORK_D}/usr/share/man 992 | 993 | pack-man1-%: % l_usr_man_man1 994 | @sudo ${INSTALL} -m 0644 -g wheel -o root "${<}" ${WORK_D}/usr/share/man/man1 995 | 996 | pack-man2-%: % l_usr_man_man2 997 | @sudo ${INSTALL} -m 0644 -g wheel -o root "${<}" ${WORK_D}/usr/share/man/man2 998 | 999 | pack-man3-%: % l_usr_man_man3 1000 | @sudo ${INSTALL} -m 0644 -g wheel -o root "${<}" ${WORK_D}/usr/share/man/man3 1001 | 1002 | pack-man4-%: % l_usr_man_man4 1003 | @sudo ${INSTALL} -m 0644 -g wheel -o root "${<}" ${WORK_D}/usr/share/man/man4 1004 | 1005 | pack-man5-%: % l_usr_man_man5 1006 | @sudo ${INSTALL} -m 0644 -g wheel -o root "${<}" ${WORK_D}/usr/share/man/man5 1007 | 1008 | pack-man6-%: % l_usr_man_man6 1009 | @sudo ${INSTALL} -m 0644 -g wheel -o root "${<}" ${WORK_D}/usr/share/man/man6 1010 | 1011 | pack-man7-%: % l_usr_man_man7 1012 | @sudo ${INSTALL} -m 0644 -g wheel -o root "${<}" ${WORK_D}/usr/share/man/man7 1013 | 1014 | pack-man8-%: % l_usr_man_man8 1015 | @sudo ${INSTALL} -m 0644 -g wheel -o root "${<}" ${WORK_D}/usr/share/man/man8 1016 | 1017 | pack-hookscript-%: % l_private_etc_hooks 1018 | @sudo ${INSTALL} -m 755 "${<}" ${WORK_D}/private/etc/hooks 1019 | 1020 | # Applications and Utilities 1021 | # 1022 | # We use ${TAR} because it respects resource forks. This is still 1023 | # critical - just when I thought I'd seen the last of the damn things, Apple 1024 | # decided to stash compressed binaries in them in 10.6. 1025 | 1026 | unbz2-applications-%: %.tar.bz2 l_Applications 1027 | @sudo ${TAR} xjf "${<}" -C ${WORK_D}/Applications 1028 | @sudo chown -R root:admin ${WORK_D}/Applications/"$(shell echo "${<}" | sed s/\.tar\.bz2//g)" 1029 | 1030 | unbz2-utilities-%: %.tar.bz2 l_Applications_Utilities 1031 | @sudo ${TAR} xjf "${<}" -C ${WORK_D}/Applications/Utilities 1032 | @sudo chown -R root:admin ${WORK_D}/Applications/Utilities/"$(shell echo "${<}" | sed s/\.tar\.bz2//g)" 1033 | 1034 | unbz2-preferencepanes-%: %.tar.bz2 l_Library_PreferencePanes 1035 | @sudo ${TAR} xjf "${<}" -C ${WORK_D}/Library/PreferencePanes 1036 | @sudo chown -R root:admin ${WORK_D}/Library/PreferencePanes/"$(shell echo "${<}" | sed s/\.tar\.bz2//g)" 1037 | 1038 | ungz-applications-%: %.tar.gz l_Applications 1039 | @sudo ${TAR} xzf "${<}" -C ${WORK_D}/Applications 1040 | @sudo chown -R root:admin ${WORK_D}/Applications/"$(shell echo "${<}" | sed s/\.tar\.gz//g)" 1041 | 1042 | ungz-utilities-%: %.tar.gz l_Applications_Utilities 1043 | @sudo ${TAR} xzf "${<}" -C ${WORK_D}/Applications/Utilities 1044 | @sudo chown -R root:admin ${WORK_D}/Applications/Utilities/"$(shell echo "${<}" | sed s/\.tar\.gz//g)" 1045 | 1046 | # ${DITTO} preserves resource forks by default 1047 | # --noqtn drops quarantine information 1048 | 1049 | # Allow for packaging software in the same working directory as the Makefile 1050 | pack-applications-%: % l_Applications 1051 | @sudo ${DITTO} --noqtn "${<}" ${WORK_D}/Applications/"${<}" 1052 | @sudo chown -R root:admin ${WORK_D}/Applications/"${<}" 1053 | @sudo chmod 755 ${WORK_D}/Applications/"${<}" 1054 | 1055 | # Allow for packaging software dirctly from the /Applications directory. 1056 | pack-from-applications-%: /Applications/% l_Applications 1057 | @sudo ${DITTO} --noqtn "${<}" ${WORK_D}"${<}" 1058 | @sudo chown -R root:admin ${WORK_D}"${<}" 1059 | @sudo chmod 755 ${WORK_D}"${<}" 1060 | 1061 | pack-utilities-%: % l_Applications_Utilities 1062 | @sudo ${DITTO} --noqtn "${<}" ${WORK_D}/Applications/Utilities/"${<}" 1063 | @sudo chown -R root:admin ${WORK_D}/Applications/Utilities/"${<}" 1064 | @sudo chmod 755 ${WORK_D}/Applications/Utilities/"${<}" 1065 | 1066 | pack-preferencepanes-%: % l_Library_PreferencePanes 1067 | @sudo ${DITTO} --noqtn "${<}" ${WORK_D}/Library/PreferencePanes/"${<}" 1068 | @sudo chown -R root:admin ${WORK_D}/Library/PreferencePanes/"${<}" 1069 | @sudo chmod 755 ${WORK_D}/Library/PreferencePanes/"${<}" 1070 | 1071 | pack-from-preferencepanes-%: /Library/PreferencePanes/% l_Library_PreferencePanes 1072 | @sudo ${DITTO} --noqtn "${<}" ${WORK_D}"${<}" 1073 | @sudo chown -R root:admin ${WORK_D}"${<}" 1074 | @sudo chmod 755 ${WORK_D}"${<}" 1075 | 1076 | # -k -x extracts zip 1077 | # Zipped applications commonly found on the Web usually have the suffixes substituted, so these stanzas substitute them back 1078 | 1079 | unzip-applications-%: %.zip l_Applications 1080 | @sudo ${DITTO} --noqtn -k -x "${<}" ${WORK_D}/Applications/ 1081 | @sudo chown -R root:admin ${WORK_D}/Applications/$(shell echo "${<}" | sed s/\.zip/.app/g) 1082 | 1083 | unzip-utilities-%: %.zip l_Applications_Utilities 1084 | @sudo ${DITTO} --noqtn -k -x "${<}" ${WORK_D}/Applications/Utilities/ 1085 | @sudo chown -R root:admin ${WORK_D}/Applications/Utilities/$(shell echo "${<}" | sed s/\.zip/.app/g) 1086 | -------------------------------------------------------------------------------- /prototype.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | <{PLIST_FLAVOR} version="1.0"> 4 | 5 | CFBundleIdentifier 6 | {PACKAGE_ID} 7 | CFBundleShortVersionString 8 | {PACKAGE_VERSION} 9 | IFMajorVersion 10 | {PACKAGE_MAJOR_VERSION} 11 | IFMinorVersion 12 | {PACKAGE_MINOR_VERSION} 13 | IFPkgBuildDate 14 | {BUILD_DATE} 15 | IFPkgFlagAllowBackRev 16 | 17 | IFPkgFlagAuthorizationAction 18 | RootAuthorization 19 | IFPkgFlagDefaultLocation 20 | / 21 | IFPkgFlagFollowLinks 22 | 23 | IFPkgFlagInstallFat 24 | 25 | IFPkgFlagIsRequired 26 | 27 | IFPkgFlagOverwritePermissions 28 | 29 | IFPkgFlagRelocatable 30 | 31 | IFPkgFlagRestartAction 32 | {PM_RESTART} 33 | IFPkgFlagRootVolumeOnly 34 | <{ROOT_ONLY}/> 35 | IFPkgFlagUpdateInstalledLanguages 36 | 37 | 38 | 39 | --------------------------------------------------------------------------------