merge2out 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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', 'rootfs-packages', '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}/rootfs-packages 2> /dev/null
  113. rm -r -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/support 2> /dev/null
  114. rm -r -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/kernel-kit 2> /dev/null
  115. sync
  116. mkdir -p ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}
  117. echo "Copying woof-code/*..."
  118. cp -a -f --remove-destination woof-code/* ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  119. sync
  120. echo "Copying woof-arch/${HOSTARCH}/build/*..."
  121. cp -a -f --remove-destination woof-arch/${HOSTARCH}/build/* ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  122. sync
  123. echo "Copying woof-arch/${TARGETARCH}/target/*"
  124. cp -a -f --remove-destination woof-arch/${TARGETARCH}/target/* ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  125. sync
  126. if [ "${COMPATDISTRO}" = "slackware64" -a "${TARGETARCH}" = "x86_64" ];then
  127. # fix up the templates for 64 bit build
  128. TEMPLATES="../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/packages-templates"
  129. LIST=`ls ${TEMPLATES}|grep -v pcmciautils`
  130. echo -n "fixing package templates for 64 bit: "
  131. sleep 2
  132. for i in $LIST
  133. do echo -n "$i "
  134. if [ -d ${TEMPLATES}/${i}/lib ];then
  135. mv ${TEMPLATES}/${i}/lib ${TEMPLATES}/${i}/lib64
  136. echo -n '' > ${TEMPLATES}/${i}/PLUSEXTRADIRS
  137. fi
  138. [ -d ${TEMPLATES}/${i}/usr/lib ] \
  139. && mv ${TEMPLATES}/${i}/usr/lib ${TEMPLATES}/${i}/usr/lib64
  140. done
  141. #fix FIXUPHACK scripts
  142. find ${TEMPLATES} -type f -name FIXUPHACK -exec sed -i -e 's%lib\/%lib64/%g' -e 's%lib %lib64 %g' '{}' \;
  143. echo -e "\n\nlib64 directories created in packages-templates."
  144. fi
  145. echo
  146. echo "Copying kernel-kit..."
  147. cp -a -f --remove-destination kernel-kit ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  148. sync
  149. echo
  150. echo "Copying woof-distro/${COMPATDISTRO}/${COMPATVERSION}/*..."
  151. #copy any top-level files, going down...
  152. #120512 remove this option...
  153. ##111203 script run before, respect previous decision...
  154. #DESTTYPE=''
  155. #ONETOP="`find woof-distro -mindepth 1 -maxdepth 1 -type f | head -n 1`"
  156. #[ ! "$ONETOP" ] && ONETOP="`find woof-distro/${TARGETARCH} -mindepth 1 -maxdepth 1 -type f | head -n 1`"
  157. #[ ! "$ONETOP" ] && ONETOP="`find woof-distro/${TARGETARCH}/${COMPATDISTRO} -mindepth 1 -maxdepth 1 -type f | head -n 1`"
  158. #[ ! "$ONETOP" ] && ONETOP="`find woof-distro/${TARGETARCH}/${COMPATDISTRO}/${COMPATVERSION} -mindepth 1 -maxdepth 1 -type f | head -n 1`"
  159. #if [ "$ONETOP" ];then
  160. # ONEBASE="`basename $ONETOP`"
  161. # if [ -e ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONEBASE} ];then
  162. # DESTTYPE='file'
  163. # [ -h ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONEBASE} ] && DESTTYPE='symlink'
  164. # fi
  165. #fi
  166. #if [ "$DESTTYPE" = "" ];then
  167. # #111126 don't copy, more convenient if symlink, so only one instance of the file... 111129 offer choice...
  168. # echo
  169. # echo "Press ENTER only to copy files from woof-distro, any other char to symlink
  170. #files back to woof-distro. Latter is a convenience for administrator, for most
  171. #Woof users, please choose former."
  172. # echo -n "Recommend press ENTER only: "
  173. # read choosesymlink
  174. #else
  175. # choosesymlink=''
  176. # [ "$DESTTYPE" = "symlink" ] && choosesymlink='y'
  177. #fi
  178. DESTTYPE='file'
  179. choosesymlink=''
  180. PARENTDIR="`echo -n "$CURDIR" | rev | cut -f 1 -d '/' | rev`" #ex: woof2
  181. for ONETOP in `find woof-distro -mindepth 1 -maxdepth 1 -type f | tr '\n' ' '`
  182. do
  183. if [ "$choosesymlink" = "" ];then
  184. cp -a -f --remove-destination $ONETOP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  185. else
  186. ONENAME="`basename $ONETOP`"
  187. ln -snf ../${PARENTDIR}/${ONETOP} ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONENAME}
  188. fi
  189. done
  190. for ONETOP in `find woof-distro/${TARGETARCH} -mindepth 1 -maxdepth 1 -type f | tr '\n' ' '`
  191. do
  192. if [ "$choosesymlink" = "" ];then
  193. cp -f -a --remove-destination $ONETOP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  194. else
  195. ONENAME="`basename $ONETOP`"
  196. ln -snf ../${PARENTDIR}/${ONETOP} ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONENAME}
  197. fi
  198. done
  199. for ONETOP in `find woof-distro/${TARGETARCH}/${COMPATDISTRO} -mindepth 1 -maxdepth 1 -type f | tr '\n' ' '`
  200. do
  201. if [ "$choosesymlink" = "" ];then
  202. cp -f -a --remove-destination $ONETOP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  203. else
  204. ONENAME="`basename $ONETOP`"
  205. ln -snf ../${PARENTDIR}/${ONETOP} ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONENAME}
  206. fi
  207. done
  208. #lowest level...
  209. #cp -a -f --remove-destination woof-distro/${TARGETARCH}/${COMPATDISTRO}/${COMPATVERSION}/* ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  210. for ONETOP in `find woof-distro/${TARGETARCH}/${COMPATDISTRO}/${COMPATVERSION} -mindepth 1 -maxdepth 1 -type f | tr '\n' ' '`
  211. do
  212. if [ "$choosesymlink" = "" ];then
  213. cp -f -a --remove-destination $ONETOP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/
  214. else
  215. ONENAME="`basename $ONETOP`"
  216. ln -snf ../${PARENTDIR}/${ONETOP} ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${ONENAME}
  217. fi
  218. done
  219. sync
  220. echo "WOOF_HOSTARCH='$HOSTARCH'
  221. WOOF_TARGETARCH='${TARGETARCH}'
  222. WOOF_COMPATDISTRO='${COMPATDISTRO}'
  223. WOOF_COMPATVERSION='${COMPATVERSION}'" > ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/WOOFMERGEVARS
  224. echo
  225. echo "Now for some housekeeping..."
  226. if [ -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/boot/initrd-tree0/bin/bb-create-symlinks ];then
  227. echo
  228. echo "Symlinks being created inside here:"
  229. echo "../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/boot/initrd-tree0/bin"
  230. cd ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/boot/initrd-tree0/bin
  231. for ONESYMLINK in `find . -type l | cut -f 2 -d '/' | tr '\n' ' '`
  232. do
  233. rm -f ${ONESYMLINK}
  234. done
  235. ./bb-create-symlinks
  236. cd $CURDIR #cd ../../../../
  237. fi
  238. #work around limitations of a version control system...
  239. echo
  240. echo "Some things are modified inside 'woof-code' to cater for most Version
  241. Control Systems. Typically, a VCS cannot handle most of these:
  242. 1. Empty directories
  243. 2. Special file/directory permissions/ownership
  244. 3. Device nodes
  245. 4. Symlinks
  246. 5. Special characters (such as [, [[) in file/dir names
  247. 6. Binary files
  248. BK's Bones VCS can handle all six. Fossil VCS can do no.4 & no.6 only (in fact,
  249. most VCSs such as SVN, GIT and Mercurial, can handle no.4 & no.6). Woof has
  250. lots of symlinks and binary files, and you must use a VCS that supports them.
  251. No.5 is solved by avoiding usage of such special characters, except we have
  252. workarounds for case of files named '[' and '[['."
  253. echo
  254. echo "Directory 'woof-code' has workarounds for no.1-3 (& partial 5):
  255. 1. An empty file named 'EMPTYDIRMARKER' inside all empty directories.
  256. 2. A file named VCSMETADATA has permissions/ownerships of special files/dirs.
  257. 3. 'dev' directories are converted to '*DEVDIR.tar.gz' tarball files.
  258. 5. Files named '[' and '[[' renamed 'LEFTSQBRACKETCHAR' 'DBLLEFTSQBRACKETCHAR'."
  259. echo
  260. echo "These workarounds will now be undone in '../woof-out_*'..."
  261. echo -n "Press ENTER to continue: "
  262. read goforit
  263. fossil_fixup_func() { #workarounds for VCS...
  264. #param passed in is directory to fix.
  265. #5: '[' and '[[' files renamed...
  266. for FOSSILFIXFILE in `find ${1} -name LEFTSQBRACKETCHAR | tr '\n' ' '`
  267. do
  268. DIRFFF="`dirname "$FOSSILFIXFILE"`"
  269. mv -f $FOSSILFIXFILE $DIRFFF/[
  270. done
  271. for FOSSILFIXFILE in `find ${1} -name DBLLEFTSQBRACKETCHAR | tr '\n' ' '`
  272. do
  273. DIRFFF="`dirname "$FOSSILFIXFILE"`"
  274. mv -f $FOSSILFIXFILE $DIRFFF/[[
  275. done
  276. #1: empty dirs have file 'EMPTYDIRMARKER' in them...
  277. for FOSSILFIXFILE in `find ${1} -type f -name EMPTYDIRMARKER | tr '\n' ' '`
  278. do
  279. DIRFFF="`dirname "$FOSSILFIXFILE"`"
  280. rm -f $DIRFFF/EMPTYDIRMARKER
  281. done
  282. #3: 'dev' dir made into a tarball and stored in 'woof-arch'...
  283. for DEVFILE in `find ${1} -type f -name DEVDIRMARKER | tr '\n' ' '`
  284. do
  285. xDEVFILE="${CURDIR}/woof-arch/`cat $DEVFILE`"
  286. DIRFFF="`dirname "$DEVFILE"`"
  287. cp -f $xDEVFILE ${DIRFFF}/DEVDIR.tar.gz
  288. FCURRDIR="`pwd`"
  289. cd $DIRFFF
  290. tar -zxf DEVDIR.tar.gz
  291. rm -f DEVDIR.tar.gz
  292. rm -f DEVDIRMARKER
  293. #120503 i left some EMPTYDIRMARKER inside /dev...
  294. for FOSSILFIXFILE in `find dev -type f -name EMPTYDIRMARKER | tr '\n' ' '`
  295. do
  296. DIRFFF="`dirname "$FOSSILFIXFILE"`"
  297. rm -f $DIRFFF/EMPTYDIRMARKER
  298. done
  299. cd $FCURRDIR
  300. done
  301. }
  302. echo
  303. cd ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}
  304. echo "Fixing ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/rootfs-skeleton..."
  305. fossil_fixup_func rootfs-skeleton
  306. echo "Fixing ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/boot/initrd-tree0..."
  307. fossil_fixup_func boot/initrd-tree0
  308. echo "Fixing ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/packages-templates..."
  309. fossil_fixup_func packages-templates
  310. fossil_fixup_func huge_kernel
  311. #2: VCSMETADATA permissions/ownership...
  312. if [ -s VCSMETADATA ];then
  313. echo "Fixing file/dir permissions/ownership..."
  314. for ONESPEC in `cat VCSMETADATA | tr '\n' ' '`
  315. do
  316. ONEFILE="`echo -n "$ONESPEC" | cut -f 1 -d ':'`"
  317. [ ! -e $ONEFILE ] && continue
  318. ONEPERM="`echo -n "$ONESPEC" | cut -f 2 -d ':'`"
  319. ONEOWNER="`echo -n "$ONESPEC" | cut -f 3 -d ':'`"
  320. ONEGROUP="`echo -n "$ONESPEC" | cut -f 4 -d ':'`"
  321. echo -n '.' #echo " $ONEFILE $ONEPERM $ONEOWNER $ONEGROUP"
  322. chmod $ONEPERM $ONEFILE
  323. #130528 change owner:group of symlink instead of what it points to...
  324. [ "$ONEOWNER" != "UNKNOWN" ] && chown -h $ONEOWNER $ONEFILE
  325. [ "$ONEOWNER" = "UNKNOWN" ] && chown -h root $ONEFILE
  326. [ "$ONEGROUP" != "UNKNOWN" ] && chgrp -h $ONEGROUP $ONEFILE
  327. [ "$ONEGROUP" = "UNKNOWN" ] && chgrp -h root $ONEFILE
  328. done
  329. echo
  330. fi
  331. cd $CURDIR
  332. sync
  333. #output dir for iso and img files
  334. #mkdir -p ../woof-output
  335. #common dir to download pet pkgs to...
  336. mkdir -p ../local-repositories/${TARGETARCH}/packages-pet
  337. [ ! -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.
  338. #more links to common download...
  339. if [ -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS ];then
  340. . ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS
  341. #111126 code from 2createpackages...
  342. BINARIES='deb' #get them from packages-deb.
  343. [ "$DISTRO_BINARY_COMPAT" = "t2" ] && BINARIES="bz2" #get them from packages-bz2-${DISTRO_COMPAT_VERSION}.
  344. [ "$DISTRO_BINARY_COMPAT" = "slackware" ] && BINARIES="tgz_txz" #download to packages-tgz_txz-${DISTRO_COMPAT_VERSION}.
  345. [ "$DISTRO_BINARY_COMPAT" = "slackware64" ] && BINARIES="tgz_txz" #download to packages-tgz_txz-${DISTRO_COMPAT_VERSION}. #140619 add 64
  346. [ "$DISTRO_BINARY_COMPAT" = "debian" ] && BINARIES="deb" #download to packages-deb-${DISTRO_COMPAT_VERSION}.
  347. [ "$DISTRO_BINARY_COMPAT" = "arch" ] && BINARIES="tar_xz" #download to packages-tar_xz-${DISTRO_COMPAT_VERSION}. 130306
  348. [ "$DISTRO_BINARY_COMPAT" = "puppy" ] && BINARIES="pet" #built entirely from pet pkgs.
  349. [ "$DISTRO_BINARY_COMPAT" = "scientific" ] && BINARIES="rpm" #Iguleder: download to packages-rpm-${DISTRO_COMPAT_VERSION}.
  350. [ "$DISTRO_BINARY_COMPAT" = "mageia" ] && BINARIES="rpm"
  351. [ "$DISTRO_BINARY_COMPAT" = "gentoo" ] && BINARIES="gentoo" #120515 download to packages-gentoo-gap6
  352. [ "$DISTRO_BINARY_COMPAT" = "raspbian" ] && BINARIES="deb_raspbian" #download to packages-deb_raspbian-${DISTRO_COMPAT_VERSION}.
  353. BINARIES="${BINARIES}-${DISTRO_COMPAT_VERSION}"
  354. mkdir -p ../local-repositories/${TARGETARCH}/packages-${BINARIES}
  355. [ ! -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.
  356. if [ "$DISTRO_TARGETARCH" = "arm" ]; then
  357. mkdir -p ../local-repositories/${TARGETARCH}/sd-skeleton-images
  358. [ ! -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
  359. fi
  360. fi
  361. #record target architecture in DISTRO_SPECS (will end up in /etc/ in Puppy build)...
  362. if [ -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS ];then
  363. if [ "`grep '^DISTRO_TARGETARCH' ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS`" = "" ];then
  364. echo "DISTRO_TARGETARCH='${TARGETARCH}'" >> ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS
  365. fi
  366. fi
  367. #record the woof state we build from
  368. if [ "`git log -n 1`" != "" ]; then
  369. GITBRANCH=$(git rev-parse --abbrev-ref HEAD)
  370. GITHEAD=$(git log -n 1 --pretty=format:"%h;%ci") # git rev-parse HEAD
  371. if [ -f ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS ];then
  372. if [ "`grep '^BUILD_FROM_WOOF' ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS`" = "" ];then
  373. echo "BUILD_FROM_WOOF='${GITBRANCH};${GITHEAD}'" >> ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/DISTRO_SPECS
  374. fi
  375. fi
  376. fi
  377. #until i upgrade the woof scripts... (i was planning to rename Packages-puppy-* to Packages-pet-*, aborted)
  378. for ONEPP in `find ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION} -mindepth 1 -maxdepth 1 -name 'Packages-pet-*' | tr '\n' ' '`
  379. do
  380. BASEPP="`basename $ONEPP`"
  381. NEWBASE="`echo -n $BASEPP | sed -e 's%Packages-pet-%Packages-puppy-%'`"
  382. ln -s $BASEPP ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${NEWBASE}
  383. done
  384. #111127 make sure host puppy has these...
  385. [ ! -f /usr/sbin/printcols ] && cp -af woof-arch/${HOSTARCH}/build/support/printcols /usr/sbin/ #column manipulator.
  386. [ ! -f /bin/vercmp ] && cp -af woof-arch/${HOSTARCH}/target/boot/initrd-tree0/bin/vercmp /bin/ #dotted-version compare utility, see boot/vercmp.c
  387. #111127 make sure target has these...
  388. cp -af woof-arch/${TARGETARCH}/build/support/printcols ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${NEWBASE}/rootfs-skeleton/usr/sbin/
  389. cp -af woof-arch/${TARGETARCH}/target/boot/initrd-tree0/bin/vercmp ../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}/${NEWBASE}/rootfs-skeleton/bin/
  390. echo
  391. echo "Directory '../woof-out_${HOSTARCH}_${TARGETARCH}_${COMPATDISTRO}_${COMPATVERSION}'
  392. is now normal, that is, the workarounds have been removed. Note,
  393. ../local-repositories has been created (if not already), to be used as a common
  394. binary package download place. 'packages-pet' and 'packages-${BINARIES}'
  395. have been created that link into it, where pkgs will be downloaded to."
  396. ###END###