installpreview.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. #!/bin/sh
  2. #(c) Copyright Barry Kauler 2009, puppylinux.com
  3. #2009 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html).
  4. #called from pkg_chooser.sh
  5. #package to be previewed prior to installation is TREE1 -- inherited from parent.
  6. #/tmp/petget/current-repo-triad has the repository that installing from.
  7. #100821 bug in Lucid 5.1, /tmp/pup_event_sizefreem had two identical lines.
  8. #101221 yaf-splash fix.
  9. #120101 01micko: jwm >=547 has -reload, no screen flicker.
  10. #120116 rev. 514 introduced icon rendering method which broke -reload at 547. fixed at rev. 574.
  11. #120203 BK: internationalized.
  12. #120504 if no pkgs in category, then when click in window in main dlg, comes here with TREE1="".
  13. #120504 select correct repo when have chosen a pkg from multiple-repo list.
  14. #120604 fix for prepended icons field.
  15. #120811 category field now supports sub-category |category;subcategory|, use as icon in ppm main window.
  16. #120827 if pkg already installed, do not examine dependencies (doesn't work).
  17. #120903 ubuntu, have lots pkgs installed, check_deps.sh takes ages, remove for now, need to rewrite in C.
  18. #120904 "examine dependencies" button did not create any /tmp/petget_missing_dbentries-*, workaround.
  19. #120905 better advice if too many deps. 120907 revert.
  20. #120907 max frames increase 5 to 10. Note, precise puppy gave 72 deps for vlc, which would require 10 frames.
  21. #130511 popup warning if a dep in devx but devx not loaded.
  22. [ "$(cat /var/local/petget/nt_category 2>/dev/null)" != "true" ] && \
  23. [ -f /tmp/install_quietly ] && set -x
  24. #; mkdir -p /tmp/PPM_LOGs ; NAME=$(basename "$0"); exec 1>> /tmp/PPM_LOGs/"$NAME".log 2>&1
  25. export TEXTDOMAIN=petget___installpreview.sh
  26. export OUTPUT_CHARSET=UTF-8
  27. [ "$TREE1" = "" ] && exit #120504 nothing to install.
  28. . /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION
  29. . /root/.packages/DISTRO_PKGS_SPECS
  30. if [ ! -f /tmp/install_quietly ]; then
  31. . /usr/lib/gtkdialog/box_splash -close never -text "$(gettext 'Please wait, processing package database files...')" &
  32. X1PID=$!
  33. fi
  34. #ex: TREE1=abiword-1.2.4 (first field in database entry).
  35. DB_FILE=Packages-`cat /tmp/petget/current-repo-triad` #ex: Packages-slackware-12.2-official
  36. tPATTERN='^'"$TREE1"'|'
  37. #120827 'examine dependencies' button does not work if pkg already installed...
  38. EXAMDEPSFLAG='yes'
  39. ttPTN='^'"$TREE1"'|.*ALREADY INSTALLED'
  40. if [ "`grep "$ttPTN" /tmp/petget/filterpkgs.results.post`" != "" ];then #created by postfilterpkgs.sh
  41. EXAMDEPSFLAG='no'
  42. fi
  43. #120504 if findnames.sh searched multiple repos, /tmp/petget/current-repo-triad (set in pkg_chooser.sh) might be wrong...
  44. [ -f /tmp/petget/current-repo-triad.previous ] && rm -f /tmp/petget/current-repo-triad.previous
  45. if [ -f /tmp/petget/filterpkgs.results.post ];then
  46. ALTSEARCHREPO="$(grep "$tPATTERN" /tmp/petget/filterpkgs.results.post | grep '|\[' | cut -f 2 -d '[' | cut -f 1 -d ']')"
  47. [ "$ALTSEARCHREPO" ] && DB_FILE="Packages-${ALTSEARCHREPO}"
  48. #hmmm, other scripts, ex dependencies.sh, will need to have this correct...
  49. if [ "$ALTSEARCHREPO" ];then
  50. mv -f /tmp/petget/current-repo-triad /tmp/petget/current-repo-triad.previous #need to restore old one before exit this script.
  51. echo -n "$ALTSEARCHREPO" > /tmp/petget/current-repo-triad
  52. fi
  53. fi
  54. rm -f /tmp/petget_missing_dbentries-* 2>/dev/null
  55. DB_ENTRY="`grep "$tPATTERN" /root/.packages/$DB_FILE | head -n 1`"
  56. #line format: pkgname|nameonly|version|pkgrelease|category|size|path|fullfilename|dependencies|description|
  57. #optionally on the end: compileddistro|compiledrelease|repo| (fields 11,12,13)
  58. DB_pkgname="`echo -n "$DB_ENTRY" | cut -f 1 -d '|'`"
  59. DB_nameonly="`echo -n "$DB_ENTRY" | cut -f 2 -d '|'`"
  60. DB_version="`echo -n "$DB_ENTRY" | cut -f 3 -d '|'`"
  61. DB_pkgrelease="`echo -n "$DB_ENTRY" | cut -f 4 -d '|'`"
  62. DB_category="`echo -n "$DB_ENTRY" | cut -f 5 -d '|'`"
  63. DB_size="`echo -n "$DB_ENTRY" | cut -f 6 -d '|'`"
  64. DB_path="`echo -n "$DB_ENTRY" | cut -f 7 -d '|'`"
  65. DB_fullfilename="`echo -n "$DB_ENTRY" | cut -f 8 -d '|'`"
  66. DB_dependencies="`echo -n "$DB_ENTRY" | cut -f 9 -d '|'`"
  67. DB_description="`echo -n "$DB_ENTRY" | cut -f 10 -d '|'`"
  68. [ "$DB_description" = "" ] && DB_description="$(gettext 'no description available')"
  69. SIZEFREEM=`cat /tmp/pup_event_sizefreem | head -n 1` #100821 bug in Lucid 5.1, file had two identical lines.
  70. SIZEFREEK=`expr $SIZEFREEM \* 1024`
  71. if [ $DB_size ];then
  72. SIZEMK="`echo -n "$DB_size" | rev | cut -c 1`"
  73. SIZEVAL=`echo -n "$DB_size" | rev | cut -c 2-9 | rev`
  74. SIZEINFO="<text><label>$(gettext 'After installation, this package will occupy') ${SIZEVAL}${SIZEMK}B. $(gettext 'The amount of free space that you have for installation is') ${SIZEFREEM}MB (${SIZEFREEK}KB).</label></text>"
  75. SIZEVALz=`expr $SIZEVAL \/ 3`
  76. SIZEVALz=`expr $SIZEVAL + $SIZEVALz`
  77. SIZEVALx2=`expr $SIZEVALz + 10000`
  78. if [ $SIZEVALx2 -ge $SIZEFREEK ];then
  79. MSGWARN1="${SIZEINFO}<text use-markup=\"true\"><label>\"<b>$(gettext "A general rule-of-thumb is that the free space should be at least the original-package-size plus installed-package-size plus 10MB to allow for sufficient working space during and after installation. It does not look to good, so you had better click the 'Cancel' button")</b> -- $(gettext "note, if you are running Puppy in a mode that has a 'pupsave' file, then the Utility menu has an entry 'Resize personal storage file' that should solve the problem.")\"</label></text>"
  80. else
  81. MSGWARN1="${SIZEINFO}<text use-markup=\"true\"><label>\"<b>$(gettext "...free space looks ok, so click 'Install' button:")</b>\"</label></text>"
  82. fi
  83. else
  84. MSGWARN1="<text use-markup=\"true\"><label>\"<b>$(gettext 'Unfortunately the provider of the package database has not supplied the size of this package when installed. If you are able to see the size of the compressed package, multiple that by 3 to get the approximate installed size. The free available space, which is') ${SIZEFREEM}MB (${SIZEFREEK}KB), $(gettext 'should be at least 4 times greater.')</b>\"</label></text>"
  85. fi
  86. #find missing dependencies...
  87. if [ "$DB_dependencies" = "" ];then
  88. DEPINFO="<text><label>$(gettext 'It seems that all dependencies are already installed. Sometimes though, the dependency information in the database is incomplete, however a check for presence of needed shared libraries will be done after installation.')</label></text>"
  89. else
  90. #find all missing pkgs...
  91. /usr/local/petget/findmissingpkgs.sh "$DB_dependencies"
  92. #...returns /tmp/petget_installed_patterns_all, /tmp/petget_pkg_deps_patterns, /tmp/petget_missingpkgs_patterns
  93. MISSINGDEPS_PATTERNS="`cat /tmp/petget_missingpkgs_patterns`"
  94. #/tmp/petget_missingpkgs_patterns has a list of missing dependencies, format ex:
  95. #|kdebase|
  96. #|kdelibs|
  97. #|mesa|
  98. #|qt|
  99. DEPBUTTON=""
  100. ONLYMSG=""
  101. if [ "$MISSINGDEPS_PATTERNS" = "" ];then
  102. DEPINFO="<text><label>$(gettext 'It seems that all dependencies are already installed. Sometimes though, the dependency information in the database is incomplete, however a check for presence of needed shared libraries will be done after installation.')</label></text>"
  103. else
  104. ONLYMSG=" $(gettext 'ONLY')"
  105. xMISSINGDEPS="`echo "$MISSINGDEPS_PATTERNS" | sed -e 's%|%%g' | tr '\n' ' '`"
  106. if [ "$EXAMDEPSFLAG" != "no" ];then #120828
  107. DEPBUTTON="<button>
  108. <label>$(gettext 'Examine dependencies')</label>
  109. <action>echo \"${TREE1}\" > /tmp/petget_installpreview_pkgname</action>
  110. <action type=\"exit\">BUTTON_EXAMINE_DEPS</action>
  111. </button>"
  112. DEPINFO="<text><label>$(gettext 'Warning, the following dependent packages are missing:')</label></text>
  113. <text use-markup=\"true\"><label>\"<b>${xMISSINGDEPS}</b>\"</label></text>
  114. <text><label>$(gettext "A warning, these dependencies may have other dependencies not necessarily listed here. It is recommended that you click the 'Examine dependencies' button to find all dependencies before installing.")</label></text>
  115. <text use-markup=\"true\"><label>\"<b>$(gettext "Please click 'Examine dependencies' to install") ${TREE1} $(gettext "as well as its dependencies")</b>\"</label></text>"
  116. else
  117. DEPINFO="<text><label>$(gettext 'Warning, the following dependent packages are missing:')</label></text>
  118. <text use-markup=\"true\"><label>\"<b>${xMISSINGDEPS}</b>\"</label></text>"
  119. fi
  120. if [ $DB_size ];then
  121. MSGWARN1="<text><label>$(gettext 'After installation, this package will occupy') ${SIZEVAL}${SIZEMK}B, $(gettext 'however the dependencies will need more space so you really need to find what they will need first.')</label></text>"
  122. else
  123. MSGWARN1="<text><label>$(gettext 'Also, the package database provider has not supplied the installed size of this package, so you will have to try and estimate whether you have enough free space for it (and the dependencies)')</label></text>"
  124. fi
  125. fi
  126. fi
  127. [ ! -f /tmp/install_quietly ] && kill $X1PID || echo
  128. if [ ! -f /tmp/install_quietly ]; then
  129. export PREVIEW_DIALOG="<window title=\"$(gettext 'Puppy Package Manager: preinstall')\" icon-name=\"gtk-about\">
  130. <vbox>
  131. <text><label>$(gettext 'You have chosen to install package') '${TREE1}'. $(gettext 'A short description of this package is:')</label></text>
  132. <text use-markup=\"true\"><label>\"<b>${DB_description}</b>\"</label></text>
  133. ${DEPINFO}
  134. ${MSGWARN1}
  135. <frame>
  136. <hbox>
  137. <text><label>$(gettext 'If you would like more information about') '${TREE1}', $(gettext 'such as what it is for and the dependencies, this button will download and display detailed information:')</label></text>
  138. <button><label>$(gettext 'More info')</label><action>/usr/local/petget/fetchinfo.sh ${TREE1} & </action></button>
  139. </hbox>
  140. </frame>
  141. <hbox>
  142. ${DEPBUTTON}
  143. <button>
  144. <label>$(gettext 'Install') ${TREE1}${ONLYMSG}</label>
  145. <action>echo \"${TREE1}\" > /tmp/petget_installpreview_pkgname</action>
  146. <action type=\"exit\">BUTTON_INSTALL</action>
  147. </button>
  148. <button>
  149. <label>$(gettext 'Download-only')</label>
  150. <action type=\"exit\">BUTTON_PKGS_DOWNLOADONLY</action>
  151. </button>
  152. <button cancel></button>
  153. </hbox>
  154. </vbox>
  155. </window>
  156. "
  157. RETPARAMS="`gtkdialog3 --center --program=PREVIEW_DIALOG`"
  158. else
  159. if [ -f /tmp/download_only_pet_quietly ]; then
  160. RETPARAMS='EXIT="BUTTON_PKGS_DOWNLOADONLY"'
  161. elif [ "$MISSINGDEPS_PATTERNS" != "" ];then
  162. RETPARAMS='EXIT="BUTTON_EXAMINE_DEPS"'
  163. elif [ -f /tmp/download_pets_quietly ]; then
  164. RETPARAMS='EXIT="BUTTON_PKGS_DOWNLOADONLY"'
  165. else
  166. RETPARAMS='EXIT="BUTTON_INSTALL"'
  167. fi
  168. fi
  169. eval "$RETPARAMS"
  170. if [ "$EXIT" != "BUTTON_INSTALL" -a "$EXIT" != "BUTTON_EXAMINE_DEPS" -a "$EXIT" != "BUTTON_PKGS_DOWNLOADONLY" ];then
  171. [ -f /tmp/petget/current-repo-triad.previous ] && mv -f /tmp/petget/current-repo-triad.previous /tmp/petget/current-repo-triad
  172. exit
  173. fi
  174. #DB_ENTRY has the database entry of the main package that we want to install.
  175. #DB_FILE has the name of the database file that has the main entry, ex: Packages-slackware-12.2-slacky
  176. if [ "$EXIT" = "BUTTON_EXAMINE_DEPS" ];then
  177. /usr/local/petget/dependencies.sh
  178. [ $? -ne 0 ] && exec /usr/local/petget/installpreview.sh #reenter.
  179. #returns with /tmp/petget_missing_dbentries-* has the database entries of missing deps.
  180. #the '*' on the end is the repo-file name, ex: Packages-slackware-12.2-slacky
  181. #120904
  182. FNDMISSINGDBENTRYFILE="`ls -1 /tmp/petget_missing_dbentries-* 2>/dev/null`"
  183. if [ "$FNDMISSINGDBENTRYFILE" = "" -a ! -f /tmp/install_quietly ];then
  184. . pupdialog --title "$(gettext 'PPM: examine dependencies')" --background LightYellow --msgbox "$(gettext 'There seem to be no missing dependencies.')
  185. $(gettext 'Note: if the previous window indicated that there are missing dependencies, they were not found. Sometimes, a package database lists a dependency that does not actually exist anymore and is not required.')" 0 0
  186. exec /usr/local/petget/installpreview.sh #reenter.
  187. fi
  188. #130511 popup warning if a dep in devx but devx not loaded...
  189. if ! which gcc; then
  190. NEEDGCC="$(cat /tmp/petget_missing_dbentries-* | grep -E '\|gcc\||\|gcc_dev_DEV\|' | cut -f 1 -d '|')"
  191. if [ "$NEEDGCC" ];then
  192. rm -f /tmp/petget_installed_patterns_system #see pkg_chooser.sh
  193. #create a separate process for the popup, with delay...
  194. DEVXNAME="devx_${DISTRO_FILE_PREFIX}_${DISTRO_VERSION}.sfs"
  195. echo "#!/bin/sh
  196. sleep 3
  197. . pupdialog --background pink --colors --ok-label \"$(gettext 'OK')\" --backtitle \"$(gettext 'WARNING: devx not installed')\" --msgbox \"$(gettext 'Package:') \Zb${TREE1}\ZB
  198. $(gettext "This package has dependencies that are in the 'devx' SFS file, which is Puppy's C/C++/Vala/Genie/BaCon mega-package, a complete compiling environment.")
  199. $(gettext 'The devx file is named:') \Zb${DEVXNAME}\ZB
  200. $(gettext "Please cancel installation, close the Puppy Package Manager, then click the \Zbinstall\ZB icon on the desktop and install the devx SFS file first.")\" 0 0" > /tmp/petget_devx_popup.sh #'geany
  201. chmod 755 /tmp/petget_devx_popup.sh
  202. /tmp/petget_devx_popup.sh &
  203. fi
  204. fi
  205. #compose pkgs into checkboxes...
  206. MAIN_REPO="`echo "$DB_FILE" | cut -f 2-9 -d '-'`"
  207. MAINPKG_NAME="`echo "$DB_ENTRY" | cut -f 1 -d '|'`"
  208. MAINPKG_SIZE="`echo "$DB_ENTRY" | cut -f 6 -d '|'`"
  209. MAINPKG_DESCR="`echo "$DB_ENTRY" | cut -f 10 -d '|'`"
  210. MAIN_CHK="<checkbox><default>true</default><label>${MAINPKG_NAME} SIZE: ${MAINPKG_SIZE}B DESCRIPTION: ${MAINPKG_DESCR}</label><variable>CHECK_PKG_${MAIN_REPO}_${MAINPKG_NAME}</variable></checkbox>"
  211. INSTALLEDSIZEK=0
  212. [ "$MAINPKG_SIZE" != "" ] && INSTALLEDSIZEK=`echo "$MAINPKG_SIZE" | rev | cut -c 2-10 | rev`
  213. #making up the dependencies into tabs, need limit of 8 per tab...
  214. #also limit to 6 tabs (gedit is way beyond this!)...
  215. echo -n "" > /tmp/petget_moreframes
  216. echo -n "" > /tmp/petget_tabs
  217. echo "0" > /tmp/petget_frame_cnt
  218. DEP_CNT=0
  219. ONEREPO=""
  220. for ONEDEPSLIST in `ls -1 /tmp/petget_missing_dbentries-*`
  221. do
  222. ONEREPO_PREV="$ONEREPO"
  223. ONEREPO="`echo "$ONEDEPSLIST" | grep -o 'Packages.*' | sed -e 's%Packages\\-%%'`"
  224. FRAME_CNT=`cat /tmp/petget_frame_cnt`
  225. if [ "$ONEREPO_PREV" != "" ];then #next repo, so start a new tab.
  226. DEP_CNT=0
  227. FRAME_CNT=`expr $FRAME_CNT + 1`
  228. echo "$FRAME_CNT" > /tmp/petget_frame_cnt
  229. #w017 bugfix, prevent double frame closure...
  230. [ "`cat /tmp/petget_moreframes | tail -n 1 | grep '</frame>$'`" = "" ] && echo "</frame>" >> /tmp/petget_moreframes
  231. fi
  232. cat $ONEDEPSLIST |
  233. while read ONELIST
  234. do
  235. DEP_NAME="`echo "$ONELIST" | cut -f 1 -d '|'`"
  236. DEP_SIZE="`echo "$ONELIST" | cut -f 6 -d '|'`"
  237. DEP_DESCR="`echo "$ONELIST" | cut -f 10 -d '|'`"
  238. DEP_CNT=`expr $DEP_CNT + 1`
  239. case $DEP_CNT in
  240. 1)
  241. echo -n "<frame REPOSITORY: ${ONEREPO}>" >> /tmp/petget_moreframes
  242. echo -n "Dependencies|" >> /tmp/petget_tabs
  243. echo -n "<checkbox><default>true</default><label>${DEP_NAME} SIZE: ${DEP_SIZE}B DESCRIPTION: ${DEP_DESCR}</label><variable>CHECK_PKG_${ONEREPO}_${DEP_NAME}</variable></checkbox>" >> /tmp/petget_moreframes
  244. ;;
  245. 8)
  246. FRAME_CNT=`cat /tmp/petget_frame_cnt`
  247. FRAME_CNT=`expr $FRAME_CNT + 1`
  248. if [ $FRAME_CNT -gt 10 ];then #120907
  249. echo -n "<text use-markup=\"true\"><label>\"<b>$(gettext 'SORRY! Too many dependencies, list truncated. Suggest click Cancel button and install some deps first.')</b>\"</label></text>" >> /tmp/petget_moreframes #120907
  250. else
  251. echo -n "<checkbox><default>true</default><label>${DEP_NAME} SIZE: ${DEP_SIZE}B DESCRIPTION: ${DEP_DESCR}</label><variable>CHECK_PKG_${ONEREPO}_${DEP_NAME}</variable></checkbox>" >> /tmp/petget_moreframes
  252. fi
  253. echo "</frame>" >> /tmp/petget_moreframes
  254. DEP_CNT=0
  255. echo "$FRAME_CNT" > /tmp/petget_frame_cnt
  256. ;;
  257. *)
  258. echo -n "<checkbox><default>true</default><label>${DEP_NAME} SIZE: ${DEP_SIZE}B DESCRIPTION: ${DEP_DESCR}</label><variable>CHECK_PKG_${ONEREPO}_${DEP_NAME}</variable></checkbox>" >> /tmp/petget_moreframes
  259. ;;
  260. esac
  261. [ $FRAME_CNT -gt 10 ] && break #too wide! 120907
  262. ADDSIZEK=0
  263. [ "$DEP_SIZE" != "" ] && ADDSIZEK=`echo "$DEP_SIZE" | rev | cut -c 2-10 | rev`
  264. INSTALLEDSIZEK=`expr $INSTALLEDSIZEK + $ADDSIZEK`
  265. echo "$INSTALLEDSIZEK" > /tmp/petget_installedsizek
  266. done
  267. INSTALLEDSIZEK=`cat /tmp/petget_installedsizek`
  268. FRAME_CNT=`cat /tmp/petget_frame_cnt`
  269. [ $FRAME_CNT -gt 10 ] && break #too wide! 120907
  270. done
  271. TABS="`cat /tmp/petget_tabs`"
  272. MOREFRAMES="`cat /tmp/petget_moreframes`"
  273. #make sure last frame has closed...
  274. [ "`echo "$MOREFRAMES" | tail -n 1 | grep '</frame>$'`" = "" ] && MOREFRAMES="${MOREFRAMES}</frame>"
  275. INSTALLEDSIZEM=`expr $INSTALLEDSIZEK \/ 1024`
  276. MSGWARN2="$(gettext "If that looks like enough free space, go ahead and click the 'Install' button...")"
  277. testSIZEK=`expr $INSTALLEDSIZEK \/ 3`
  278. testSIZEK=`expr $INSTALLEDSIZEK + $testSIZEK`
  279. testSIZEK=`expr $testSIZEK + 8000`
  280. [ $testSIZEK -gt $SIZEFREEK ] && MSGWARN2="$(gettext "Not too good! recommend that you make more space before installing -- see 'Resize personal storage file' in the 'Utility' menu.")"
  281. if [ ! -f /tmp/install_quietly ]; then
  282. export DEPS_DIALOG="<window title=\"$(gettext 'Puppy Package Manager: dependencies')\" icon-name=\"gtk-about\">
  283. <vbox>
  284. <frame REPOSITORY: ${MAIN_REPO}>
  285. ${MAIN_CHK}
  286. </frame>
  287. <notebook labels=\"${TABS}\">
  288. ${MOREFRAMES}
  289. </notebook>
  290. <hbox>
  291. <text><label>$(gettext "Sometimes Puppy's automatic dependency checking comes up with a list that may include packages that don't really need to be installed, or are already installed under a different name. If uncertain, just accept them all, but if you spot one that does not need to be installed, then un-tick it.")</label></text>
  292. <text><label>$(gettext 'Puppy usually avoids listing the same package more than once if it exists in two or more repositories. However, if the same package is listed twice, choose the one that seems to be most appropriate.')</label></text>
  293. </hbox>
  294. <hbox>
  295. <vbox>
  296. <text><label>$(gettext 'Click to see the hierarchy of the dependencies:')</label></text>
  297. <hbox>
  298. <button>
  299. <label>$(gettext 'View hierarchy')</label>
  300. <action>/usr/local/bin/defaulttextviewer /tmp/petget_deps_visualtreelog & </action>
  301. </button>
  302. </hbox>
  303. </vbox>
  304. <text><label>\" \"</label></text>
  305. <text use-markup=\"true\"><label>\"<b>$(gettext 'If all of the above packages are selected, the total installed size will be') ${INSTALLEDSIZEK}KB (${INSTALLEDSIZEM}MB). $(gettext 'The free space available for installation is') ${SIZEFREEK}KB (${SIZEFREEM}MB). ${MSGWARN2}</b>\"</label></text>
  306. </hbox>
  307. <hbox>
  308. <button>
  309. <label>$(gettext 'Download-only selected packages')</label>
  310. <action type=\"exit\">BUTTON_PKGS_DOWNLOADONLY</action>
  311. </button>
  312. <button>
  313. <label>$(gettext 'Download-and-install selected packages')</label>
  314. <action type=\"exit\">BUTTON_PKGS_INSTALL</action>
  315. </button>
  316. <button cancel></button>
  317. </hbox>
  318. </vbox>
  319. </window>
  320. "
  321. RETPARAMS="`gtkdialog3 --center --program=DEPS_DIALOG`"
  322. else
  323. if [ ! -f /tmp/download_pets_quietly ]; then
  324. xEXIT="BUTTON_PKGS_INSTALL"
  325. else
  326. xEXIT="BUTTON_PKGS_DOWNLOADONLY"
  327. fi
  328. DEPS_TOINSTALL=$(sed 's/<variable>/\n/g' /tmp/petget_moreframes \
  329. |grep ^CHECK_PKG_ | cut -f1 -d '<' | sed 's/$/=\"true\"/')
  330. PKG_TOINSTALL=CHECK_PKG_${MAIN_REPO}_${MAINPKG_NAME}="true"
  331. RETPARAMS="$DEPS_TOINSTALL
  332. $PKG_TOINSTALL
  333. EXIT=$xEXIT"
  334. [ "$DEPS_TOINSTALL" != "" ] && echo "$DEPS_TOINSTALL" | cut -f 1 -d '=' \
  335. | cut -f 4-10 -d '_' >> /tmp/pkgs_to_install_done
  336. rm -f /tmp/petget_moreframes
  337. fi
  338. #example if 'Install' button clicked:
  339. #CHECK_PKG_slackware-12.2-official_libtermcap-1.2.3="true"
  340. #CHECK_PKG_slackware-12.2-official_pygtk-2.12.1="true"
  341. #CHECK_PKG_slackware-12.2-slacky_beagle-0.3.9="true"
  342. #CHECK_PKG_slackware-12.2-slacky_libgdiplus-2.0="true"
  343. #CHECK_PKG_slackware-12.2-slacky_libgdiplus-2.2="true"
  344. #CHECK_PKG_slackware-12.2-slacky_mono-2.2="true"
  345. #CHECK_PKG_slackware-12.2-slacky_monodoc-2.0="true"
  346. #EXIT="BUTTON_PKGS_INSTALL"
  347. if [ "`echo "$RETPARAMS" | grep '^EXIT' | grep -E 'BUTTON_PKGS_INSTALL|BUTTON_PKGS_DOWNLOADONLY'`" != "" ];then
  348. #remove any unticked pkgs from the list...
  349. for ONECHK in `echo "$RETPARAMS" | grep '^CHECK_PKG_' | grep '"false"' | tr '\n' ' '`
  350. do
  351. ONEREPO="`echo -n "$ONECHK" | cut -f 1 -d '=' | cut -f 3 -d '_'`" #ex: slackware-12.2-slacky
  352. ONEPKG="`echo -n "$ONECHK" | cut -f 1 -d '=' | cut -f 4-9 -d '_'`" #ex: libtermcap-1.2.3
  353. opPATTERN='^'"$ONEPKG"'|'
  354. grep -v "$opPATTERN" /tmp/petget_missing_dbentries-Packages-${ONEREPO} > /tmp/petget_tmp
  355. mv -f /tmp/petget_tmp /tmp/petget_missing_dbentries-Packages-${ONEREPO}
  356. done
  357. else
  358. [ -f /tmp/petget/current-repo-triad.previous ] && mv -f /tmp/petget/current-repo-triad.previous /tmp/petget/current-repo-triad #120504
  359. exit
  360. fi
  361. fi
  362. #come here, want to install pkg(s)...
  363. #DB_ENTRY has the database entry of the main package that we want to install.
  364. #DB_FILE has the name of the database file that has the main entry, ex: Packages-slackware-12.2-slacky
  365. #TREE1 is name of main pkg, ex: abiword-1.2.3
  366. #check to see if main pkg entry already in install-lists...
  367. touch /tmp/petget_missing_dbentries-${DB_FILE} #create if doesn't exist.
  368. mPATTERN='^'"$TREE1"'|'
  369. if [ "`grep "$mPATTERN" /tmp/petget_missing_dbentries-${DB_FILE}`" = "" ];then
  370. echo "$DB_ENTRY" >> /tmp/petget_missing_dbentries-${DB_FILE}
  371. fi
  372. #now do the actual install...
  373. PASSEDPRM=""
  374. [ "`echo "$RETPARAMS" | grep '^EXIT' | grep 'BUTTON_PKGS_DOWNLOADONLY'`" != "" ] && PASSEDPRM="DOWNLOADONLY" && touch /tmp/manual_pkg_download
  375. /usr/local/petget/downloadpkgs.sh $PASSEDPRM
  376. if [ $? -ne 0 ];then
  377. [ -f /tmp/petget/current-repo-triad.previous ] && mv -f /tmp/petget/current-repo-triad.previous /tmp/petget/current-repo-triad #120504
  378. exit 1
  379. fi
  380. [ "$PASSEDPRM" = "DOWNLOADONLY" ] && exit
  381. if [ -f /tmp/install_pets_quietly ]; then
  382. LEFT=$(cat /tmp/pkgs_left_to_install | wc -l)
  383. [ "$LEFT" -le 1 ] && UPDATE_MENUS=yes
  384. else
  385. UPDATE_MENUS=yes
  386. fi
  387. if [ "$UPDATE_MENUS" = "yes" ]; then
  388. #w482 adjust msg as appropriate, restart jwm and update menu if required...
  389. INSTALLEDCAT="menu" #any string.
  390. [ "`cat /tmp/petget-installed-pkgs-log | grep -o 'CATEGORY' | grep -v 'none'`" = "" ] && INSTALLEDCAT="none"
  391. RESTARTMSG="$(gettext 'Please wait, updating help page and menu...')"
  392. if [ "`pidof jwm`" != "" ];then #120101
  393. JWMVER=`jwm -v|head -n1|cut -d ' ' -f2|cut -d - -f2`
  394. if vercmp $JWMVER lt 574;then #120116 introduced rev 547, but 574 fixes -reload.
  395. RESTARTMSG="$(gettext 'Please wait, updating help page and menu (the screen will flicker!)...')"
  396. fi
  397. fi
  398. [ "$INSTALLEDCAT" = "none" ] && RESTARTMSG="$(gettext 'Please wait, updating help page...')"
  399. if [ ! -f /tmp/install_quietly ]; then
  400. /usr/lib/gtkdialog/box_splash -text "${RESTARTMSG}" &
  401. X3PID=$!
  402. fi
  403. fi
  404. #w091019 update image cache...
  405. iUPDATE='no'
  406. for iONE in `cat /tmp/petget_missing_dbentries-* | cut -f 1 -d '|' | tr '\n' ' '`
  407. do
  408. if [ -f /root/.packages/${iONE}.files ]; then
  409. [ "`grep 'usr/share/icons/hicolor' /root/.packages/${iONE}.files`" != "" ] \
  410. && echo yes >> /tmp/iUPDATE
  411. fi
  412. done
  413. if [ "$UPDATE_MENUS" = "yes" ]; then
  414. if [ "$(grep yes /tmp/iUPDATE)" != "" ]; then \
  415. gtk-update-icon-cache -f /usr/share/icons/hicolor/
  416. rm -f /tmp/iUPDATE
  417. fi
  418. fi
  419. #Reconstruct configuration files for JWM, Fvwm95, IceWM...
  420. if [ "$UPDATE_MENUS" = "yes" -a "$INSTALLEDCAT" != "none" ];then
  421. nohup /usr/sbin/fixmenus
  422. if [ "`pidof jwm`" != "" ];then #120101
  423. if vercmp $JWMVER lt 574;then #120116 547 to 574.
  424. jwm -restart #w482
  425. else
  426. jwm -reload
  427. fi
  428. fi
  429. fi
  430. [ ! -f /tmp/install_quietly ] && kill $X3PID || echo
  431. #120905 restore...
  432. #120903 ubuntu, have lots pkgs installed, this takes ages. remove for now, need to rewrite in C...
  433. #check any missing shared libraries...
  434. PKGS="`cat /tmp/petget_missing_dbentries-* | cut -f 1 -d '|' | tr '\n' '|'`"
  435. /usr/local/petget/check_deps.sh $PKGS
  436. [ -f /tmp/petget/current-repo-triad.previous ] && mv -f /tmp/petget/current-repo-triad.previous /tmp/petget/current-repo-triad #120504
  437. rm -f nohup.out 2>/dev/null
  438. ###END###