removepreview.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  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 and petget.
  5. #package to be removed is TREE2, ex TREE2=abiword-1.2.3 (corrresponds to 'pkgname' field in db).
  6. #installed pkgs are recorded in /root/.packages/user-installed-packages, each
  7. #line a standardised database entry:
  8. #pkgname|nameonly|version|pkgrelease|category|size|path|fullfilename|dependencies|description|
  9. #optionally on the end: compileddistro|compiledrelease|repo| (fields 11,12,13)
  10. #If X not running, no GUI windows displayed, removes without question.
  11. #v424 support post-uninstall script for .pet pkgs.
  12. #v424 need info box if user has clicked when no pkgs installed.
  13. #110211 shinobar: was the dependency logic inverted.
  14. #110706 update menu if .desktop file exists.
  15. #111228 if snapmergepuppy running, wait for it to complete.
  16. #120101 01micko: jwm >=547 has -reload, no screen flicker.
  17. #120103 shinobar, bk: improve file deletion when older file in lower layer.
  18. #120107 rerwin: need quotes around some paths in case of space chars.
  19. #120116 rev. 514 introduced icon rendering method which broke -reload at 547. fixed at rev. 574.
  20. #120203 BK: internationalized.
  21. #120323 replace 'xmessage' with 'pupmessage'.
  22. [ "$(cat /var/local/petget/nt_category 2>/dev/null)" != "true" ] && \
  23. [ -f /tmp/remove_pets_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___removepreview.sh
  26. export OUTPUT_CHARSET=UTF-8
  27. [ "$(locale | grep '^LANG=' | cut -d '=' -f 2)" ] && ORIGLANG="$(locale | grep '^LANG=' | cut -d '=' -f 2)"
  28. . /etc/rc.d/PUPSTATE #111228 this has PUPMODE and SAVE_LAYER.
  29. . /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION
  30. . /root/.packages/DISTRO_PKGS_SPECS
  31. DB_pkgname="$TREE2"
  32. #v424 info box, nothing yet installed...
  33. if [ "$DB_pkgname" = "" -a "`cat /root/.packages/user-installed-packages`" = "" ];then #fix for ziggi
  34. /usr/lib/gtkdialog/box_ok "$(gettext 'Puppy Package Manager')" error "$(gettext 'There are no user-installed packages yet, so nothing to uninstall!')"
  35. exit 0
  36. fi
  37. #if [ "$DB_pkgname" = "" ];then #fix for ziggi moved here problem is #2011-12-27 KRG
  38. #exit 0 #clicking an empty line in the gui would have
  39. #fi #thrown the above REM_DIALOG even if pkgs are installed
  40. if [ ! -f /tmp/remove_pets_quietly ] && [ "$DISPLAY" ]; then
  41. . /usr/lib/gtkdialog/box_yesno "$(gettext 'Puppy Package Manager')" "$(gettext "Do you want to uninstall package")" "<b>${DB_pkgname}</b>"
  42. [ "$EXIT" != "yes" ] && exit 0
  43. elif [ ! "$DISPLAY" ]; then
  44. dialog --yesno "$(gettext 'Do you want to uninstall package ')${DB_pkgname}" 0 0
  45. [ $? -ne 0 ] && exit 0
  46. fi
  47. #111228 if snapmergepuppy running, wait for it to complete (see also /usr/local/petget/installpkg.sh)...
  48. #note, inverse true, /sbin/pup_event_frontend_d will not run snapmergepuppy if removepreview.sh running.
  49. if [ $PUPMODE -eq 3 -o $PUPMODE -eq 7 -o $PUPMODE -eq 13 ];then
  50. while [ "`pidof snapmergepuppy`" != "" ];do
  51. sleep 1
  52. done
  53. fi
  54. if [ -f /root/.packages/${DB_pkgname}.files ];then
  55. if [ "$PUP_LAYER" = '/pup_ro2' ]; then #120103 shinobar.
  56. cat /root/.packages/${DB_pkgname}.files |
  57. while read ONESPEC
  58. do
  59. if [ ! -d "$ONESPEC" ];then
  60. #120103 shinobar: better way of doing this, look all lower layers...
  61. Sx=$(ls /initrd/pup_{a,y,ro[0-9]*}"$ONESPEC" 2>/dev/null| grep -v '^/initrd/pup_ro1/')
  62. INAY=$(echo $Sx | grep -E 'pup_a|pup_y')
  63. if [ "$INAY" != "" ]; then
  64. S=$(ls /initrd/pup_{a,y}"$ONESPEC" 2>/dev/null| grep -v '^/initrd/pup_ro1/'| tail -n 1)
  65. else
  66. S=$(ls /initrd/pup_ro{?,??}"$ONESPEC" 2>/dev/null| grep -v '^/initrd/pup_ro1/'| head -n 1)
  67. fi # pup_ro2 - pup_ro99
  68. if [ "$S" ]; then
  69. #the problem is, deleting the file on the top layer places a ".wh" whiteout file,
  70. #that hides the original file. what we want is to remove the installed file, and
  71. #restore the original pristine file...
  72. cp -a --remove-destination "$S" "$ONESPEC" #120103 shinobar.
  73. #120103 apparently for odd# PUPMODEs, save layer may have a lurking old file and/or whiteout...
  74. if [ $PUPMODE -eq 3 -o $PUPMODE -eq 7 -o $PUPMODE -eq 13 ];then
  75. [ -f "/initrd${SAVE_LAYER}${ONESPEC}" ] && rm -f "/initrd${SAVE_LAYER}${ONESPEC}" #normally /pup_ro1
  76. BN="`basename "$ONESPEC"`"
  77. DN="`dirname "$ONESPEC"`"
  78. [ -f "/initrd${SAVE_LAYER}${DN}/.wh.${BN}" ] && rm -f "/initrd${SAVE_LAYER}${DN}/.wh.${BN}"
  79. fi
  80. else
  81. rm -f "$ONESPEC"
  82. fi
  83. fi
  84. done
  85. fi
  86. #do it again, looking for empty directories...
  87. cat /root/.packages/${DB_pkgname}.files |
  88. while read ONESPEC
  89. do
  90. if [ -d "$ONESPEC" ];then
  91. [ "`ls -1 "$ONESPEC"`" = "" ] && rmdir "$ONESPEC" 2>/dev/null #120107
  92. fi
  93. done
  94. ###+++2011-12-27 KRG
  95. else
  96. firstchar=`echo ${DB_pkgname} | cut -c 1`
  97. possiblePKGS=`find /root/.packages -type f -iname "$firstchar*.files"`
  98. possible5=`echo "$possiblePKGS" | head -n5`
  99. count=`echo "$possiblePKGS" | wc -l`
  100. [ ! "$count" ] && count=0
  101. [ ! "$possiblePKGS" ] && possiblePKGS="$(gettext 'No pkgs beginning with') ${firstchar} $(gettext 'found')"
  102. if [ "$count" -le '5' ];then
  103. WARNMSG="$possiblePKGS"
  104. else
  105. WARNMSG="$(gettext 'Found more than 5 pkgs starting with') ${firstchar}.
  106. $(gettext 'The first 5 are')
  107. $possible5"
  108. fi
  109. if [ "$DISPLAY" ];then
  110. /usr/lib/gtkdialog/box_ok "$(gettext 'Puppy package manager')" warning "<b>$(gettext 'No file named') ${DB_pkgname}.files $(gettext 'found in') /root/.packages/ $(gettext 'folder.')</b>" "$0 $(gettext 'refusing cowardly to remove the package.')" " " "<b>$(gettext 'Possible suggestions:')</b> $WARNMSG" "<b>$(gettext 'Possible solution:')</b> $(gettext 'Edit') <i>/root/.packages/user-installed-packages</i> $(gettext 'to match the pkgname') $(gettext 'and start again.')"
  111. rox /root/.packages
  112. geany /root/.packages/user-installed-packages
  113. exit 101
  114. ###+++2011-12-27 KRG
  115. else
  116. dialog --msgbox "$(gettext 'No file named ' ) ${DB_pkgname}.files $(gettext ' found. Refusing cowardly to remove the package. Possible solution: Edit /root/.packages/user-installed-packages and start again.')" 0 0
  117. mp /root/.packages/user-installed-packages
  118. exit 101
  119. fi
  120. fi
  121. if [ "$PUPMODE" = "2" ]; then
  122. #any user-installed deps?...
  123. remPATTERN='^'"$DB_pkgname"'|'
  124. DEP_PKGS="`grep "$remPATTERN" /root/.packages/user-installed-packages | cut -f 9 -d '|' | tr ',' '\n' | grep -v '^\\-' | sed -e 's%^+%%' |cut -f1 -d '&'`" #names-only, one each line.
  125. #131222 do not uninstall if other-installed depend on it...
  126. echo -n '' > /tmp/petget/other-installed-deps
  127. for ADEP in $DEP_PKGS
  128. do
  129. if [ "$(grep ${ADEP} /tmp/pkgs_to_remove)" = "" ]; then
  130. PTN2="|${ADEP}|"
  131. DEPPKG="$(grep "$PTN2" /root/.packages/user-installed-packages | cut -f 1 -d '|')"
  132. [ "$DEPPKG" ] && echo "$DEPPKG" >> /tmp/petget/other-installed-deps
  133. else
  134. echo "go on"
  135. fi
  136. done
  137. if [ -s /tmp/petget/other-installed-deps ];then
  138. OTHERDEPS="$(sort -u /tmp/petget/other-installed-deps | tr '\n' ' ')"
  139. /usr/lib/gtkdialog/box_ok "$(gettext 'Puppy Package Manager')" error "<b>$(gettext 'Cannot uninstall'): <i>${DB_pkgname}</i></b>" "$(gettext 'Sorry, but these other installed packages depend on the package that you want to uninstall'):" "<i>${OTHERDEPS}</i>" "$(gettext 'Aborting uninstall operation.')"
  140. exit 1
  141. fi
  142. #131221 131222
  143. #check install history, so know if can safely uninstall...
  144. REMLIST="${DB_pkgname}"
  145. mkdir -p /tmp/petget
  146. echo -n "" > /tmp/petget/FILECLASHES
  147. echo -n "" > /tmp/petget/CLASHPKGS
  148. grep -v '/$' /root/.packages/${DB_pkgname}.files > /tmp/petget/${DB_pkgname}.filesFILESONLY #/ on end, it is a directory entry.
  149. LATERINSTALLED="$(cat /root/.packages/user-installed-packages | cut -f 1 -d '|' | tr '\n' ' ' | grep -o " ${DB_pkgname} .*" | cut -f 3- -d ' ')"
  150. for ALATERPKG in $LATERINSTALLED
  151. do
  152. if [ -f /audit/${ALATERPKG}DEPOSED.sfs ];then
  153. mkdir /audit/${ALATERPKG}DEPOSED
  154. busybox mount -t squashfs -o loop,ro /audit/${ALATERPKG}DEPOSED.sfs /audit/${ALATERPKG}DEPOSED
  155. FNDFILES="$(cat /tmp/petget/${DB_pkgname}.filesFILESONLY | xargs -I FULLPATHSPEC ls -1 /audit/${ALATERPKG}DEPOSEDFULLPATHSPEC 2>/dev/null | sed -e "s%^/audit/${ALATERPKG}%%")"
  156. if [ "$FNDFILES" ];then
  157. #echo "" >> /tmp/petget/FILECLASHES
  158. #echo "PACKAGE: ${ALATERPKG}" >> /tmp/petget/FILECLASHES
  159. echo "$FNDFILES" >> /tmp/petget/FILECLASHES
  160. echo "${ALATERPKG}" >> /tmp/petget/CLASHPKGS
  161. fi
  162. busybox umount /audit/${ALATERPKG}DEPOSED
  163. rmdir /audit/${ALATERPKG}DEPOSED
  164. fi
  165. done
  166. if [ -s /tmp/petget/CLASHPKGS ];then
  167. #a later-installed package is going to be compromised if uninstall ${DB_pkgname}.
  168. #131222 much simpler...
  169. FILECLASHES="$(sort -u /tmp/petget/FILECLASHES | grep -v '^$')"
  170. rm -rf /tmp/petget/savedfiles 2>/dev/null
  171. mkdir /tmp/petget/savedfiles
  172. echo "$FILECLASHES" |
  173. while read AFILE
  174. do
  175. APATH="$(dirname "$AFILE")"
  176. mkdir -p /tmp/petget/savedfiles"${APATH}"
  177. cp -a -f "${AFILE}" /tmp/petget/savedfiles"${APATH}"/
  178. done
  179. fi
  180. #end 131221 131222
  181. #131230 from here down, use busybox applets only...
  182. export LANG=C
  183. #delete files...
  184. busybox cat /root/.packages/${DB_pkgname}.files | busybox grep -v '/$' | busybox xargs busybox rm -f #/ on end, it is a directory entry.
  185. #do it again, looking for empty directories...
  186. busybox cat /root/.packages/${DB_pkgname}.files |
  187. while read ONESPEC
  188. do
  189. if [ -d "$ONESPEC" ];then
  190. [ "`busybox ls -1 "$ONESPEC"`" = "" ] && busybox rmdir "$ONESPEC" 2>/dev/null #120107
  191. fi
  192. done
  193. #131222 restore files that were deposed when this pkg installed...
  194. if [ -f /audit/${DB_pkgname}DEPOSED.sfs ];then
  195. busybox mkdir -p /audit/${DB_pkgname}DEPOSED
  196. busybox mount -t squashfs -o loop,ro /audit/${DB_pkgname}DEPOSED.sfs /audit/${DB_pkgname}DEPOSED
  197. DIRECTSAVEPATH="/audit/${DB_pkgname}DEPOSED"
  198. #same code as in installpkg.sh... 131230 cp is compiled statically, need full version...
  199. cp -a -f --remove-destination ${DIRECTSAVEPATH}/* / 2> /tmp/petget/install-cp-errlog
  200. busybox sync
  201. #can have a problem if want to replace a folder with a symlink. for example, got this error:
  202. # cp: cannot overwrite directory '/usr/share/mplayer/skins' with non-directory
  203. #3builddistro has this fix... which is a vice-versa situation...
  204. #firstly, the vice-versa, source is a directory, target is a symlink...
  205. CNT=0
  206. while [ -s /tmp/petget/install-cp-errlog ];do
  207. echo -n "" > /tmp/petget/install-cp-errlog2
  208. echo -n "" > /tmp/petget/install-cp-errlog3
  209. busybox cat /tmp/petget/install-cp-errlog | busybox grep 'cannot overwrite non-directory' | busybox tr '[`‘’]' "'" | busybox cut -f 2 -d "'" |
  210. while read ONEDIRSYMLINK #ex: /usr/share/mplayer/skins
  211. do
  212. #adding that extra trailing / does the trick... 131230 full cp...
  213. cp -a -f --remove-destination ${DIRECTSAVEPATH}"${ONEDIRSYMLINK}"/* "${ONEDIRSYMLINK}"/ 2> /tmp/petget/install-cp-errlog2
  214. done
  215. #secondly, which is our mplayer example, source is a symlink, target is a folder...
  216. busybox cat /tmp/petget/install-cp-errlog | busybox grep 'cannot overwrite directory' | busybox grep 'with non-directory' | busybox tr '[`‘’]' "'" | busybox cut -f 2 -d "'" |
  217. while read ONEDIRSYMLINK #ex: /usr/share/mplayer/skins
  218. do
  219. busybox mv -f "${ONEDIRSYMLINK}" "${ONEDIRSYMLINK}"TEMP
  220. busybox rm -rf "${ONEDIRSYMLINK}"TEMP
  221. DIRPATH="$(busybox dirname "${ONEDIRSYMLINK}")"
  222. cp -a -f --remove-destination ${DIRECTSAVEPATH}"${ONEDIRSYMLINK}" "${DIRPATH}"/ 2> /tmp/petget/install-cp-errlog3
  223. done
  224. busybox cat /tmp/petget/install-cp-errlog2 >> /tmp/petget/install-cp-errlog3
  225. busybox cat /tmp/petget/install-cp-errlog3 > /tmp/petget/install-cp-errlog
  226. busybox sync
  227. CNT=`busybox expr $CNT + 1`
  228. [ $CNT -gt 10 ] && break #something wrong, get out.
  229. done
  230. busybox umount /audit/${DB_pkgname}DEPOSED
  231. busybox rm -rf /audit/${DB_pkgname}DEPOSED
  232. busybox rm -f /audit/${DB_pkgname}DEPOSED.sfs
  233. fi
  234. #131222 restore latest files, needed by later-installed packages...
  235. #note, manner in which old files got saved may result in wrong dirs instead of symlinks, hence need fixes below...
  236. if [ -s /tmp/petget/CLASHPKGS ];then
  237. DIRECTSAVEPATH="/tmp/petget/savedfiles"
  238. #same code as in installpkg.sh...
  239. cp -a -f --remove-destination ${DIRECTSAVEPATH}/* / 2> /tmp/petget/install-cp-errlog
  240. busybox sync
  241. #can have a problem if want to replace a folder with a symlink. for example, got this error:
  242. # cp: cannot overwrite directory '/usr/share/mplayer/skins' with non-directory
  243. #3builddistro has this fix... which is a vice-versa situation...
  244. #firstly, the vice-versa, source is a directory, target is a symlink...
  245. CNT=0
  246. while [ -s /tmp/petget/install-cp-errlog ];do
  247. echo -n "" > /tmp/petget/install-cp-errlog2
  248. echo -n "" > /tmp/petget/install-cp-errlog3
  249. busybox cat /tmp/petget/install-cp-errlog | busybox grep 'cannot overwrite non-directory' | busybox tr '[`‘’]' "'" | busybox cut -f 2 -d "'" |
  250. while read ONEDIRSYMLINK #ex: /usr/share/mplayer/skins
  251. do
  252. #adding that extra trailing / does the trick...
  253. cp -a -f --remove-destination ${DIRECTSAVEPATH}"${ONEDIRSYMLINK}"/* "${ONEDIRSYMLINK}"/ 2> /tmp/petget/install-cp-errlog2
  254. done
  255. #secondly, which is our mplayer example, source is a symlink, target is a folder...
  256. busybox cat /tmp/petget/install-cp-errlog | busybox grep 'cannot overwrite directory' | busybox grep 'with non-directory' | busybox tr '[`‘’]' "'" | busybox cut -f 2 -d "'" |
  257. while read ONEDIRSYMLINK #ex: /usr/share/mplayer/skins
  258. do
  259. busybox mv -f "${ONEDIRSYMLINK}" "${ONEDIRSYMLINK}"TEMP
  260. busybox rm -rf "${ONEDIRSYMLINK}"TEMP
  261. DIRPATH="$(dirname "${ONEDIRSYMLINK}")"
  262. cp -a -f --remove-destination ${DIRECTSAVEPATH}"${ONEDIRSYMLINK}" "${DIRPATH}"/ 2> /tmp/petget/install-cp-errlog3
  263. done
  264. busybox cat /tmp/petget/install-cp-errlog2 >> /tmp/petget/install-cp-errlog3
  265. busybox cat /tmp/petget/install-cp-errlog3 > /tmp/petget/install-cp-errlog
  266. busybox sync
  267. CNT=`busybox expr $CNT + 1`
  268. [ $CNT -gt 10 ] && break #something wrong, get out.
  269. done
  270. busybox rm -rf /tmp/petget/savedfiles
  271. busybox rm -f /tmp/petget/CLASHPKGS
  272. busybox rm -f /tmp/petget/FILECLASHES
  273. fi
  274. #end 131220 131222
  275. export LANG="$ORIGLANG"
  276. #131230 ...end need to use busybox applets?
  277. fi
  278. UPDATE_MENUS=''
  279. if [ -f /tmp/remove_pets_quietly ]; then
  280. LEFT=$(cat /tmp/pkgs_left_to_remove | wc -l)
  281. [ "$LEFT" -le 1 ] && UPDATE_MENUS=yes
  282. else
  283. UPDATE_MENUS=yes
  284. fi
  285. if [ "$UPDATE_MENUS" = "yes" ]; then
  286. #fix menu...
  287. #master help index has to be updated...
  288. ##to speed things up, find the help files in the new pkg only...
  289. # /usr/sbin/indexgen.sh #${WKGDIR}/${APKGNAME}
  290. #110706 update menu if .desktop file exists...
  291. if [ -f /root/.packages/${DB_pkgname}.files ];then
  292. if [ "`grep '\.desktop$' /root/.packages/${DB_pkgname}.files`" != "" ];then
  293. #Reconstruct configuration files for JWM, Fvwm95, IceWM...
  294. nohup /usr/sbin/fixmenus
  295. if [ "`pidof jwm`" != "" ];then #120101
  296. JWMVER=`jwm -v|head -n1|cut -d ' ' -f2|cut -d - -f2`
  297. if vercmp $JWMVER lt 574;then #120116 547 to 574.
  298. jwm -restart #screen will flicker.
  299. else
  300. jwm -reload
  301. fi
  302. fi
  303. fi
  304. fi
  305. fi
  306. #what about any user-installed deps...
  307. remPATTERN='^'"$DB_pkgname"'|'
  308. #110211 shinobar: was the dependency logic inverted...
  309. DEP_PKGS="`grep "$remPATTERN" /root/.packages/user-installed-packages | cut -f 9 -d '|' | tr ',' '\n' | grep -v '^\\-' | sed -e 's%^+%%' | cut -f1 -d '&'`"
  310. #remove records of pkg...
  311. rm -f /root/.packages/${DB_pkgname}.files
  312. grep -v "$remPATTERN" /root/.packages/user-installed-packages > /tmp/petget-user-installed-pkgs-rem
  313. cp -f /tmp/petget-user-installed-pkgs-rem /root/.packages/user-installed-packages
  314. #v424 .pet pckage may have post-uninstall script, which was originally named puninstall.sh
  315. #but /usr/local/petget/installpkg.sh moved it to /root/.packages/$DB_pkgname.remove
  316. if [ -f /root/.packages/${DB_pkgname}.remove ];then
  317. nohup /bin/sh /root/.packages/${DB_pkgname}.remove &
  318. sleep 0.2
  319. rm -f /root/.packages/${DB_pkgname}.remove
  320. fi
  321. #remove temp file so main gui window will re-filter pkgs display...
  322. FIRSTCHAR="`echo -n "$DB_pkgname" | cut -c 1 | tr '[A-Z]' '[a-z]'`"
  323. rm -f /tmp/petget_fltrd_repo_${FIRSTCHAR}* 2>/dev/null
  324. rm -f /tmp/petget_fltrd_repo_?${FIRSTCHAR}* 2>/dev/null
  325. [ "`echo -n "$FIRSTCHAR" | grep '[0-9]'`" != "" ] && rm -f /tmp/petget_fltrd_repo_0* 2>/dev/null
  326. #announce any deps that might be removable...
  327. echo -n "" > /tmp/petget-deps-maybe-rem
  328. echo -n "" > /tmp/petget-deps-maybe-remove
  329. cut -f 1,2,10 -d '|' /root/.packages/user-installed-packages |
  330. while read ONEDB
  331. do
  332. ONE_pkgname="`echo -n "$ONEDB" | cut -f 1 -d '|'`"
  333. ONE_nameonly="`echo -n "$ONEDB" | cut -f 2 -d '|'`"
  334. ONE_description="`echo -n "$ONEDB" | cut -f 3 -d '|'`"
  335. opPATTERN='^'"$ONE_nameonly"'$'
  336. [ "`echo "$DEP_PKGS" | grep "$opPATTERN"`" != "" ] && echo "$ONE_pkgname DESCRIPTION: $ONE_description" >> /tmp/petget-deps-maybe-rem && echo "$ONE_pkgname" >> /tmp/petget-deps-maybe-remove
  337. done
  338. EXTRAMSG=""
  339. if [ -s /tmp/petget-deps-maybe-rem ];then
  340. #nah, just list the names, not descriptions...
  341. MAYBEREM="`cat /tmp/petget-deps-maybe-rem | cut -f 1 -d ' ' | tr '\n' ' '` "
  342. EXTRAMSG="<text><label>$(gettext 'Perhaps you do not need these dependencies that you had also installed:')</label></text> <text use-markup=\"true\"><label>\"<b>${MAYBEREM}</b>\"</label></text><text><label>$(gettext "...if you do want to remove them, you will have to do so back on the main window, after clicking the 'Ok' button below (perhaps make a note of the package names on a scrap of paper right now)")</label></text>"
  343. fi
  344. #announce success...
  345. if [ ! -f /tmp/remove_pets_quietly ]; then
  346. export REM_DIALOG="<window title=\"$(gettext 'Puppy Package Manager')\" icon-name=\"gtk-about\">
  347. <vbox>
  348. <pixmap><input file>/usr/share/pixmaps/puppy/dialog-complete.svg</input></pixmap>
  349. <text><label>$(gettext 'Package') '$DB_pkgname' $(gettext 'has been removed.')</label></text>
  350. ${EXTRAMSG}
  351. <hbox>
  352. <button ok></button>
  353. </hbox>
  354. </vbox>
  355. </window>
  356. "
  357. if [ "$DISPLAY" != "" ];then
  358. gtkdialog -p REM_DIALOG
  359. fi
  360. elif [ -s /tmp/petget-deps-maybe-rem ];then
  361. for MAYBEREM in $(cat /tmp/petget-deps-maybe-remove)
  362. do
  363. [ "$(grep $MAYBEREM /tmp/pkgs_to_remove)" = "" ] \
  364. && echo $MAYBEREM >> /tmp/overall_petget-deps-maybe-rem
  365. done
  366. fi
  367. ###+++2011-12-27 KRG
  368. #emitting exitcode for some windowmanager depending on dbus
  369. #popup a message window saying the program stopped unexpectedly
  370. #ie (old) enlightenment
  371. rm -f $HOME/nohup.out
  372. exit 0
  373. ###+++2011-12-27 KRG
  374. ###END###