0setup 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810
  1. #!/bin/ash
  2. #(c) Copyright 2009 Barry Kauler.
  3. #100617 support slackware .txz pkgs.
  4. #100626 '-' chars were getting removed from dependencies.
  5. #110523 Iguleder: support Scientific Linux rpm pkgs.
  6. #110612 support Mageia Linux.
  7. #111121 noryb009: improve arch linux support, patched: 0setup, 1download, 2createpackages, 3builddistro, DISTRO_COMPAT_REPOS-arch, support/arch/runDotInstalls
  8. #111129 prevent 'mv' fail error message.
  9. #111203 noryb009: arch linux -2 patch.
  10. #120126 mavrothal: offer option to skip specific repos. refer http://bkhome.org/blog/?viewDetailed=02650
  11. #120315 pkg list entries may have optional forced repo field. Ref: http://bkhome.org/blog/?viewDetailed=02414
  12. #120515 build from "gentoo" binary tarballs (refer support/gentoo). --no need to modify anything in 0setup.
  13. #120719 support raspbian. fix debian db format change.
  14. #120804 fix when only have pkgname_DEV, no pkgname.
  15. #120812 db category now allows optional subcategory (for which an icons exists in /usr/local/lib/X11/mini-icons).
  16. #120815 for debian, ubuntu, use the generic name provided in the $DB_path, instead of $Package, for find_cat.
  17. #120825 debian/ubuntu/raspbian: merge -updates dbs.
  18. #120909 moved exit-point when running in puppy.
  19. #121102 file DISTRO_SPECS has new variable DISTRO_DB_SUBNAME. ex: for 14.0-based slacko, DISTRO_DB_SUBNAME=slacko14
  20. #121111 debdb2pupdb, new fast deb to pup db converter.
  21. #121112 note, debdb2pupdb no longer calls find_cat.
  22. #121113 improve file PKGS_HOMEPAGES sort after run debdb2pupdb.
  23. #121113 read Ubuntu-db 'Section' parameter to help assign category.
  24. #121113 ubuntu-db: introduce STARTMARKER field between db records.
  25. #121113 reverse question, enter only for ubuntu db -updates.
  26. #121116 0setup also runs in running puppy called from ppm. some o/p needs to be translated, done in /usr/share/sss/script_strings/script_strings. see below all LANGORG insertions.
  27. #121130 bug found, when not building a upup.
  28. #130126 find_cat rewritten. works as before, also can post-process an entire db-entry or db-entries-file. arch code rewritten by noryb009
  29. #130305 debdb2pupdb.bac now also check that deps exist, create list of pkgs.
  30. #130306 fix arch linux build.
  31. #130316 debdb2pupdb does not use /tmp/0setupcompletelistpkgs in a running puppy.
  32. #130319 remove 'raspbian' from updates code section.
  33. #140116 make woof less invasive
  34. LANGORG="$(locale | grep '^LANG=' | cut -d '=' -f 2)" #121116
  35. export LANG=C #faster.
  36. if [ "$SETUPCALLEDFROM" = "ppm" ];then
  37. DBmethod="$(cat /var/local/petget/db_verbose 2>/dev/null)"
  38. [ "$DBmethod" = "" ] && DBmethod=true
  39. if [ "$DBmethod" = "false" ]; then
  40. LANG=${LANGORG} . yaf-splash -icon gtk-info -bg white -placement top -close never -text "$(gettext 'Updating package databases.
  41. Please wait...')" &
  42. XPID=$!
  43. fi
  44. else
  45. DBmethod=true
  46. fi
  47. if [ -f ./DISTRO_SPECS ];then
  48. . ./DISTRO_SPECS
  49. [ ! "$DISTRO_DB_SUBNAME" ] && DISTRO_DB_SUBNAME="$DISTRO_COMPAT_VERSION" #121102 fallback if DISTRO_DB_SUBNAME not defined in file DISTRO_SPECS.
  50. if [ -f ./DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then #v431
  51. . ./DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
  52. else
  53. . ./DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT} #130306
  54. fi
  55. if [ -f ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then #w478
  56. . ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
  57. DPSFILE="DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}"
  58. else
  59. . ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}
  60. DPSFILE="DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}"
  61. fi
  62. . ./PKGS_MANAGEMENT
  63. . ./DISTRO_PET_REPOS
  64. RUNNINGPUP='no'
  65. # 140109 64 bit support #140116 improve
  66. . ./WOOFMERGEVARS
  67. if [ "${COMPATDISTRO}" = "slackware" -a "${TARGETARCH}" = "x86_64" ];then
  68. # see if it's been done
  69. LIB64DONE=`find packages-templates -type d -name 'lib64'`
  70. if [ "$LIB64DONE" ];then
  71. echo "lib64 directories in packages-templates already exist."
  72. else
  73. LIST=`ls packages-templates|grep -v pcmciautils`
  74. echo -n "fixing package templates for 64 bit: "
  75. sleep 2 #time to read
  76. for i in $LIST
  77. do echo -n "$i "
  78. if [ -d packages-templates/${i}/lib ];then
  79. mv packages-templates/${i}/lib packages-templates/${i}/lib64
  80. echo -n '' > packages-templates/${i}/PLUSEXTRADIRS
  81. fi
  82. [ -d packages-templates/${i}/usr/lib ] \
  83. && mv packages-templates/${i}/usr/lib packages-templates/${i}/usr/lib64
  84. done
  85. echo -e "\n\nlib64 directories created in packages-templates."
  86. fi
  87. fi
  88. else
  89. #want to run this script in running puppy, to update db's...
  90. . /etc/DISTRO_SPECS
  91. . /root/.packages/DISTRO_COMPAT_REPOS #v431
  92. . /root/.packages/DISTRO_PKGS_SPECS
  93. . /root/.packages/PKGS_MANAGEMENT
  94. . /root/.packages/DISTRO_PET_REPOS
  95. cd /root/.packages
  96. RUNNINGPUP='yes'
  97. fi
  98. #remove comments from PKGS_SPECS_TABLE
  99. PKGS_SPECS_TABLE="`echo "$PKGS_SPECS_TABLE" | grep -v '^#'`"
  100. #w480 check puppy pkg db files...
  101. if [ "$RUNNINGPUP" = "no" ];then
  102. ./support/fix-puppy-dbs
  103. [ $? -eq 1 ] && exit
  104. fi
  105. #BAD bug, woof should not invade the running system
  106. #[ -f ./support/debdb2pupdb ] && cp -f ./support/debdb2pupdb /usr/local/petget/ #121111 0setup needs it here, when run from PPM.
  107. #note, 3builddistro copies it into rootfs-complete/usr/local/petget when building a pup.
  108. #121112 note, debdb2pupdb no longer calls find_cat.
  109. #w015 to speed things up, this func replaced by compiled app support/find_cat ...
  110. #[ -f ./support/find_cat ] && cp -f ./support/find_cat /usr/local/petget/ #130126
  111. #130126 make sure have latest in host system...
  112. #if [ -f rootfs-skeleton/usr/local/petget/categories.dat -a -f /usr/local/petget/debdb2pupdb ];then
  113. #echo "Your system is OK"
  114. #else
  115. #echo "Your system is incompatible or too old"
  116. #sleep 5
  117. #exit 1 #&& cp -f rootfs-skeleton/usr/local/petget/categories.dat /usr/local/petget/
  118. #fi
  119. [ -f /usr/local/petget/find_cat ] && FIND_CAT="/usr/local/petget/find_cat" \
  120. || FIND_CAT='./support/find_cat' #140116
  121. if [ -f ./support/rpm2ppm ];then #110612
  122. RPM2PPM='./support/rpm2ppm'
  123. else
  124. RPM2PPM='/usr/local/petget/rpm2ppm' #see 3builddistro.
  125. fi
  126. if [ -f ./support/mageia2ppm ];then #110612
  127. MAGEIA2PPM='./support/mageia2ppm'
  128. else
  129. MAGEIA2PPM='/usr/local/petget/mageia2ppm' #see 3builddistro
  130. fi
  131. #w091018 now logging errors for future recall...
  132. mkdir -p /var/woof
  133. RUNDATE="`date`"
  134. echo -n "" > /var/woof/0setup_fail_report_$RUNNINGPUP #RUNNINGPUP=yes or no. latter if woof.
  135. LANG=${LANGORG} echo "This is a report on the last time the '0setup' script was run.
  136. Date and time '0setup' last run: ${RUNDATE}
  137. Compatible-distro and release-name: ${DISTRO_BINARY_COMPAT}, ${DISTRO_COMPAT_VERSION}
  138. Mostly only errors get logged, so the less seen below, the better.
  139. Log of last run of '0setup':
  140. " >> /var/woof/0setup_fail_report_$RUNNINGPUP
  141. #download docs on compatible-distro pkgs...
  142. for PKGLISTSPEC in $PKG_DOCS_DISTRO_COMPAT #see file DISTRO_PKGS_SPECS-ubuntu
  143. do
  144. PKGLISTFILE="`echo -n "$PKGLISTSPEC" | cut -f 3 -d '|'`"
  145. PKGLISTURI="`echo -n "$PKGLISTSPEC" | cut -f 2 -d '|'`"
  146. [ "$PKGLISTURI" = "" ] && continue #w478 no url, pkg db file only kept in woof.
  147. skipdl=""
  148. if [ "$RUNNINGPUP" = "no" -a -f $PKGLISTFILE -a "$DBmethod" = "true" ];then
  149. echo
  150. echo "Local db file '${PKGLISTFILE}' already exists."
  151. echo "Press ENTER key only to upgrade it,"
  152. echo -n "or any other printable char to skip: "
  153. read skipdl
  154. else
  155. skipdl=""
  156. fi
  157. if [ "$skipdl" = "" ];then
  158. if [ "$DBmethod" = "true" ];then
  159. echo
  160. LANG=${LANGORG} echo "A package information database file needs to be downloaded."
  161. LANG=${LANGORG} echo "This will be downloaded from:"
  162. echo "$PKGLISTURI"
  163. LANG=${LANGORG} echo "and will be processed and named: ${PKGLISTFILE}"
  164. LANG=${LANGORG} echo -n "Press ENTER key to download, any other to skip it: " #120126
  165. read downloadit
  166. else
  167. downloadit=""
  168. fi
  169. if [ "$downloadit" = "" ] ; then #120126
  170. DLFILE="`basename $PKGLISTURI`"
  171. [ -f $DLFILE ] && mv -f $DLFILE /tmp/${DLFILE}-backup1 #v431 otherwise wget creates a new file ${DLFILE}.1
  172. [ "$DBmethod" = "true" ] && rxvt -name pet -bg orange -geometry 80x10 -e wget $PKGLISTURI || wget $PKGLISTURI
  173. sync
  174. xDLFILE="$DLFILE"
  175. if [ -f $DLFILE ];then
  176. case ${DISTRO_BINARY_COMPAT} in
  177. ubuntu|trisquel|debian|devuan|raspbian)
  178. case "$DLFILE" in
  179. *.bz2)
  180. xDLFILE="`basename $DLFILE .bz2`"
  181. bunzip2 $DLFILE
  182. RETSTAT=$?
  183. ;;
  184. *.xz)
  185. xDLFILE="`basename $DLFILE .xz`"
  186. unxz $DLFILE
  187. RETSTAT=$?
  188. ;;
  189. esac
  190. [ $RETSTAT -eq 0 ] && mv -f $xDLFILE ${PKGLISTFILE}pre
  191. ;;
  192. slackware*)
  193. RETSTAT=0
  194. mv -f $xDLFILE ${PKGLISTFILE}pre
  195. ;;
  196. arch)
  197. #130126 arch code rewritten by noryb009: call find_cat afterward...
  198. #130306 BK: sub() funtion to fix version relation operators...
  199. #130306 BK: filtered out bad chars from description (note tortuous way to escape ' char)...
  200. LANG=${LANGORG} echo "Processing ${DLFILE} please wait..."
  201. xDLFILE="`basename $DLFILE .gz`" #actually it's a tarball: core.db.tar.gz, extra.db.tar.gz, community.db.tar.gz
  202. rm -rf sandbox0 2>/dev/null
  203. mkdir sandbox0
  204. cd sandbox0
  205. tar xzf "../$DLFILE"
  206. RETSTAT=$?
  207. cd ..
  208. if [ $RETSTAT -eq 0 ];then
  209. rm -f "$DLFILE"
  210. xxDLFILE="`basename $DLFILE .db.tar.gz`" #this will be core, extra, community 130306
  211. for i in sandbox0/*; do
  212. cat "$i/desc" "$i/depends"
  213. done | awk -v pkgpath="$xxDLFILE" '
  214. function output() {
  215. if(filename == "") return;
  216. printf("%s-%s|%s|%s|%s||%sK|%s/os/i686|%s|%s|%s|\n", pkgname, pkgverarr[1], pkgname, pkgverarr[1], pkgverarr[2], pkgsize, pkgpath, filename, pkgdeps, pkgdesc)
  217. pkgname=""; pkgverarr[1]=""; pkgverarr[2]=""; pkgsize=""; filename=""; pkgdeps=""; inDeps=0; pkgdesc="";
  218. }
  219. BEGIN{
  220. inDeps=0
  221. }
  222. {
  223. if($1 == ""){
  224. #do nothing
  225. }else if($1 == "%FILENAME%"){
  226. inDeps=0
  227. output()
  228. getline filename
  229. }else if($1 == "%NAME%"){
  230. inDeps=0
  231. getline pkgname
  232. }else if($1 == "%VERSION%"){
  233. inDeps=0
  234. getline pkgver; split(pkgver, pkgverarr, "-")
  235. }else if($1 == "%DESC%"){
  236. inDeps=0
  237. getline pkgdesc
  238. gsub(/</, " ", pkgdesc)
  239. gsub(/>/, " ", pkgdesc)
  240. gsub(/\|/, " ", pkgdesc)
  241. gsub(/'\''/, " ", pkgdesc)
  242. gsub(/\"/, " ", pkgdesc)
  243. gsub(/\(/, " ", pkgdesc)
  244. gsub(/\)/, " ", pkgdesc)
  245. }else if($1 == "%ISIZE%"){
  246. inDeps=0
  247. getline pkgsize; pkgsize = pkgsize / 1024
  248. }else if($1 == "%DEPENDS%"){
  249. inDeps=1
  250. }else if($1 ~ /^%/){
  251. inDeps=0
  252. }else if(inDeps == 1){ # dependency
  253. if(pkgdeps != "") pkgdeps=pkgdeps","
  254. pkgdeps=pkgdeps"+"
  255. sub(/>=/, "\\&ge", $0)
  256. sub(/<=/, "\\&le", $0)
  257. sub(/>/, "\\&gt", $0)
  258. sub(/</, "\\&lt", $0)
  259. sub(/=/, "\\&eq", $0)
  260. pkgdeps=pkgdeps$0
  261. }
  262. }
  263. END{
  264. output();
  265. }
  266. ' > /tmp/${PKGLISTFILE}temp #130306
  267. ${FIND_CAT} /tmp/${PKGLISTFILE}temp > $PKGLISTFILE #130126 130306
  268. fi
  269. rm -rf sandbox0 2>/dev/null
  270. ;;
  271. t2) #w017
  272. RETSTAT=0
  273. ;;
  274. puppy)
  275. RETSTAT=0
  276. ;;
  277. scientific) #110523 Iguleder
  278. xDLFILE="`basename $DLFILE .gz`"
  279. gunzip $DLFILE
  280. RETSTAT=$?
  281. [ $RETSTAT -eq 0 ] && mv -f $xDLFILE ${PKGLISTFILE}pre
  282. ;;
  283. mageia) #110612
  284. xDLFILE="`basename $DLFILE .cz`" #DLFILE=synthesis.hdlist.cz
  285. mv -f $DLFILE ${xDLFILE}.gz #.cz is actually a gzipped file.
  286. gunzip ${xDLFILE}.gz
  287. RETSTAT=$?
  288. [ $RETSTAT -eq 0 ] && mv -f $xDLFILE ${PKGLISTFILE}pre #ex: Packages-mageia-1-corepre
  289. ;;
  290. esac
  291. if [ $RETSTAT -eq 0 ];then
  292. LANG=${LANGORG} echo "...success."
  293. else
  294. LANG=${LANGORG} echo "Downloaded file is corrupted. Deleting file and aborting."
  295. rm -f $xDLFILE 2>/dev/null
  296. rm -f $DLFILE 2>/dev/null
  297. if [ "$DBmethod" = "false" ];then
  298. kill $XPID
  299. Xdialog --title "$(gettext 'PPM database')" --left --msgbox "$(gettext 'PPM database failed. Chech /var/woof/0setup_fail_report_')$RUNNINGPUP $(gettext 'for details.')" 0 100
  300. fi
  301. unset OSETUP_CALLED_FROM
  302. exit
  303. fi
  304. else
  305. LANG=${LANGORG} echo "Failed to download, aborting."
  306. LANG=${LANGORG} echo "
  307. Failed to download db file:
  308. ${PKGLISTURI}
  309. ...exited from 0setup script." >> /var/woof/0setup_fail_report_$RUNNINGPUP
  310. if [ "$DBmethod" = "false" ];then
  311. kill $XPID
  312. Xdialog --title "$(gettext 'PPM database')" --left --msgbox "$(gettext 'PPM database failed. Chech /var/woof/0setup_fail_report_')$RUNNINGPUP $(gettext 'for details.')" 0 100
  313. fi
  314. unset OSETUP_CALLED_FROM
  315. exit
  316. fi
  317. else #120126
  318. LANG=${LANGORG} echo "...skipped"
  319. fi
  320. fi
  321. done
  322. #120825 -update dbs...
  323. DBUPDATEFLAG='invalid' #121130
  324. PKGLISTS_COMPAT_UPDATES=""
  325. case $DISTRO_BINARY_COMPAT in
  326. ubuntu|trisquel|debian|devuan) #130319 removed |raspbian
  327. if [ "$DBmethod" = "true" ]; then
  328. echo
  329. LANG=${LANGORG} echo "Do you want to download the ${DISTRO_BINARY_COMPAT}-updates package databases?"
  330. LANG=${LANGORG} echo "Accept, they will be downloaded and merged,"
  331. LANG=${LANGORG} echo "such that only the updated pkg db entries are kept."
  332. LANG=${LANGORG} echo "Example: as at August 31, 2012, Ubuntu Precise Pangolin 12.04 has the first
  333. 'Service Pack' which is version 12.04.1 -- accepting here will obtain the
  334. package lists for 12.04.1 -- it is generally recommended to accept."
  335. LANG=${LANGORG} echo -n "ENTER key only to accept, any other printable char then ENTER to decline: "
  336. read DBUPDATEFLAG
  337. else
  338. DBUPDATEFLAG=""
  339. fi
  340. if [ "$DBUPDATEFLAG" = "" ];then #121113
  341. #basically same code as above, slight mods...
  342. for PKGLISTSPEC in $PKG_DOCS_DISTRO_COMPAT
  343. do
  344. updPTN1="s%${DISTRO_COMPAT_VERSION}%${DISTRO_COMPAT_VERSION}_updates%" #ex: 'precise' becomes 'precise_updates' (underscore because - is delimiter)
  345. updPTN2="s%${DISTRO_COMPAT_VERSION}%${DISTRO_COMPAT_VERSION}-updates%" #ex: 'precise' becomes 'precise-updates'
  346. PKGLISTFILE="`echo -n "$PKGLISTSPEC" | cut -f 3 -d '|' | sed "$updPTN1"`"
  347. PKGLISTURI="`echo -n "$PKGLISTSPEC" | grep -v 'deb-multimedia' | cut -f 2 -d '|' | sed "$updPTN2"`"
  348. [ "$PKGLISTURI" = "" ] && continue #w478 no url, pkg db file only kept in woof.
  349. PKGLISTS_COMPAT_UPDATES="${PKGLISTS_COMPAT_UPDATES} ${PKGLISTFILE}" #see further down.
  350. skipdl=""
  351. if [ "$RUNNINGPUP" = "no" -a -f $PKGLISTFILE -a "$DBmethod" = "true" ];then
  352. echo
  353. echo "Local db file '${PKGLISTFILE}' already exists."
  354. echo "Press ENTER key only to upgrade it,"
  355. echo -n "or any other printable char to skip: "
  356. read skipdl
  357. else
  358. skipdl=""
  359. fi
  360. if [ "$skipdl" = "" ]; then
  361. if [ "$DBmethod" = "true" ];then
  362. echo
  363. LANG=${LANGORG} echo "A package information database file needs to be downloaded."
  364. LANG=${LANGORG} echo "This will be downloaded from:"
  365. echo "$PKGLISTURI"
  366. LANG=${LANGORG} echo "and will be processed and named: ${PKGLISTFILE}"
  367. LANG=${LANGORG} echo -n "Press ENTER key to download, any other to skip it: " #120126
  368. read downloadit
  369. else
  370. downloadit=""
  371. fi
  372. if [ "$downloadit" = "" ] ; then #120126
  373. DLFILE="`basename $PKGLISTURI`"
  374. [ -f $DLFILE ] && mv -f $DLFILE /tmp/${DLFILE}-backup1 #v431 otherwise wget creates a new file ${DLFILE}.1
  375. [ "$DBmethod" = "true" ] && rxvt -name pet -bg orange -geometry 80x10 -e wget $PKGLISTURI || wget $PKGLISTURI
  376. sync
  377. xDLFILE="$DLFILE"
  378. if [ -f $DLFILE ];then
  379. case ${DISTRO_BINARY_COMPAT} in
  380. ubuntu|trisquel|debian|devuan) #130319 removed |raspbian
  381. case "$DLFILE" in
  382. *.bz2)
  383. xDLFILE="`basename $DLFILE .bz2`"
  384. bunzip2 $DLFILE
  385. RETSTAT=$?
  386. ;;
  387. *.xz)
  388. xDLFILE="`basename $DLFILE .xz`"
  389. unxz $DLFILE
  390. RETSTAT=$?
  391. ;;
  392. esac
  393. [ $RETSTAT -eq 0 ] && mv -f $xDLFILE ${PKGLISTFILE}pre
  394. ;;
  395. esac
  396. if [ $RETSTAT -eq 0 ];then
  397. LANG=${LANGORG} echo "...success."
  398. else
  399. LANG=${LANGORG} echo "Downloaded file is corrupted. Deleting file and aborting."
  400. rm -f $xDLFILE 2>/dev/null
  401. rm -f $DLFILE 2>/dev/null
  402. if [ "$DBmethod" = "false" ];then
  403. kill $XPID
  404. Xdialog --title "$(gettext 'PPM database')" --left --msgbox "$(gettext 'PPM database failed. Chech /var/woof/0setup_fail_report_')$RUNNINGPUP $(gettext 'for details.')" 0 100
  405. fi
  406. unset OSETUP_CALLED_FROM
  407. exit
  408. fi
  409. else
  410. LANG=${LANGORG} echo "Failed to download, aborting."
  411. LANG=${LANGORG} echo "
  412. Failed to download db file:
  413. $PKGLISTURI
  414. ...exited from 0setup script." >> /var/woof/0setup_fail_report_$RUNNINGPUP
  415. if [ "$DBmethod" = "false" ];then
  416. kill $XPID
  417. Xdialog --title "$(gettext 'PPM database')" --left --msgbox "$(gettext 'PPM database failed. Chech /var/woof/0setup_fail_report_')$RUNNINGPUP $(gettext 'for details.')" 0 100
  418. fi
  419. unset OSETUP_CALLED_FROM
  420. exit
  421. fi
  422. else #120126
  423. LANG=${LANGORG} echo "...skipped"
  424. fi
  425. fi
  426. done
  427. fi
  428. ;;
  429. esac
  430. ###download pet pkg databases...
  431. for PKGLISTSPEC in $PKG_DOCS_PET_REPOS #see file DISTRO_PET_REPOS
  432. do
  433. PKGLISTFILE="`echo -n "$PKGLISTSPEC" | cut -f 3 -d '|'`"
  434. PKGLISTURI="`echo -n "$PKGLISTSPEC" | cut -f 2 -d '|'`"
  435. if [ "$RUNNINGPUP" = "yes" -o ! -f $PKGLISTFILE ];then
  436. if [ "$DBmethod" = "true" ];then
  437. echo
  438. LANG=${LANGORG} echo "A package information database file needs to be downloaded."
  439. LANG=${LANGORG} echo "This will be downloaded from:"
  440. echo "$PKGLISTURI"
  441. LANG=${LANGORG} echo "and will be named: ${PKGLISTFILE}"
  442. LANG=${LANGORG} echo -n "Press ENTER key to download, any other to skip it: " #120126
  443. read downloadit
  444. else
  445. downloadit=""
  446. fi
  447. if [ "$downloadit" = "" ] ; then #120126
  448. DLFILE="`basename $PKGLISTURI`"
  449. [ -f $DLFILE ] && mv -f $DLFILE /tmp/${DLFILE}-backup1 #v431 otherwise wget creates a new file ${DLFILE}.1 111129 prevent error msg.
  450. [ "$DBmethod" = "true" ] && rxvt -name pet -bg orange -geometry 80x10 -e wget $PKGLISTURI || wget $PKGLISTURI
  451. sync
  452. [ -f $DLFILE ] && LANG=${LANGORG} echo "...success"
  453. else #120126
  454. LANG=${LANGORG} echo "...skipped"
  455. fi
  456. fi
  457. done
  458. v1PATTERN="s%\\-[0-9.]*${DISTRO_BINARY_COMPAT}[0-9.]*$%%"
  459. v2PATTERN="s%\\+[0-9.]*${DISTRO_BINARY_COMPAT}[0-9.]*$%%"
  460. #130305 debdb2pupdb.bac now also check that deps exist, need this list of pkgs...
  461. if [ "$RUNNINGPUP" = "no" ];then #130316 debdb2pupdb does not read this file in a running pup.
  462. case ${DISTRO_BINARY_COMPAT} in
  463. ubuntu|trisquel|debian|devuan|raspbian)
  464. echo -n " " > /tmp/0setupcompletelistpkgs
  465. COMPLETELISTPKGS="$(grep '^Package: ' Packages*pre | cut -f 2 -d ' ' | tr '\n' ' ')"
  466. echo "$COMPLETELISTPKGS" >> /tmp/0setupcompletelistpkgs
  467. [ -f /tmp/0setupnewinvaliddeps ] && rm -f /tmp/0setupnewinvaliddeps #see debdb2pupdb.
  468. ;;
  469. esac
  470. else
  471. [ -f /tmp/0setupcompletelistpkgs ] && rm -f /tmp/0setupcompletelistpkgs
  472. fi
  473. #w008 convert pkg database ${PKGLISTFILE}pre to a standard format...
  474. #120812 subcategory...
  475. #each line: pkgname|nameonly|version|pkgrelease|category[;subcategory]|size|path|fullfilename|dependencies|description|
  476. #ex: abiword-1.2.4|abiword|1.2.4|5|Document|999K|slackware/ab|abiword-1.2.4-5-i486.tgz|+aiksausus,+gtk2|a nice wordprocessor|
  477. PKGLISTS_COMPAT="`echo "$PKG_DOCS_DISTRO_COMPAT" | tr ' ' '\n' | cut -f 3 -d '|' | tr '\n' ' '`" #see file DISTRO_PKGS_SPECS-ubuntu
  478. #...format ex: 'Packages-ubuntu-intrepid-main Packages-ubuntu-intrepid-universe'
  479. for ONE_PKGLISTS_COMPAT in $PKGLISTS_COMPAT $PKGLISTS_COMPAT_UPDATES #120825
  480. do
  481. [ ! -f ${ONE_PKGLISTS_COMPAT}pre ] && continue
  482. echo
  483. LANG=${LANGORG} echo "Processing ${ONE_PKGLISTS_COMPAT} into a standard format..."
  484. echo -n "" > $ONE_PKGLISTS_COMPAT
  485. echo -n "" > /tmp/${ONE_PKGLISTS_COMPAT}temp #130126
  486. case ${DISTRO_BINARY_COMPAT} in
  487. ubuntu|trisquel|debian|devuan|raspbian)
  488. if [ -f /usr/local/petget/debdb2pupdb ];then #121111
  489. #new fast compiled app...
  490. #create an intermediate-converted file...
  491. LANG=${LANGORG} echo " please wait..."
  492. #121113 added "Section"...
  493. #121113 insert STARTMARKER...
  494. MANIPULATED1="$(grep -E '^Package:|^Installed\-Size:|^Architecture:|^Version:|^Depends:|^Filename:|^Description:|^Homepage:|^Section:' ${ONE_PKGLISTS_COMPAT}pre | tr '[\t"|`]' ' ' | tr -s ' ' | sed -e 's%^Installed\-Size%InstalledSize%' -e 's%^Package:%STARTMARKER|PKG\nPackage:%' -e 's%: %|%' -e 's% $%%')" #`geany
  495. echo "$MANIPULATED1" > /tmp/woof-debdb.in
  496. #call new app. note, this in turn calls /usr/local/petget/find_pkgs...
  497. /usr/local/petget/debdb2pupdb ${DISTRO_BINARY_COMPAT} ${DISTRO_COMPAT_VERSION} > /tmp/${ONE_PKGLISTS_COMPAT}temp #130126 $ONE_PKGLISTS_COMPAT
  498. ${FIND_CAT} /tmp/${ONE_PKGLISTS_COMPAT}temp > $ONE_PKGLISTS_COMPAT #130126
  499. #homepages also get logged...
  500. if [ -f /tmp/woof-homepages.acc ];then
  501. if [ -f ./PKGS_HOMEPAGES ];then #running in woof.
  502. cat ./PKGS_HOMEPAGES >> /tmp/woof-homepages.acc
  503. sort --key=1,1 --field-separator=" " --unique /tmp/woof-homepages.acc > ./PKGS_HOMEPAGES #121113
  504. fi
  505. fi
  506. #130316 /tmp/0setupnewinvaliddeps is created by debdb2pupdb, when run in woof.
  507. # 3builddistro will have to copy this file 'invaliddepslist' into rootfs-complete/usr/local/petget/ ...
  508. # it is read by debdb2pupdb in a running puppy.
  509. if [ "$RUNNINGPUP" = "no" ];then
  510. echo -n ' ' > invaliddepslist
  511. NIDL1="$(sort -u /tmp/0setupnewinvaliddeps | tr '\n' ' ')"
  512. echo -n "$NIDL1" >> invaliddepslist
  513. fi
  514. else
  515. DB_category="" #130126
  516. #120719 debian squeeze and earlier has Description field last, wheezy has Filename field last...
  517. Description=''; Filename=''; Package=''; InstalledSize=''; Architecture=''; Version=''
  518. endflag=''
  519. while read DB_ONELINE
  520. do
  521. eval $DB_ONELINE
  522. case $DB_ONELINE in
  523. Description*)
  524. [ "$Filename" ] && endflag='yes'
  525. ;;
  526. Filename*)
  527. [ "$Description" ] && endflag='yes' #wheezy and later.
  528. ;;
  529. esac
  530. if [ "$endflag" = "yes" ];then
  531. DB_fullfilename="`echo -n "$Filename" | rev | cut -f 1 -d '/' | rev`"
  532. DB_path="`echo -n "$Filename" | rev | cut -f 2-9 -d '/' | rev`"
  533. DB_version="`echo -n "$Version" | sed -e 's%^[0-9]:%%' -e "$v1PATTERN" -e "$v2PATTERN"`"
  534. DB_pkgrelease="`echo -n "$Version" | sed -e 's%^[0-9]:%%' -e "s%${DB_version}%%" -e 's%^\\-%%' -e 's%^\\+%%'`"
  535. DB_pkgname="${Package}_${DB_version}"
  536. #120815 for debian, ubuntu, use the generic name provided in the $DB_path, instead of $Package, for find_cat... 130126...
  537. #xPackage="$Package"
  538. #[ "$DB_path" ] && xPackage="$(basename "$DB_path")"
  539. #DB_category="`${FIND_CAT} $xPackage "$Description"`" #120812 find_cat now returns category[;subcategory], ex: Document;edit
  540. DB_dependencies="`echo -n "$Depends" | sed -e 's%, %\n%g' | cut -f 1 -d ' ' | tr '\n' ' ' | sed -e 's% $%%' -e 's% %,+%g' -e 's%,$%%'`"
  541. [ "$DB_dependencies" != "" ] && DB_dependencies='+'"$DB_dependencies"
  542. echo "$DB_pkgname|$Package|$DB_version|$DB_pkgrelease|$DB_category|${InstalledSize}K|$DB_path|$DB_fullfilename|$DB_dependencies|$Description|$DISTRO_BINARY_COMPAT|$DISTRO_COMPAT_VERSION|" >> /tmp/${ONE_PKGLISTS_COMPAT}temp #130126 $ONE_PKGLISTS_COMPAT
  543. echo -n "$Package "
  544. Description=''; Filename=''; Package=''; InstalledSize=''; Architecture=''; Version=''
  545. endflag=''
  546. fi
  547. done<<_END1
  548. $(grep -E '^Package:|^Installed\-Size:|^Architecture:|^Version:|^Depends:|^Filename:|^Description:' ${ONE_PKGLISTS_COMPAT}pre | tr '[\t"|`]' ' ' | tr -s ' ' | grep -v '\\-dbg$' | sed -e 's%^Installed\-Size%InstalledSize%' -e 's%: %="%' -e 's% $%%' -e 's%$%"%')
  549. _END1
  550. ${FIND_CAT} /tmp/${ONE_PKGLISTS_COMPAT}temp > $ONE_PKGLISTS_COMPAT #130126
  551. fi
  552. ;;
  553. slackware*)
  554. DB_category="" #130126
  555. #note stabellini site has PACKAGES.TXT for the official 12.2 repo, with dependency info.
  556. #however, there is an extra 'PACKAGE MIRROR' field so i have added this preprocess line...
  557. #some pipe (|) chars screw up dep info so replace with commas in the pre process #01micko 20110505
  558. sed -i 's%|%,%g' ${ONE_PKGLISTS_COMPAT}pre
  559. REPODATA0="`cat ${ONE_PKGLISTS_COMPAT}pre | grep -v '^PACKAGE MIRROR'`"
  560. REPODATA="`echo "$REPODATA0" | tr '\t' ' ' | tr -s ' ' | sed -e 's% $%%' | tr '\n' ' ' | sed -e 's% %\n%g'| grep -o '.*PACKAGE DESCRIPTION: [^ ]*: ' | sed -e 's%: $%%'`"
  561. #...each line ex: PACKAGE NAME: zsh-4.3.6-i486-1.tgz PACKAGE LOCATION: ./slackware/ap PACKAGE SIZE (compressed): 2302 K PACKAGE SIZE (uncompressed): 6870 K PACKAGE DESCRIPTION: zsh
  562. #...that last field is the actual package name without version.
  563. #the slacky repo has more information in its database, these fields:
  564. #PACKAGE NAME: PACKAGE LOCATION: PACKAGE SIZE (compressed): PACKAGE SIZE (uncompressed): PACKAGE REQUIRED: PACKAGE CONFLICTS: PACKAGE SUGGESTS: PACKAGE DESCRIPTION:
  565. echo "$REPODATA" |
  566. while read DB_ONELINE
  567. do
  568. [ "$DB_ONELINE" = "" ] && continue #w016 precaution.
  569. DB_fullfilename="`echo -n "$DB_ONELINE" | grep -o 'PACKAGE NAME: [^ ]* ' | cut -f 3 -d ' '`"
  570. DB_path="`echo -n "$DB_ONELINE" | grep -o 'PACKAGE LOCATION: [^ ]* ' | cut -f 3 -d ' ' | sed -e 's%^\./%%'`"
  571. DB_size="`echo -n "$DB_ONELINE" | grep -o 'PACKAGE SIZE (uncompressed): [^ ]* ' | cut -f 4 -d ' ' | sed -e 's% %%'`"'K'
  572. #DB_dependencies="`echo -n "$DB_ONELINE" | grep -o ' PACKAGE REQUIRED: .* PACKAGE ' | sed -e 's% PACKAGE %%' | cut -f 2-99 -d ' ' | sed -e 's% [^,]*%%g' | sed -e 's%,%,+%g' | sed -e 's/[^0-9a-zA-Z.+_=,-]//g'`" #100626
  573. DB_dependencies="`echo -n "$DB_ONELINE" | grep -o ' PACKAGE REQUIRED: .* PACKAGE ' | sed -e 's% PACKAGE %%' | cut -f 2-99 -d ' ' | sed -e 's% [^,]*%%g' -e 's%,%,+%g' -e 's/[^0-9a-zA-Z.+_=,-]//g'`" #100626 #110501 speed up sed
  574. [ "$DB_dependencies" != "" ]&& DB_dependencies='+'"$DB_dependencies"
  575. [ "$DB_dependencies" = "+PACKAGE" ]&& DB_dependencies="" #01micko 20110504 bug with "+PACKAGES" sneaking through
  576. #...processed to ex: +acl,+gcc,+glibc-solibs,+libXt,+libart_lgpl
  577. DB_nameonly="`echo -n "$DB_ONELINE" | grep -o 'PACKAGE DESCRIPTION: .*' | cut -f 3 -d ' '`"
  578. #get the actual one-line description...
  579. dbPATTERN='^'"$DB_nameonly"': '
  580. DB_description="`grep "$dbPATTERN" ${ONE_PKGLISTS_COMPAT}pre | head -n 1 | cut -f 2 -d '(' | cut -f 1 -d ')' | tr '\-' ' ' | sed -e 's/[^0-9a-zA-Z.+_= ]//g'`"
  581. #a problem, some entries in slacky db do not have a description in "( .... )" so look further...
  582. if [ "`grep "$dbPATTERN" ${ONE_PKGLISTS_COMPAT}pre | head -n 1 | grep '('`" = "" ];then
  583. DB_description="`grep "$dbPATTERN" ${ONE_PKGLISTS_COMPAT}pre | head -n 3 | tail -n 1 | cut -f 2-11 -d ' ' | tr '\-' ' ' | sed -e 's/[^0-9a-zA-Z.+_= ]//g'`"
  584. fi
  585. #get the category...
  586. #w015 find_cat_func replaced by compiled app... 130126...
  587. #xDB_description="$DB_description"
  588. #[ "$DB_description" = "" ] && xDB_description="nothing"
  589. #DB_category="`${FIND_CAT} $DB_nameonly "$xDB_description"`" #120812 see updated find_cat
  590. #pkgname, version...
  591. DB_pkgname="`echo -n "$DB_fullfilename" | sed -e 's%-i[3456]86.*%%' | sed -e 's%-noarch.*%%'`"
  592. noPATTERN="s%${DB_nameonly}%%"
  593. DB_version="`echo -n "$DB_pkgname" | sed -e "$noPATTERN" | sed -e 's%^\-%%'`"
  594. #add support for .txz pkgs...
  595. DB_pkgrelease="`echo -n "$DB_fullfilename" | sed -e 's%\.txz%%' | sed -e 's%\.tgz%%' | sed -e 's%.*\-i[3456]86%%' | sed -e 's%.*\-noarch%%' | sed -e 's%^\-%%'`"
  596. echo "$DB_pkgname|$DB_nameonly|$DB_version|$DB_pkgrelease|$DB_category|$DB_size|$DB_path|$DB_fullfilename|$DB_dependencies|$DB_description|$DISTRO_BINARY_COMPAT|$DISTRO_COMPAT_VERSION|" >> /tmp/${ONE_PKGLISTS_COMPAT}temp #130126 $ONE_PKGLISTS_COMPAT
  597. [ "$DBmethod" != "false" ] && echo -n "$DB_nameonly "
  598. done
  599. ${FIND_CAT} /tmp/${ONE_PKGLISTS_COMPAT}temp > $ONE_PKGLISTS_COMPAT #130126
  600. ;;
  601. arch)
  602. LANG=${LANGORG} echo "...it's already in the Puppy standard format."
  603. ;;
  604. t2) #w017
  605. LANG=${LANGORG} echo "...it's already in the Puppy standard format."
  606. ;;
  607. puppy)
  608. echo "...it's already in the Puppy standard format."
  609. ;;
  610. scientific) #110523 Iguleder
  611. [ -f $ONE_PKGLISTS_COMPAT ] && rm -f $ONE_PKGLISTS_COMPAT
  612. ${RPM2PPM} ${ONE_PKGLISTS_COMPAT}pre $ONE_PKGLISTS_COMPAT $DISTRO_BINARY_COMPAT $DISTRO_COMPAT_VERSION #110612 fix
  613. temp_file=`mktemp -u`
  614. cat $ONE_PKGLISTS_COMPAT | sort | uniq > $temp_file
  615. mv $temp_file $ONE_PKGLISTS_COMPAT
  616. ;;
  617. mageia) #110612
  618. [ -f $ONE_PKGLISTS_COMPAT ] && mv -f $ONE_PKGLISTS_COMPAT /tmp/${ONE_PKGLISTS_COMPAT}-OLD
  619. ${MAGEIA2PPM} ${ONE_PKGLISTS_COMPAT}pre $DISTRO_COMPAT_VERSION
  620. mv -f /tmp/mageia2ppm-ppm-temp4 ${ONE_PKGLISTS_COMPAT}
  621. ;;
  622. esac
  623. echo
  624. #rm -f ${ONE_PKGLISTS_COMPAT}pre 2>/dev/null
  625. mv -f ${ONE_PKGLISTS_COMPAT}pre /tmp/ 2>/dev/null
  626. sort --field-separator='|' --key=1 ${ONE_PKGLISTS_COMPAT} > /tmp/$PKGLISTFILE
  627. mv -f /tmp/$PKGLISTFILE ${ONE_PKGLISTS_COMPAT}
  628. done
  629. echo
  630. ####################################
  631. #120825 merge updates into original db files...
  632. if [ "$DBUPDATEFLAG" = "" ];then #121113 empty now means yes.
  633. for ONE_PKGLISTS_COMPAT in $PKGLISTS_COMPAT
  634. do
  635. REPOFIELD="`echo -n "$ONE_PKGLISTS_COMPAT" | rev | cut -f 1 -d '-' | rev`" #ex: main
  636. PKGUPDATES="`echo -n "$PKGLISTS_COMPAT_UPDATES" | tr ' ' '\n' | grep "\-${REPOFIELD}$" | head -n 1`" #ex: Packages-ubuntu-precise_updates-main
  637. cat $PKGUPDATES > /tmp/0setup_xxx1
  638. cat $ONE_PKGLISTS_COMPAT >> /tmp/0setup_xxx1
  639. sync
  640. #want to discard the older package...
  641. sort --unique --field-separator='|' --key=2,2 /tmp/0setup_xxx1 > $ONE_PKGLISTS_COMPAT
  642. #...assumes pkg names remain the same, ex "firefox" (2nd field in db).
  643. mv -f $PKGUPDATES /tmp/$PKGUPDATES #dump -updates db file.
  644. done
  645. fi
  646. sync
  647. #120909 moved down...
  648. if [ "$RUNNINGPUP" = "yes" -a "$DBmethod" = "true" ];then
  649. echo
  650. LANG=${LANGORG} echo "FINISHED"
  651. LANG=${LANGORG} echo "After restarting Puppy Package Manager (PPM),"
  652. LANG=${LANGORG} echo "it will be reading the updated database files."
  653. LANG=${LANGORG} echo -n "Press ENTER key to exit: "
  654. read enditnow
  655. DATE="`date +%Y%m%d `"
  656. echo "$DATE" > /root/.packages/db-date
  657. unset OSETUP_CALLED_FROM
  658. exit
  659. elif [ "$RUNNINGPUP" = "yes" ];then
  660. kill $XPID
  661. Xdialog --title "$(gettext 'PPM database')" --left --msgbox "$(gettext 'PPM database was successfully completed.')" 0 100
  662. DATE="`date +%Y%m%d `"
  663. echo "$DATE" > /root/.packages/db-date
  664. unset OSETUP_CALLED_FROM
  665. exit
  666. fi
  667. echo "This script can now optionally verify that all packages in DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} exist. "
  668. echo "Note, this may take a long time."
  669. echo -e "Press any key then ENTER to bypass check: "
  670. read skipcheck
  671. DATE="`date +%Y%m%d `"
  672. echo "$DATE" > /root/.packages/db-date
  673. if [ -n "$skipcheck" ];then
  674. echo "...finished."
  675. exit
  676. fi
  677. ####################################
  678. #extract all the package names of compat-distro, without version info...
  679. PKGNAMES="`cat $PKGLISTS_COMPAT | cut -f 1,2,3 -d '|'`"
  680. #...on separate lines, ex: gdb-6.8 gdbm-1.8.3 genpower-1.0.5
  681. #check the entries in PKGS_SPECS_TABLE against those in Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}.
  682. #that is, need to verify that pkgs specified in table do actually exist.
  683. echo
  684. echo "Checking that compat-distro pkgs specified in PKGS_SPECS_TABLE actually exist..."
  685. echo "
  686. Checking that compat-distro pkgs specified in PKGS_SPECS_TABLE actually exist..." >> /var/woof/0setup_fail_report_$RUNNINGPUP
  687. FAILCHK="no"
  688. #BINARYPARTNAMES="`echo "$PKGS_SPECS_TABLE" | grep '^yes' | cut -f 3 -d '|' | tr ',' '\n' | grep -v '^-' | tr '\n' ' '`"
  689. #120315 extra field on end to force repo...
  690. FIELDS2345="`echo "$PKGS_SPECS_TABLE" | grep '^yes' | cut -f 2,3,4,5 -d '|' | cut -f 1 -d ' ' | grep -v '|pet:' | tr '\n' ' '`"
  691. for AFIELD2345 in $FIELDS2345
  692. do
  693. ASSIGNFIELD="`echo -n "$AFIELD2345" | cut -f 3 -d '|'`" #120804 ex: exe>dev,dev,doc,nls
  694. AFIELD235="`echo -n "$AFIELD2345" | cut -f 1,2,4 -d '|'`" #120804
  695. if [ "`echo -n "$AFIELD235" | grep '||[a-zA-Z0-9]*:'`" = "" ];then #ex: abiword||wary5:
  696. BINARYPARTNAMES="`echo -n "$AFIELD235" | cut -f 2 -d '|' | tr ',' '\n' | grep -v '^-' | tr '\n' ' '`" #ex: "abiword|abiword0,libabiword|" becomes "abiword0 libabiword"
  697. else
  698. BINARYPARTNAMES="`echo -n "$AFIELD235" | cut -f 1 -d '|'`" #use the generic name.
  699. fi
  700. for ONEBINARYPARTNAME in $BINARYPARTNAMES
  701. do
  702. #ONEBINARYPARTNAME may match multiple pkgs...
  703. #i think that dashes need to be backslashed...
  704. multiPATTERN="`echo -n "$ONEBINARYPARTNAME" | sed -e 's%\\-%\\\\-%g'`"
  705. #may have blob * wildcard, change to reg.expr....
  706. multiPATTERN="`echo -n "$multiPATTERN" | sed -e 's%\\*%.*%g'`"
  707. xPATTERN='|'"$multiPATTERN"'|'
  708. [ "`echo "$PKGNAMES" | grep "$xPATTERN"`" != "" ] && continue #success.
  709. if [ "$ASSIGNFIELD" ];then #120804
  710. #this will find entry in PKGS_SPECS_TABLE like 'yes|apr|apr|exe>dev,dev,doc,nls', where pkg apr-123 does not exist, only apr_DEV-123...
  711. EXEASSIGNED=''
  712. [ "`echo -n "$ASSIGNFIELD" | grep 'exe>dev'`" != "" ] && EXEASSIGNED='dev'
  713. [ "`echo -n "$ASSIGNFIELD" | grep 'exe>null'`" != "" ] && EXEASSIGNED='null'
  714. if [ "$EXEASSIGNED" ];then
  715. xxPATTERN='^'"${ONEBINARYPARTNAME}_DEV"
  716. [ "`echo "$PKGNAMES" | grep "$xxPATTERN"`" != "" ] && continue #success.
  717. fi
  718. #this entry 'yes|perl-digest-sha1|perl-digest-sha1|exe,dev>null,doc>null,nls>null' also only has a _DEV pkg...
  719. DEVASSIGNED=''
  720. [ "`echo -n "$ASSIGNFIELD" | grep 'dev>exe'`" != "" ] && DEVASSIGNED='exe'
  721. if [ "$DEVASSIGNED" = "exe" ];then
  722. xxPATTERN='^'"${ONEBINARYPARTNAME}_DEV"
  723. [ "`echo "$PKGNAMES" | grep "$xxPATTERN"`" != "" ] && continue #success.
  724. fi
  725. fi
  726. #if [ "`echo -n "$ONEBINARYPARTNAME" | grep '[a-z]\\-[0-9]'`" != "" ];then
  727. if [ "`echo -n "$ONEBINARYPARTNAME" | grep '\\*'`" != "" ];then
  728. zPATTERN='^'"$multiPATTERN"
  729. [ "`echo "$PKGNAMES" | grep "$zPATTERN"`" != "" ] && continue #success.
  730. fi
  731. #failure...
  732. echo "FAIL: $ONEBINARYPARTNAME"
  733. echo "FAIL: $ONEBINARYPARTNAME" >> /var/woof/0setup_fail_report_$RUNNINGPUP
  734. FAILCHK="yes"
  735. done
  736. done
  737. if [ "$FAILCHK" = "yes" ];then
  738. echo
  739. echo "Finished, but some failures. You need to fix the above entries in"
  740. echo "PKGS_SPECS_TABLE in file ${DPSFILE}."
  741. echo "Search for suitable packages in these files:"
  742. echo "`echo "$PKG_DOCS_DISTRO_COMPAT" | tr ' ' '\n' | cut -f 3 -d '|'`"
  743. echo "Or, search online. In the case of Debian or Ubuntu, you can search"
  744. echo "at packages.debian.org or packages.ubuntu.com."
  745. echo "After you have fixed PKGS_SPECS_TABLE, run this script again."
  746. echo "
  747. Finished, but some failures. You need to fix the above entries in variable
  748. PKGS_SPECS_TABLE in file ${DPSFILE}.
  749. Search for suitable packages in these files:
  750. `echo "$PKG_DOCS_DISTRO_COMPAT" | tr ' ' '\n' | cut -f 3 -d '|'`
  751. Or, search online. In the case of Debian or Ubuntu, you can search
  752. at packages.debian.org or packages.ubuntu.com.
  753. After you have fixed PKGS_SPECS_TABLE, run this script again." >> /var/woof/0setup_fail_report_$RUNNINGPUP
  754. if [ "$DBmethod" = "false" ];then
  755. kill $XPID
  756. Xdialog --title "$(gettext 'PPM database')" --left --msgbox "$(gettext 'PPM database failed. Chech /var/woof/0setup_fail_report_')$RUNNINGPUP $(gettext 'for details.')" 0 100
  757. fi
  758. unset OSETUP_CALLED_FROM
  759. else
  760. echo
  761. echo "Finished, successful."
  762. echo "...finished, successful." >> /var/woof/0setup_fail_report_$RUNNINGPUP
  763. fi
  764. if [ "$DBmethod" = "true" ]; then
  765. echo
  766. echo "The log of '0setup', as reported above, is saved for future reference."
  767. echo "(In file /var/woof/0setup_fail_report_${RUNNINGPUP})"
  768. echo "In the Woof GUI, tab 'Download dbs', click the 'REPORT' button to"
  769. echo "retrieve this log."
  770. echo -n "Press ENTER key to finish '0setup' script: "
  771. read yepgetout
  772. else
  773. kill $XPID
  774. if [ "$(grep -e 'FAIL|exited|failures' /var/woof/0setup_fail_report_$RUNNINGPUP)" = "" ]; then
  775. Xdialog --title "$(gettext 'PPM database')" --left --msgbox "$(gettext 'PPM databases update was successfully completed.')" 0 100
  776. else
  777. Xdialog --title "$(gettext 'PPM database')" --left --msgbox "$(gettext 'PPM databases update failed. Chech /var/woof/0setup_fail_report_')$RUNNINGPUP $(gettext 'for details.')" 0 100
  778. fi
  779. fi
  780. unset OSETUP_CALLED_FROM
  781. ###END###