0setup 35 KB

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