merge2out 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. #!/bin/sh
  2. #BK nov. 2011
  3. #111126 do not copy files from woof-distro to woof-out, symlink only.
  4. #111126 fix symlink to compat-distro pkg download directory.
  5. #111127 make sure host linux system has 'printcols' and 'vercmp' utilities.
  6. #111127 also make sure target build will have 'printcols' and 'vercmp'.
  7. #111203 fixes for rerun of this script.
  8. #120503 i left some EMPTYDIRMARKER files inside /dev.
  9. #120512 remove option to create symlinks in working directory.
  10. #120515 build from "gentoo" binary tarballs (refer support/gentoo).
  11. #130306 arch linux: gz now xz.
  12. #130528 change owner:group of symlink instead of what it points to.
  13. [ ! -d ./woof-arch ] && exit
  14. [ ! -d ./woof-code ] && exit
  15. [ ! -d ./woof-distro ] && exit
  16. CURDIR="`pwd`"
  17. echo
  18. echo 'This script merges woof-arch, woof-code and woof-distro, to ../woof-out_*.
  19. woof-arch: architecture-dependent (x86, arm) files, mostly binary executables.
  20. woof-code: the core of Woof. Mostly scripts.
  21. woof-distro: distro-configuration (Debian, Slackware, etc.) files.
  22. kernel-kit: puppy-kernel build script and configuration files
  23. Important: the host architecture is distinct from the target architecture.
  24. The host is the machine you are running Woof on, the target is the machine
  25. in which the Puppy that you build is going to run. Typically, you will build
  26. on a x86 machine, and the target may be x86 or arm.'
  27. echo
  28. CNT=1
  29. for ONEARCH in `find woof-arch -mindepth 1 -maxdepth 1 -type d | sed -e 's%^woof-arch/%%' | sort | tr '\n' ' '`
  30. do
  31. echo "$CNT $ONEARCH"
  32. CNT=$(($CNT + 1))
  33. done
  34. echo -n 'Type number of host architecture: '
  35. read nHOSTARCH
  36. HOSTARCH="`find woof-arch -mindepth 1 -maxdepth 1 -type d | sed -e 's%^woof-arch/%%' | sort | head -n $nHOSTARCH | tail -n 1`"
  37. echo "...ok, $HOSTARCH"
  38. echo
  39. CNT=1
  40. for ONEARCH in `find woof-arch -mindepth 1 -maxdepth 1 -type d | sed -e 's%^woof-arch/%%' | sort | tr '\n' ' '`
  41. do
  42. echo "$CNT $ONEARCH"
  43. CNT=$(($CNT + 1))
  44. done
  45. echo -n 'Type number of target architecture: '
  46. read nTARGETARCH
  47. TARGETARCH="`find woof-arch -mindepth 1 -maxdepth 1 -type d | sed -e 's%^woof-arch/%%' | sort | head -n $nTARGETARCH | tail -n 1`"
  48. echo "...ok, $TARGETARCH"
  49. echo
  50. echo 'Woof builds a Puppy based on the binary packages from another distro.
  51. We sometimes refer to this as the "compat-distro".'
  52. echo
  53. CNT=1
  54. taPTN="s%^woof-distro/${TARGETARCH}/%%"
  55. for ONEDISTRO in `find woof-distro/${TARGETARCH} -mindepth 1 -maxdepth 1 -type d | sed -e "${taPTN}" | sort | tr '\n' ' '`
  56. do
  57. echo "$CNT $ONEDISTRO"
  58. CNT=$(($CNT + 1))
  59. done
  60. echo -n 'Type number of compat-distro: '
  61. read nCOMPATDISTRO
  62. COMPATDISTRO="`find woof-distro/${TARGETARCH} -mindepth 1 -maxdepth 1 -type d | sed -e "${taPTN}" | sort | head -n $nCOMPATDISTRO | tail -n 1`"
  63. echo "...ok, $COMPATDISTRO"
  64. echo
  65. echo 'The compat-distro usually has release versions, unless it is a rolling
  66. release system such as Arch Linux. Please choose which release you want to
  67. obtain the binary packages from.'
  68. CNT=1
  69. for ONECOMPAT in `find woof-distro/${TARGETARCH}/${COMPATDISTRO} -maxdepth 1 -mindepth 1 -type d | rev | cut -f 1 -d '/' | rev | sort | tr '\n' ' '`
  70. do
  71. echo "$CNT $ONECOMPAT"
  72. CNT=$(($CNT + 1))
  73. done
  74. if [ $CNT -eq 1 ];then
  75. echo
  76. echo "Sorry, there are no release directories inside woof-distro/${COMPATDISTRO}."
  77. echo "At least one is required. Quiting."
  78. exit
  79. fi
  80. echo -n 'Type number of release: '
  81. read nCOMPATVERSION
  82. COMPATVERSION="`find woof-distro/${TARGETARCH}/${COMPATDISTRO} -maxdepth 1 -mindepth 1 -type d | rev | cut -f 1 -d '/' | rev | sort | head -n $nCOMPATVERSION | tail -n 1`"
  83. echo "...ok, $COMPATVERSION"
  84. echo
  85. echo 'Choices:'
  86. echo "Host architecture: $HOSTARCH"
  87. echo "Target architecture: $TARGETARCH"
  88. echo "Compatible-distro: $COMPATDISTRO"
  89. echo "Compat-distro version: $COMPATVERSION"
  90. echo
  91. echo -n "If these are ok, press ENTER, other CTRL-C to quit: "
  92. read waitforit
  93. echo
  94. echo "Directory '../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}'
  95. will now be created, if not already, and the contents of 'woof-code' copied
  96. into it. Then, these will also be copied into it:
  97. woof-arch/${HOSTARCH}/build
  98. woof-arch/${TARGETARCH}/target
  99. woof-distro/${TARGETARCH}/${COMPATDISTRO}/${COMPATVERSION} (files all levels)"
  100. echo
  101. echo "Any existing files in '../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}' will be over-ridden."
  102. echo "(Also, if you have any of your own files in folders 'boot', 'kernel-skeleton',
  103. 'packages-templates', 'rootfs-skeleton', 'support' or 'kernel-kit',
  104. they will be deleted.)"
  105. echo -n 'Press ENTER to continue: '
  106. read goforit
  107. #111203 as files/dirs could be removed in future woofs, need to wipe entire target dirs first...
  108. rm -r -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/boot 2> /dev/null
  109. rm -r -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/kernel-skeleton 2> /dev/null
  110. rm -r -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/packages-templates 2> /dev/null
  111. rm -r -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/rootfs-skeleton 2> /dev/null
  112. rm -r -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/support 2> /dev/null
  113. rm -r -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/kernel-kit 2> /dev/null
  114. sync
  115. mkdir -p ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}
  116. echo "Copying woof-code/*..."
  117. cp -a -f --remove-destination woof-code/* ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  118. sync
  119. echo "Copying woof-arch/${HOSTARCH}/build/*..."
  120. cp -a -f --remove-destination woof-arch/${HOSTARCH}/build/* ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  121. sync
  122. echo "Copying woof-arch/${TARGETARCH}/target/*"
  123. cp -a -f --remove-destination woof-arch/${TARGETARCH}/target/* ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  124. sync
  125. if [ "${COMPATDISTRO}" = "slackware64" -a "${TARGETARCH}" = "x86_64" ];then
  126. # fix up the templates for 64 bit build
  127. TEMPLATES="../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/packages-templates"
  128. LIST=`ls ${TEMPLATES}|grep -v pcmciautils`
  129. echo -n "fixing package templates for 64 bit: "
  130. sleep 2
  131. for i in $LIST
  132. do echo -n "$i "
  133. if [ -d ${TEMPLATES}/${i}/lib ];then
  134. mv ${TEMPLATES}/${i}/lib ${TEMPLATES}/${i}/lib64
  135. echo -n '' > ${TEMPLATES}/${i}/PLUSEXTRADIRS
  136. fi
  137. [ -d ${TEMPLATES}/${i}/usr/lib ] \
  138. && mv ${TEMPLATES}/${i}/usr/lib ${TEMPLATES}/${i}/usr/lib64
  139. done
  140. #fix FIXUPHACK scripts
  141. find ${TEMPLATES} -type f -name FIXUPHACK -exec sed -i -e 's%lib\/%lib64/%g' -e 's%lib %lib64 %g' '{}' \;
  142. echo -e "\n\nlib64 directories created in packages-templates."
  143. fi
  144. echo
  145. echo "Copying kernel-kit..."
  146. cp -a -f --remove-destination kernel-kit ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  147. sync
  148. echo
  149. echo "Copying woof-distro/${COMPATDISTRO}/${COMPATVERSION}/*..."
  150. #copy any top-level files, going down...
  151. #120512 remove this option...
  152. ##111203 script run before, respect previous decision...
  153. #DESTTYPE=''
  154. #ONETOP="`find woof-distro -mindepth 1 -maxdepth 1 -type f | head -n 1`"
  155. #[ ! "$ONETOP" ] && ONETOP="`find woof-distro/${TARGETARCH} -mindepth 1 -maxdepth 1 -type f | head -n 1`"
  156. #[ ! "$ONETOP" ] && ONETOP="`find woof-distro/${TARGETARCH}/${COMPATDISTRO} -mindepth 1 -maxdepth 1 -type f | head -n 1`"
  157. #[ ! "$ONETOP" ] && ONETOP="`find woof-distro/${TARGETARCH}/${COMPATDISTRO}/${COMPATVERSION} -mindepth 1 -maxdepth 1 -type f | head -n 1`"
  158. #if [ "$ONETOP" ];then
  159. # ONEBASE="`basename $ONETOP`"
  160. # if [ -e ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONEBASE} ];then
  161. # DESTTYPE='file'
  162. # [ -h ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONEBASE} ] && DESTTYPE='symlink'
  163. # fi
  164. #fi
  165. #if [ "$DESTTYPE" = "" ];then
  166. # #111126 don't copy, more convenient if symlink, so only one instance of the file... 111129 offer choice...
  167. # echo
  168. # echo "Press ENTER only to copy files from woof-distro, any other char to symlink
  169. #files back to woof-distro. Latter is a convenience for administrator, for most
  170. #Woof users, please choose former."
  171. # echo -n "Recommend press ENTER only: "
  172. # read choosesymlink
  173. #else
  174. # choosesymlink=''
  175. # [ "$DESTTYPE" = "symlink" ] && choosesymlink='y'
  176. #fi
  177. DESTTYPE='file'
  178. choosesymlink=''
  179. PARENTDIR="`echo -n "$CURDIR" | rev | cut -f 1 -d '/' | rev`" #ex: woof2
  180. for ONETOP in `find woof-distro -mindepth 1 -maxdepth 1 -type f | tr '\n' ' '`
  181. do
  182. if [ "$choosesymlink" = "" ];then
  183. cp -a -f --remove-destination $ONETOP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  184. else
  185. ONENAME="`basename $ONETOP`"
  186. ln -snf ../${PARENTDIR}/${ONETOP} ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONENAME}
  187. fi
  188. done
  189. for ONETOP in `find woof-distro/${TARGETARCH} -mindepth 1 -maxdepth 1 -type f | tr '\n' ' '`
  190. do
  191. if [ "$choosesymlink" = "" ];then
  192. cp -f -a --remove-destination $ONETOP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  193. else
  194. ONENAME="`basename $ONETOP`"
  195. ln -snf ../${PARENTDIR}/${ONETOP} ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONENAME}
  196. fi
  197. done
  198. for ONETOP in `find woof-distro/${TARGETARCH}/${COMPATDISTRO} -mindepth 1 -maxdepth 1 -type f | tr '\n' ' '`
  199. do
  200. if [ "$choosesymlink" = "" ];then
  201. cp -f -a --remove-destination $ONETOP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  202. else
  203. ONENAME="`basename $ONETOP`"
  204. ln -snf ../${PARENTDIR}/${ONETOP} ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONENAME}
  205. fi
  206. done
  207. #lowest level...
  208. #cp -a -f --remove-destination woof-distro/${TARGETARCH}/${COMPATDISTRO}/${COMPATVERSION}/* ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  209. for ONETOP in `find woof-distro/${TARGETARCH}/${COMPATDISTRO}/${COMPATVERSION} -mindepth 1 -maxdepth 1 -type f | tr '\n' ' '`
  210. do
  211. if [ "$choosesymlink" = "" ];then
  212. cp -f -a --remove-destination $ONETOP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  213. else
  214. ONENAME="`basename $ONETOP`"
  215. ln -snf ../${PARENTDIR}/${ONETOP} ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONENAME}
  216. fi
  217. done
  218. sync
  219. echo "WOOF_HOSTARCH='$HOSTARCH'
  220. WOOF_TARGETARCH='${TARGETARCH}'
  221. WOOF_COMPATDISTRO='${COMPATDISTRO}'
  222. WOOF_COMPATVERSION='${COMPATVERSION}'" > ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/WOOFMERGEVARS
  223. echo
  224. echo "Now for some housekeeping..."
  225. if [ -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/boot/initrd-tree0/bin/bb-create-symlinks ];then
  226. echo
  227. echo "Symlinks being created inside here:"
  228. echo "../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/boot/initrd-tree0/bin"
  229. cd ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/boot/initrd-tree0/bin
  230. for ONESYMLINK in `find . -type l | cut -f 2 -d '/' | tr '\n' ' '`
  231. do
  232. rm -f ${ONESYMLINK}
  233. done
  234. ./bb-create-symlinks
  235. cd $CURDIR #cd ../../../../
  236. fi
  237. #work around limitations of a version control system...
  238. echo
  239. echo "Some things are modified inside 'woof-code' to cater for most Version
  240. Control Systems. Typically, a VCS cannot handle most of these:
  241. 1. Empty directories
  242. 2. Special file/directory permissions/ownership
  243. 3. Device nodes
  244. 4. Symlinks
  245. 5. Special characters (such as [, [[) in file/dir names
  246. 6. Binary files
  247. BK's Bones VCS can handle all six. Fossil VCS can do no.4 & no.6 only (in fact,
  248. most VCSs such as SVN, GIT and Mercurial, can handle no.4 & no.6). Woof has
  249. lots of symlinks and binary files, and you must use a VCS that supports them.
  250. No.5 is solved by avoiding usage of such special characters, except we have
  251. workarounds for case of files named '[' and '[['."
  252. echo
  253. echo "Directory 'woof-code' has workarounds for no.1-3 (& partial 5):
  254. 1. An empty file named 'EMPTYDIRMARKER' inside all empty directories.
  255. 2. A file named VCSMETADATA has permissions/ownerships of special files/dirs.
  256. 3. 'dev' directories are converted to '*DEVDIR.tar.gz' tarball files.
  257. 5. Files named '[' and '[[' renamed 'LEFTSQBRACKETCHAR' 'DBLLEFTSQBRACKETCHAR'."
  258. echo
  259. echo "These workarounds will now be undone in '../woof-out_*'..."
  260. echo -n "Press ENTER to continue: "
  261. read goforit
  262. fossil_fixup_func() { #workarounds for VCS...
  263. #param passed in is directory to fix.
  264. #5: '[' and '[[' files renamed...
  265. for FOSSILFIXFILE in `find ${1} -name LEFTSQBRACKETCHAR | tr '\n' ' '`
  266. do
  267. DIRFFF="`dirname "$FOSSILFIXFILE"`"
  268. mv -f $FOSSILFIXFILE $DIRFFF/[
  269. done
  270. for FOSSILFIXFILE in `find ${1} -name DBLLEFTSQBRACKETCHAR | tr '\n' ' '`
  271. do
  272. DIRFFF="`dirname "$FOSSILFIXFILE"`"
  273. mv -f $FOSSILFIXFILE $DIRFFF/[[
  274. done
  275. #1: empty dirs have file 'EMPTYDIRMARKER' in them...
  276. for FOSSILFIXFILE in `find ${1} -type f -name EMPTYDIRMARKER | tr '\n' ' '`
  277. do
  278. DIRFFF="`dirname "$FOSSILFIXFILE"`"
  279. rm -f $DIRFFF/EMPTYDIRMARKER
  280. done
  281. #3: 'dev' dir made into a tarball and stored in 'woof-arch'...
  282. for DEVFILE in `find ${1} -type f -name DEVDIRMARKER | tr '\n' ' '`
  283. do
  284. xDEVFILE="${CURDIR}/woof-arch/`cat $DEVFILE`"
  285. DIRFFF="`dirname "$DEVFILE"`"
  286. cp -f $xDEVFILE ${DIRFFF}/DEVDIR.tar.gz
  287. FCURRDIR="`pwd`"
  288. cd $DIRFFF
  289. tar -zxf DEVDIR.tar.gz
  290. rm -f DEVDIR.tar.gz
  291. rm -f DEVDIRMARKER
  292. #120503 i left some EMPTYDIRMARKER inside /dev...
  293. for FOSSILFIXFILE in `find dev -type f -name EMPTYDIRMARKER | tr '\n' ' '`
  294. do
  295. DIRFFF="`dirname "$FOSSILFIXFILE"`"
  296. rm -f $DIRFFF/EMPTYDIRMARKER
  297. done
  298. cd $FCURRDIR
  299. done
  300. }
  301. echo
  302. cd ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}
  303. echo "Fixing ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/rootfs-skeleton..."
  304. fossil_fixup_func rootfs-skeleton
  305. echo "Fixing ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/boot/initrd-tree0..."
  306. fossil_fixup_func boot/initrd-tree0
  307. echo "Fixing ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/packages-templates..."
  308. fossil_fixup_func packages-templates
  309. fossil_fixup_func huge_kernel
  310. #2: VCSMETADATA permissions/ownership...
  311. if [ -s VCSMETADATA ];then
  312. echo "Fixing file/dir permissions/ownership..."
  313. for ONESPEC in `cat VCSMETADATA | tr '\n' ' '`
  314. do
  315. ONEFILE="`echo -n "$ONESPEC" | cut -f 1 -d ':'`"
  316. [ ! -e $ONEFILE ] && continue
  317. ONEPERM="`echo -n "$ONESPEC" | cut -f 2 -d ':'`"
  318. ONEOWNER="`echo -n "$ONESPEC" | cut -f 3 -d ':'`"
  319. ONEGROUP="`echo -n "$ONESPEC" | cut -f 4 -d ':'`"
  320. echo -n '.' #echo " $ONEFILE $ONEPERM $ONEOWNER $ONEGROUP"
  321. chmod $ONEPERM $ONEFILE
  322. #130528 change owner:group of symlink instead of what it points to...
  323. [ "$ONEOWNER" != "UNKNOWN" ] && chown -h $ONEOWNER $ONEFILE
  324. [ "$ONEOWNER" = "UNKNOWN" ] && chown -h root $ONEFILE
  325. [ "$ONEGROUP" != "UNKNOWN" ] && chgrp -h $ONEGROUP $ONEFILE
  326. [ "$ONEGROUP" = "UNKNOWN" ] && chgrp -h root $ONEFILE
  327. done
  328. echo
  329. fi
  330. cd $CURDIR
  331. sync
  332. #output dir for iso and img files
  333. #mkdir -p ../woof-output
  334. #common dir to download pet pkgs to...
  335. mkdir -p ../local-repositories/${TARGETARCH}/packages-pet
  336. [ ! -e ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/packages-pet ] && ln -s ../local-repositories/${TARGETARCH}/packages-pet ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/packages-pet #111203 check exist.
  337. #more links to common download...
  338. if [ -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS ];then
  339. . ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS
  340. #111126 code from 2createpackages...
  341. BINARIES='deb' #get them from packages-deb.
  342. [ "$DISTRO_BINARY_COMPAT" = "t2" ] && BINARIES="bz2" #get them from packages-bz2-${DISTRO_COMPAT_VERSION}.
  343. [ "$DISTRO_BINARY_COMPAT" = "slackware" ] && BINARIES="tgz_txz" #download to packages-tgz_txz-${DISTRO_COMPAT_VERSION}.
  344. [ "$DISTRO_BINARY_COMPAT" = "slackware64" ] && BINARIES="tgz_txz" #download to packages-tgz_txz-${DISTRO_COMPAT_VERSION}. #140619 add 64
  345. [ "$DISTRO_BINARY_COMPAT" = "debian" ] && BINARIES="deb" #download to packages-deb-${DISTRO_COMPAT_VERSION}.
  346. [ "$DISTRO_BINARY_COMPAT" = "arch" ] && BINARIES="tar_xz" #download to packages-tar_xz-${DISTRO_COMPAT_VERSION}. 130306
  347. [ "$DISTRO_BINARY_COMPAT" = "puppy" ] && BINARIES="pet" #built entirely from pet pkgs.
  348. [ "$DISTRO_BINARY_COMPAT" = "scientific" ] && BINARIES="rpm" #Iguleder: download to packages-rpm-${DISTRO_COMPAT_VERSION}.
  349. [ "$DISTRO_BINARY_COMPAT" = "mageia" ] && BINARIES="rpm"
  350. [ "$DISTRO_BINARY_COMPAT" = "gentoo" ] && BINARIES="gentoo" #120515 download to packages-gentoo-gap6
  351. [ "$DISTRO_BINARY_COMPAT" = "raspbian" ] && BINARIES="deb_raspbian" #download to packages-deb_raspbian-${DISTRO_COMPAT_VERSION}.
  352. BINARIES="${BINARIES}-${DISTRO_COMPAT_VERSION}"
  353. mkdir -p ../local-repositories/${TARGETARCH}/packages-${BINARIES}
  354. [ ! -e ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/packages-${BINARIES} ] && ln -s ../local-repositories/${TARGETARCH}/packages-${BINARIES} ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/packages-${BINARIES} #111203 check exist.
  355. if [ "$DISTRO_TARGETARCH" = "arm" ]; then
  356. mkdir -p ../local-repositories/${TARGETARCH}/sd-skeleton-images
  357. [ ! -e ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/sd-skeleton-images ] && ln -s ../local-repositories/${TARGETARCH}/sd-skeleton-images ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/sd-skeleton-images
  358. fi
  359. fi
  360. #record target architecture in DISTRO_SPECS (will end up in /etc/ in Puppy build)...
  361. if [ -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS ];then
  362. if [ "`grep '^DISTRO_TARGETARCH' ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS`" = "" ];then
  363. echo "DISTRO_TARGETARCH='${TARGETARCH}'" >> ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS
  364. fi
  365. fi
  366. #record the woof state we build from
  367. if [ "`git log -n 1`" != "" ]; then
  368. GITBRANCH=$(git rev-parse --abbrev-ref HEAD)
  369. GITHEAD=$(git log -n 1 --pretty=format:"%h;%ci") # git rev-parse HEAD
  370. if [ -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS ];then
  371. if [ "`grep '^BUILD_FROM_WOOF' ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS`" = "" ];then
  372. echo "BUILD_FROM_WOOF='${GITBRANCH};${GITHEAD}'" >> ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS
  373. fi
  374. fi
  375. fi
  376. #until i upgrade the woof scripts... (i was planning to rename Packages-puppy-* to Packages-pet-*, aborted)
  377. for ONEPP in `find ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION} -mindepth 1 -maxdepth 1 -name 'Packages-pet-*' | tr '\n' ' '`
  378. do
  379. BASEPP="`basename $ONEPP`"
  380. NEWBASE="`echo -n $BASEPP | sed -e 's%Packages-pet-%Packages-puppy-%'`"
  381. ln -s $BASEPP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${NEWBASE}
  382. done
  383. #111127 make sure host puppy has these...
  384. [ ! -f /usr/sbin/printcols ] && cp -af woof-arch/${HOSTARCH}/build/support/printcols /usr/sbin/ #column manipulator.
  385. [ ! -f /bin/vercmp ] && cp -af woof-arch/${HOSTARCH}/target/boot/initrd-tree0/bin/vercmp /bin/ #dotted-version compare utility, see boot/vercmp.c
  386. #111127 make sure target has these...
  387. cp -af woof-arch/${TARGETARCH}/build/support/printcols ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${NEWBASE}/rootfs-skeleton/usr/sbin/
  388. cp -af woof-arch/${TARGETARCH}/target/boot/initrd-tree0/bin/vercmp ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${NEWBASE}/rootfs-skeleton/bin/
  389. echo
  390. echo "Directory '../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}'
  391. is now normal, that is, the workarounds have been removed. Note,
  392. ../local-repositories has been created (if not already), to be used as a common
  393. binary package download place. 'packages-pet' and 'packages-${BINARIES}'
  394. have been created that link into it, where pkgs will be downloaded to."
  395. ###END###