Root/
| |
---|---|
Source at commit 151 created 13 years 7 months ago. By ifabio, create test and Original-package folders in my branch, the original contain the "original" package from chameleon trunk, the test folder contains my actual version of the package, I start from here... sorry... now I have more feeling with SVN. | |
1 | #!/bin/bash␊ |
2 | ␊ |
3 | # $1 Path to store built package␊ |
4 | ␊ |
5 | packagesidentity="org.chameleon"␊ |
6 | ␊ |
7 | packagename="Chameleon"␊ |
8 | ␊ |
9 | pkgroot="${0%/*}"␊ |
10 | ␊ |
11 | #version=$( grep I386BOOT_CHAMELEONVERSION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )␊ |
12 | version=$( cat version )␊ |
13 | stage=${version##*-}␊ |
14 | revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )␊ |
15 | builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' )␊ |
16 | timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )␊ |
17 | ␊ |
18 | distributioncount=0␊ |
19 | xmlindent=0␊ |
20 | ␊ |
21 | indent[0]="\t"␊ |
22 | indent[1]="\t\t"␊ |
23 | indent[2]="\t\t\t"␊ |
24 | indent[3]="\t\t\t\t"␊ |
25 | ␊ |
26 | main ()␊ |
27 | {␊ |
28 | ␊ |
29 | # clean up the destination path␊ |
30 | ␊ |
31 | ␉rm -R -f "${1}"␊ |
32 | ␉␊ |
33 | ␉echo "Building $packagename Install Package v${version%%-*} $stage r$revision $builddate"␊ |
34 | ␉␊ |
35 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}<choices-outline>"␊ |
36 | ␊ |
37 | # Start␊ |
38 | ␊ |
39 | ␊ |
40 | ␊ |
41 | # build Chameleon metapackages ␊ |
42 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Chameleon\">"␊ |
43 | ␉choices[$((choicescount++))]="<choice\n\tid=\"Chameleon\"\n\ttitle=\"Chameleon_title\"\n\tdescription=\"Chameleon_description\"\n>\n</choice>\n"␊ |
44 | ␉((xmlindent++))␊ |
45 | ␊ |
46 | ␉# build core package␊ |
47 | ␉␉mkdir -p ${1}/Core/Root/i386␊ |
48 | ␉␉cp -f ${1%/*}/i386/boot ${1}/Core/Root/i386␊ |
49 | ␉␉cp -f ${1%/*}/i386/boot0 ${1}/Core/Root/i386␊ |
50 | ␉␉cp -f ${1%/*}/i386/boot0hfs ${1}/Core/Root/i386␊ |
51 | ␉␉cp -f ${1%/*}/i386/boot1f32 ${1}/Core/Root/i386␊ |
52 | ␉␉cp -f ${1%/*}/i386/boot1h ${1}/Core/Root/i386␊ |
53 | ␉␉cp -f ${1%/*}/i386/boot1he ${1}/Core/Root/i386␊ |
54 | ␉␉cp -f ${1%/*}/i386/boot1hp ${1}/Core/Root/i386␊ |
55 | ␉␉cp -f ${1%/*}/i386/cdboot ${1}/Core/Root/i386␊ |
56 | ␉␉cp -f ${1%/*}/i386/chain0 ${1}/Core/Root/i386␊ |
57 | ␉␉cp -f ${pkgroot}/fdisk440 ${1}/Core/Root/i386␊ |
58 | ␉␉fixperms "${1}/Core/Root/i386"␊ |
59 | ␉␉local coresize=$( du -hkc "${1}/Core/Root/i386" | tail -n1 | awk {'print $1'} )␊ |
60 | ␉␉echo "Building core package"␊ |
61 | ␉␉buildpackage "${1}/Core" "/binaries" "0" "start_visible=\"false\" start_selected=\"true\""␊ |
62 | ␊ |
63 | ␉# End build core package␊ |
64 | ␊ |
65 | ␉# build standard package ␊ |
66 | ␉␉mkdir -p ${1}/boot0/Root␊ |
67 | ␉␉mkdir -p ${1}/boot0/Scripts␊ |
68 | ␉␉cp -f ${pkgroot}/Scripts/boot0/postinstall ${1}/boot0/Scripts␊ |
69 | ␉␉echo "Building boot0 package"␊ |
70 | ␉␉buildpackage "${1}/boot0" "/binaries" "${coresize}" "start_enabled=\"true\" start_selected=\"false\" selected=\"exclusive(choices['EnhancedHFS']) && exclusive(choices['boot0hfs']) && exclusive(choices['EnhancedFAT']) && exclusive(choices['noboot'])\""␊ |
71 | ␉# End build standard package␊ |
72 | ␊ |
73 | ␉# build standard package with boot0hfs␊ |
74 | ␉␉mkdir -p ${1}/boot0hfs/Root␊ |
75 | ␉␉mkdir -p ${1}/boot0hfs/Scripts␊ |
76 | ␉␉cp -f ${pkgroot}/Scripts/boot0hfs/postinstall ${1}/boot0hfs/Scripts␊ |
77 | ␉␉echo "Building boot0hfs package"␊ |
78 | ␉␉buildpackage "${1}/boot0hfs" "/binaries" "${coresize}" "start_enabled=\"true\" start_selected=\"false\" selected=\"exclusive(choices['EnhancedHFS']) && exclusive(choices['boot0']) && exclusive(choices['EnhancedFAT']) && exclusive(choices['noboot'])\""␊ |
79 | ␉# End build standard package with boot0hfs␊ |
80 | ␊ |
81 | ␉# build efi fat32 package ␊ |
82 | ␉␉mkdir -p ${1}/EnhancedFAT/Root␊ |
83 | ␉␉mkdir -p ${1}/EnhancedFAT/Scripts/Tools␊ |
84 | ␉␉cp -f ${pkgroot}/Scripts/FAT/postinstall ${1}/EnhancedFAT/Scripts␊ |
85 | ␉␉ditto --arch i386 `which SetFile` ${1}/EnhancedFAT/Scripts/Tools/SetFile␊ |
86 | ␉␉echo "Building EnhacedFAT package"␊ |
87 | ␉␉buildpackage "${1}/EnhancedFAT" "/binaries" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['boot0']) && exclusive(choices['boot0hfs']) && exclusive(choices['EnhancedHFS']) && exclusive(choices['noboot'])\""␊ |
88 | ␉# End build efi fat32 package ␊ |
89 | ␊ |
90 | ␉# build efi hfs package ␊ |
91 | ␉␉mkdir -p ${1}/EnhancedHFS/Root␊ |
92 | ␉␉mkdir -p ${1}/EnhancedHFS/Scripts/Tools␊ |
93 | ␉␉cp -f ${pkgroot}/Scripts/HFS/postinstall ${1}/EnhancedHFS/Scripts␊ |
94 | ␉␉ditto --arch i386 `which SetFile` ${1}/EnhancedHFS/Scripts/Tools/SetFile␊ |
95 | ␉␉echo "Building EnhacedHFS package"␊ |
96 | ␉␉buildpackage "${1}/EnhancedHFS" "/binaries" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['boot0']) && exclusive(choices['boot0hfs']) && exclusive(choices['EnhancedFAT']) && exclusive(choices['noboot'])\""␊ |
97 | ␉# End build efi hfs package ␊ |
98 | ␊ |
99 | ␉# build reset choice package ␊ |
100 | ␉␉mkdir -p ${1}/noboot/Root␊ |
101 | ␉␉echo "Building reset choice package"␊ |
102 | ␉␉buildpackage "${1}/noboot" "/binaries" "${coresize}" "start_visible=\"true\" start_selected=\"true\" selected=\"exclusive(choices['boot0']) && exclusive(choices['boot0hfs']) && exclusive(choices['EnhancedFAT']) && exclusive(choices['EnhancedHFS'])\""␊ |
103 | ␉# End build reset choice package ␊ |
104 | ␊ |
105 | ␉((xmlindent--))␊ |
106 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"␊ |
107 | # End Chameleon metapakage␊ |
108 | ␊ |
109 | # build utility package␊ |
110 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Utility\">"␊ |
111 | ␉choices[$((choicescount++))]="<choice\n\tid=\"Utility\"\n\ttitle=\"Utility_title\"\n\tdescription=\"Utility_description\"\n>\n</choice>\n"␊ |
112 | ␉((xmlindent++))␊ |
113 | ␉packagesidentity="org.chameleon"␊ |
114 | ␊ |
115 | ␉# build package for bdmesg␊ |
116 | ␉␉mkdir -p "${1}/bdmesg/Root"␊ |
117 | ␉␉ditto --noextattr --noqtn "${1%/*}/i386/bdmesg" "${1}/bdmesg/Root"␊ |
118 | ␉␉echo "Building bdmesg package"␊ |
119 | ␉␉buildpackage "${1}/bdmesg" "/Extra/Util" "" "start_selected=\"false\""␊ |
120 | ␉# End build package for bdmesg␊ |
121 | ␊ |
122 | ␉# build package for Chameleon PrefPanel␊ |
123 | ␉␉mkdir -p "${1}/prefPane/Root/"␊ |
124 | ␉␉ditto --noextattr --noqtn "${pkgroot}/Configuration" "${1}/prefPane/Root"␊ |
125 | ␉␉echo "Building Chameleon Preference Panel package"␊ |
126 | ␉␉buildpackage "${1}/prefPane" "/Library/PreferencePanes" "" "start_selected=\"false\""␊ |
127 | ␉# End build package for Chameleon PrefPanel␊ |
128 | ␉␉␊ |
129 | ␉((xmlindent--))␊ |
130 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"␊ |
131 | # End utility package␊ |
132 | ␊ |
133 | # build options packages␊ |
134 | ␊ |
135 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Options\">"␊ |
136 | ␉choices[$((choicescount++))]="<choice\n\tid=\"Options\"\n\ttitle=\"Options_title\"\n\tdescription=\"Options_description\"\n>\n</choice>\n"␊ |
137 | ␉((xmlindent++))␊ |
138 | ␉packagesidentity="org.chameleon.options"␊ |
139 | ␉options=($( find "${pkgroot}/Scripts/Options" -type d -depth 1 -not -name '.svn' ))␊ |
140 | ␉for (( i = 0 ; i < ${#options[@]} ; i++)) ␊ |
141 | ␉do␊ |
142 | ␉␉packagesidentity="org.chameleon.flags"␊ |
143 | ␉␉flagname=($( find "${options[$i]}" -type d -depth 1 -not -name '.svn' ))␊ |
144 | ␉␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"${options[$i]##*/}\">"␊ |
145 | ␉␉choices[$((choicescount++))]="<choice\n\tid=\"${options[$i]##*/}\"\n\ttitle=\"${options[$i]##*/}\"\n\tdescription=\"${options[$i]##*/}_description\"\n>\n</choice>\n"␊ |
146 | ␉␉((xmlindent++))␊ |
147 | ␉␉for (( j = 0 ; j < ${#flagname[@]} ; j++ )) ␊ |
148 | ␉␉␉do␊ |
149 | ␉␉␉␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"${options[$i]##*/}_${flagname[$j]##*/}\">"␊ |
150 | ␉␉␉␉choices[$((choicescount++))]="<choice\n\tid=\"${options[$i]##*/}_${flagname[$j]##*/}\"\n\ttitle=\"${options[$i]##*/}_${flagname[$j]##*/}\"\n\tdescription=\"${options[$i]##*/}_${flagname[$j]##*/}_description\"\n>\n</choice>\n"␊ |
151 | ␉␉␉␉((xmlindent++))␊ |
152 | ␉␉␉␉␉␉mkdir -p "${1}/${flagname[$j]##*/}/Root"␊ |
153 | ␉␉␉␉␉␉mkdir -p "${1}/${flagname[$j]##*/}/Scripts"␊ |
154 | ␉␉␉␉␉␉ditto --noextattr --noqtn "${options[$i]}/${flagname[$j]##*/}/postinstall" "${1}/${options[$i]##*/}${flagname[$j]##*/}/Scripts/postinstall"␊ |
155 | ␉␉␉␉␉#␉cp -f "${options[$i]}/${flagname[$j]##*/}/*" "${1}/${options[$i]##*/}${flagname[$j]##*/}/Scripts/postinstall"␊ |
156 | ␉␉␉␉␉#␉echo "Building ${options[$i]##*/}${flagname[$j]##*/} package"␊ |
157 | ␉␉␉␉␉␉buildpackage "${1}/${options[$i]##*/}_${flagname[$j]##*/}" "/" "${coresize}" "start_selected=\"false\""␊ |
158 | ␉␉␉␉␉␉rm -R -f "${1}/${j##*/}"␊ |
159 | ␉␉␉␉((xmlindent--))␊ |
160 | ␉␉␉␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"␊ |
161 | ␉␉done␊ |
162 | ␉␉((xmlindent--))␊ |
163 | ␉␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"␊ |
164 | ␉␉echo "Building ${options[$i]##*/} package"␊ |
165 | ␉␉buildpackage "${1}/${options[$i]##*/}" "/" "${coresize}" "start_selected=\"false\""␊ |
166 | ␉␉rm -R -f "${1}/${i##*/}"␊ |
167 | ␉done␊ |
168 | ␉((xmlindent--))␊ |
169 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"␊ |
170 | # End build options packages␊ |
171 | ␊ |
172 | # build theme packages␊ |
173 | ␊ |
174 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Themes\">"␊ |
175 | ␉choices[$((choicescount++))]="<choice\n\tid=\"Themes\"\n\ttitle=\"Themes_title\"\n\tdescription=\"Themes_description\"\n>\n</choice>\n"␊ |
176 | ␉((xmlindent++))␊ |
177 | ␉␉packagesidentity="org.chameleon.theme"␊ |
178 | ␉␉artwork="${1%/*}"␊ |
179 | ␉␉themes=($( find "${artwork%/*}/artwork/themes" -type d -depth 1 -not -name '.svn' ))␊ |
180 | ␉␉for (( i = 0 ; i < ${#themes[@]} ; i++ )) ␊ |
181 | ␉␉do␊ |
182 | ␉␉␉theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' )␊ |
183 | ␉␉␉mkdir -p "${1}/${theme}/Root/"␊ |
184 | ␉␉␉ditto --noextattr --noqtn "${themes[$i]}" "${1}/${themes[$i]##*/}/Root/${theme}"␊ |
185 | ␉␉␉find "${1}/${themes[$i]##*/}" -name '.DS_Store' -or -name '.svn' -exec rm -R {} \+␊ |
186 | ␉␉␉find "${1}/${themes[$i]##*/}" -type f -exec chmod 644 {} \+␊ |
187 | ␉␉␉buildpackage "${1}/${theme}" "/Extra/Themes" "" "start_selected=\"false\""␊ |
188 | ␉␉␉rm -R -f "${1}/${i##*/}"␊ |
189 | ␉␉done␊ |
190 | ␉((xmlindent--))␊ |
191 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"␊ |
192 | # End build theme packages␊ |
193 | ␊ |
194 | ␊ |
195 | ␊ |
196 | # build kext packages ␊ |
197 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Extras\">"␊ |
198 | ␉choices[$((choicescount++))]="<choice\n\tid=\"Extras\"\n\ttitle=\"Extras_title\"\n\tdescription=\"Extras_description\"\n>\n</choice>\n"␊ |
199 | ␉((xmlindent++))␊ |
200 | ␉␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Kexts\">"␊ |
201 | ␉␉choices[$((choicescount++))]="<choice\n\tid=\"Kexts\"\n\ttitle=\"Kexts_title\"\n\tdescription=\"Kexts_description\"\n>\n</choice>\n"␊ |
202 | ␉␉((xmlindent++))␊ |
203 | ␉␉␉packagesidentity="org.chameleon"␊ |
204 | ␉␉␉kexts=($( find "${pkgroot}/Kexts" -type d -name '*.kext' -depth 1 ))␊ |
205 | ␉␉␉for (( i = 0 ; i < ${#kexts[@]} ; i++ )) ␊ |
206 | ␉␉␉do␊ |
207 | ␉␉␉␉filename="${kexts[$i]##*/}"␊ |
208 | ␉␉␉␉mkdir -p "${1}/${filename%.kext}/Root/"␊ |
209 | ␉␉␉␉ditto --noextattr --noqtn --arch i386 "${kexts[$i]}" "${1}/${filename%.kext}/Root/${filename}"␊ |
210 | ␉␉␉␉find "${1}/${filename%.kext}" -name '.DS_Store' -or -name '.svn' -exec rm -R -f {} \; 2>/dev/null␊ |
211 | ␉␉␉␉fixperms "${1}/${filename%.kext}/Root/"␊ |
212 | ␉␉␉␉chown 501:20 "${1}/${filename%.kext}/Root/"␊ |
213 | ␉␉␉␉buildpackage "${1}/${filename%.kext}" "/Extra/Extensions" "" "start_selected=\"false\""␊ |
214 | ␉␉␉␉rm -R -f "${1}/${filename%.kext}"␊ |
215 | ␉␉␉done␊ |
216 | ␉␉((xmlindent--))␊ |
217 | ␉␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"␊ |
218 | ␉((xmlindent--))␊ |
219 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"␊ |
220 | # End build kext packages␊ |
221 | ␊ |
222 | # build post install package ␊ |
223 | ␉mkdir -p ${1}/Post/Root␊ |
224 | ␉mkdir -p ${1}/Post/Scripts␊ |
225 | ␉cp -f ${pkgroot}/Scripts/Post/* ${1}/Post/Scripts␊ |
226 | ␉buildpackage "${1}/Post" "/binaries" "" "start_visible=\"false\" start_selected=\"true\""␊ |
227 | # End post install package ␉␊ |
228 | ␊ |
229 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"␊ |
230 | # End main package␊ |
231 | ␊ |
232 | ␊ |
233 | # build meta package␊ |
234 | ␊ |
235 | ␉makedistribution "${1}" "${2}" "${3}" "${4}" "${5}"␊ |
236 | ␊ |
237 | # clean up ␊ |
238 | ␊ |
239 | ␉rm -R -f "${1}"␊ |
240 | ␊ |
241 | }␊ |
242 | ␊ |
243 | fixperms ()␊ |
244 | {␊ |
245 | ␉# $1 path␊ |
246 | ␉find "${1}" -type f -exec chmod 644 {} \;␊ |
247 | ␉find "${1}" -type d -exec chmod 755 {} \;␊ |
248 | ␉chown -R 0:0 "${1}"␊ |
249 | }␊ |
250 | ␊ |
251 | buildpackage ()␊ |
252 | {␊ |
253 | # $1 Path to package to build containing Root and or Scripts␊ |
254 | # $2 Install Location␊ |
255 | # $3 Size␊ |
256 | # $4 Options␊ |
257 | ␊ |
258 | if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then␊ |
259 | ␊ |
260 | ␉local packagename="${1##*/}"␊ |
261 | ␉local identifier=$( echo ${packagesidentity}.${packagename//_/.} | tr [:upper:] [:lower:] )␊ |
262 | ␉find "${1}" -name '.DS_Store' -delete␊ |
263 | ␉local filecount=$( find "${1}/Root" | wc -l )␊ |
264 | ␉if [ "${3}" ]; then␊ |
265 | ␉␉local installedsize="${3}"␊ |
266 | ␉else␊ |
267 | ␉␉local installedsize=$( du -hkc "${1}/Root" | tail -n1 | awk {'print $1'} )␊ |
268 | ␉fi␊ |
269 | ␉local header="<?xml version=\"1.0\"?>\n<pkg-info format-version=\"2\" "␊ |
270 | ␊ |
271 | ␉#[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "␉␉␊ |
272 | ␊ |
273 | ␉header+="identifier=\"${identifier}\" "␊ |
274 | ␉header+="version=\"${version}\" "␊ |
275 | ␊ |
276 | ␉[ "${2}" != "relocatable" ] && header+="install-location=\"${2}\" "␊ |
277 | ␊ |
278 | ␉header+="auth=\"root\">\n"␊ |
279 | ␉header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"␊ |
280 | ␉rm -R -f "${1}/Temp"␊ |
281 | ␊ |
282 | ␉[ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp"␊ |
283 | ␉[ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom"␊ |
284 | ␊ |
285 | ␉if [ -d "${1}/Scripts" ]; then ␊ |
286 | ␉␉header+="\t<scripts>\n"␊ |
287 | ␉␉for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) )␊ |
288 | ␉␉do␊ |
289 | ␉␉␉header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n"␊ |
290 | ␉␉done␊ |
291 | ␉␉header+="\t</scripts>\n"␊ |
292 | ␉␉chown -R 0:0 "${1}/Scripts"␊ |
293 | ␉␉pushd "${1}/Scripts" >/dev/null␊ |
294 | ␉␉find . -print | cpio -o -z -H cpio > "../Temp/Scripts"␊ |
295 | ␉␉popd >/dev/null␊ |
296 | ␉fi␊ |
297 | ␊ |
298 | ␉header+="</pkg-info>"␊ |
299 | ␉echo -e "${header}" > "${1}/Temp/PackageInfo"␊ |
300 | ␉pushd "${1}/Root" >/dev/null␊ |
301 | ␉find . -print | cpio -o -z -H cpio > "../Temp/Payload"␊ |
302 | ␉popd >/dev/null␊ |
303 | ␉pushd "${1}/Temp" >/dev/null␊ |
304 | ␊ |
305 | ␉xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none .␊ |
306 | ␊ |
307 | ␉popd >/dev/null␊ |
308 | ␊ |
309 | ␉outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"${packagename// /}\"/>"␊ |
310 | ␊ |
311 | ␉if [ "${4}" ]; then␊ |
312 | ␉␉local choiceoptions="${indent[$xmlindent]}${4}\n"␉␊ |
313 | ␉fi␊ |
314 | ␉choices[$((choicescount++))]="<choice\n\tid=\"${packagename// /}\"\n\ttitle=\"${packagename}_title\"\n\tdescription=\"${packagename}_description\"\n${choiceoptions}>\n\t<pkg-ref id=\"${identifier}\" installKBytes='${installedsize}' version='${version}.0.0.${timestamp}' auth='root'>#${packagename// /}.pkg</pkg-ref>\n</choice>\n"␊ |
315 | ␊ |
316 | ␉rm -R -f "${1}"␊ |
317 | fi␊ |
318 | }␊ |
319 | ␊ |
320 | makedistribution ()␊ |
321 | {␊ |
322 | ␉rm -f "${1%/*}/${packagename// /}"*.pkg␊ |
323 | ␊ |
324 | ␉find "${1}" -type f -name '*.pkg' -depth 1 | while read component␊ |
325 | ␉do␊ |
326 | ␉␉mkdir -p "${1}/${packagename}/${component##*/}"␊ |
327 | ␉␉pushd "${1}/${packagename}/${component##*/}" >/dev/null␊ |
328 | ␉␉xar -x -f "${1%}/${component##*/}"␊ |
329 | ␉␉popd >/dev/null␊ |
330 | ␉done␊ |
331 | ␊ |
332 | ␉ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution"␊ |
333 | ␉ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources"␊ |
334 | ␊ |
335 | ␉find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null␊ |
336 | ␊ |
337 | ␉for (( i=0; i < ${#outline[*]} ; i++));␊ |
338 | ␉␉do␊ |
339 | ␉␉␉echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution"␊ |
340 | ␉␉done␊ |
341 | ␊ |
342 | ␉for (( i=0; i < ${#choices[*]} ; i++));␊ |
343 | ␉␉do␊ |
344 | ␉␉␉echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution"␊ |
345 | ␉␉done␊ |
346 | ␊ |
347 | ␉echo "</installer-gui-script>" >> "${1}/${packagename}/Distribution"␊ |
348 | ␊ |
349 | ␉perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" `find "${1}/${packagename}/Resources" -type f`␊ |
350 | ␉perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" `find "${1}/${packagename}/Resources" -type f`␊ |
351 | ␊ |
352 | ␉stage=${stage/RC/Release Candidate }␊ |
353 | ␉stage=${stage/FINAL/2.0 Final}␊ |
354 | ␉perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" `find "${1}/${packagename}/Resources" -type f`␊ |
355 | ␊ |
356 | ␉find "${1}/${packagename}" -name '.DS_Store' -delete␊ |
357 | ␉pushd "${1}/${packagename}" >/dev/null␊ |
358 | ␉xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none .␊ |
359 | ␉popd >/dev/null␊ |
360 | ␊ |
361 | ␉md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} )␊ |
362 | ␉echo "MD5 (${packagename// /}-${version}-r${revision}.pkg) = ${md5}" > "${1%/*}/${packagename// /}-${version}-r${revision}.pkg.md5"␊ |
363 | cp -R -f "${1}/${packagename}/Resources" ${1%/*}/Resources␊ |
364 | }␊ |
365 | ␊ |
366 | main "${1}" "${2}" "${3}" "${4}" "${5}"␊ |
367 | ␊ |
368 |