pkg_chooser.sh 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. #!/bin/bash
  2. #(c) Copyright Barry Kauler 2009, puppylinux.com
  3. #2009 Lesser GPL licence v2 (/usr/share/doc/legal/lgpl-2.1.txt).
  4. #The Puppy Package Manager main GUI window.
  5. #v424 reintroduce the 'ALL' category, for ppup build only.
  6. #v425 enable ENTER key for find box.
  7. #100116 add quirky repo at ibiblio. 100126: bugfixes.
  8. #100513 reintroduce the 'ALL' category for quirky (t2).
  9. #100903 handle puppy-wary5 repo.
  10. #100911 handle puppy-lucid repo.
  11. #101126 prevent 'puppy-quirky' radiobutton first for quirky 1.4 (based on wary5 pkgs).
  12. #101129 checkboxes for show EXE DEV DOC NLS.
  13. #101205 bugfix for: make sure first radiobutton matches list of pkgs.
  14. #110118 alternate User Interfaces. see also configure.sh.
  15. #110505 support sudo for non-root user.
  16. #110706 fix for deps checking.
  17. #120203 BK: internationalized.
  18. #120327 sometimes the selected repo radiobutton did not match listed packages at startup.
  19. #120504 /tmp/petget_filterversion renamed to /tmp/petget/current-repo-triad
  20. #120504 some files moved into /tmp/petget
  21. #120504b improved separation of dev,doc,nls,exe, enhanced ubuntu,debian pkg support.
  22. #120515 common code from pkg_chooser.sh, findnames.sh, filterpkgs.sh, extracted to /usr/local/petget/postfilterpkgs.sh.
  23. #120527 change gtkdialog3 to gtkdialog4. icon patterns for postfilterpkgs.sh.
  24. #120529 ui may show app thumbnail icons.
  25. #120603 /root/.packages/user-installed-packages missing at first boot.
  26. #120515 gentoo build.
  27. #120811 category field now supports sub-category |category;subcategory|, use as icon in ppm main window.
  28. #120822 in precise puppy have a pet 'cups' instead of the ubuntu debs. the latter are various pkgs, including 'libcups2'. we don't want libcups2 showing up as a missing dependency, so have to screen these alternative names out. see also findmissingpkgs.sh.
  29. #120831 simplify repos radiobuttons. fixes a bug, when make selection in setup wasn't same in main window.
  30. #120903 bugfix for 120831. 120905 fix window too wide.
  31. #121125 offer to download a Service Pack, if available.
  32. #130330 GUI filter. see also ui_Classic, ui_Ziggy, filterpkgs.sh.
  33. #130331 more GUI filter options. See also filterpkgs.sh.
  34. #130511 need to include devx-only-installed-packages, if loaded.
  35. /usr/local/petget/service_pack.sh & #121125 offer download Service Pack.
  36. export TEXTDOMAIN=petget___pkg_chooser.sh
  37. export OUTPUT_CHARSET=UTF-8
  38. [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
  39. #export LANG=C
  40. mkdir -p /tmp/petget #120504
  41. mkdir -p /var/local/petget
  42. . /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION
  43. . /root/.packages/DISTRO_PKGS_SPECS
  44. . /root/.packages/PKGS_MANAGEMENT #has PKG_REPOS_ENABLED, PKG_NAME_ALIASES
  45. #120811 removed...
  46. ##120527 need these patterns in postfilterpkgs.sh...
  47. ##the awk stuff sorts the line by length of line, longer lines first. if only one char on line, append ^ ...
  48. ##(fallback, any pkgs starting with 'k' are kde apps, or 'g' are gnome apps). also append '^' for 2-char lines...
  49. #ICONPTNS="$(ls -1 /usr/share/icons/hicolor/16x16/apps | grep 'xpm$' | sed -e 's%\.xpm$%%' | awk '{print length, $0}' | sort -rn | awk '{$1=""; print $0 }' | sed -e 's%^ %%' | sed -r -e 's%(^[a-z][a-z]$)%^\1%' | sed -r -e 's%(^[a-z]$)%^\1%')"
  50. #echo "$ICONPTNS" > /tmp/petget/postfilter_icon_ptns
  51. ##echo -e 'perl\npython\ntcl\nmail\nkde\nqt\nQt\ndbus\ndb\n' >> /tmp/petget/postfilter_icon_ptns
  52. #120529 app icons
  53. touch /root/.packages/user-installed-packages #120603 missing at first boot.
  54. #120811 removed...
  55. #if [ -f /var/local/petget/flg_appicons ];then
  56. # FLG_APPICONS="`cat /var/local/petget/flg_appicons`"
  57. #else
  58. # #test if pet installed with set of 16x16 app icons...
  59. # [ "`grep 'icons_puppy_app' /root/.packages/woof-installed-packages /root/.packages/user-installed-packages`" != "" ] && FLG_APPICONS='true'
  60. #fi
  61. #[ "$FLG_APPICONS" = "" ] && FLG_APPICONS='false'
  62. #echo -n "$FLG_APPICONS" > /var/local/petget/flg_appicons
  63. #101129 choose to display EXE, DEV, DOC, NLS pkgs... note, this code-block is also in findnames.sh and filterpkgs.sh...
  64. DEF_CHK_EXE='true'
  65. DEF_CHK_DEV='false'
  66. DEF_CHK_DOC='false'
  67. DEF_CHK_NLS='false'
  68. [ -e /var/local/petget/postfilter_EXE ] && DEF_CHK_EXE="`cat /var/local/petget/postfilter_EXE`"
  69. [ -e /var/local/petget/postfilter_DEV ] && DEF_CHK_DEV="`cat /var/local/petget/postfilter_DEV`"
  70. [ -e /var/local/petget/postfilter_DOC ] && DEF_CHK_DOC="`cat /var/local/petget/postfilter_DOC`"
  71. [ -e /var/local/petget/postfilter_NLS ] && DEF_CHK_NLS="`cat /var/local/petget/postfilter_NLS`"
  72. #120515 the script /usr/local/petget/postfilterpkgs.sh handles checkbox actions, is called from ui_Ziggy and ui_Classic.
  73. #finds all user-installed pkgs and formats ready for display...
  74. /usr/local/petget/finduserinstalledpkgs.sh #writes to /tmp/installedpkgs.results
  75. #130511 need to include devx-only-installed-packages, if loaded...
  76. #note, this code block also in check_deps.sh.
  77. if which gcc;then
  78. cp -f /root/.packages/woof-installed-packages /tmp/ppm-layers-installed-packages
  79. cat /root/.packages/devx-only-installed-packages >> /tmp/ppm-layers-installed-packages
  80. sort -u /tmp/ppm-layers-installed-packages > /root/.packages/layers-installed-packages
  81. else
  82. cp -f /root/.packages/woof-installed-packages /root/.packages/layers-installed-packages
  83. fi
  84. #100711 moved from findmissingpkgs.sh... 130511 rename woof-installed-packages to layers-installed-packages...
  85. if [ ! -f /tmp/petget_installed_patterns_system ];then
  86. INSTALLED_PATTERNS_SYS="`cat /root/.packages/layers-installed-packages | cut -f 2 -d '|' | sed -e 's%^%|%' -e 's%$%|%' -e 's%\\-%\\\\-%g'`"
  87. echo "$INSTALLED_PATTERNS_SYS" > /tmp/petget_installed_patterns_system
  88. #PKGS_SPECS_TABLE also has system-installed names, some of them are generic combinations of pkgs...
  89. INSTALLED_PATTERNS_GEN="`echo "$PKGS_SPECS_TABLE" | grep '^yes' | cut -f 2 -d '|' | sed -e 's%^%|%' -e 's%$%|%' -e 's%\\-%\\\\-%g'`"
  90. echo "$INSTALLED_PATTERNS_GEN" >> /tmp/petget_installed_patterns_system
  91. #120822 in precise puppy have a pet 'cups' instead of the ubuntu debs. the latter are various pkgs, including 'libcups2'.
  92. #we don't want libcups2 showing up as a missing dependency, so have to screen these alternative names out...
  93. case $DISTRO_BINARY_COMPAT in
  94. ubuntu|debian|raspbian)
  95. #for 'cups' pet, we want to create a pattern '/cups|' so can locate all debs with that DB_path entry '.../cups'
  96. #INSTALLED_PTNS_SYS_PET="`grep '\.pet|' /root/.packages/layers-installed-packages | cut -f 2 -d '|' | sed -e 's%^%/%' -e 's%$%|%' -e 's%\\-%\\\\-%g'`"
  97. INSTALLED_PTNS_PET="$(grep '\.pet|' /root/.packages/layers-installed-packages | cut -f 2 -d '|' | sed -e 's%^%/%' -e 's%$%|%' -e 's%\-%\\-%g')"
  98. if [ "$INSTALLED_PTNS_PET" != "/|" ];then
  99. echo "$INSTALLED_PTNS_PET" > /tmp/petget/installed_ptns_pet
  100. INSTALLED_ALT_NAMES="$(grep --no-filename -f /tmp/petget/installed_ptns_pet /root/.packages/Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}-* | cut -f 2 -d '|')"
  101. if [ "$INSTALLED_ALT_NAMES" ];then
  102. INSTALLED_ALT_PTNS="$(echo "$INSTALLED_ALT_NAMES" | sed -e 's%^%|%' -e 's%$%|%' -e 's%\-%\\-%g')"
  103. echo "$INSTALLED_ALT_PTNS" >> /tmp/petget_installed_patterns_system
  104. fi
  105. fi
  106. ;;
  107. esac
  108. sort -u /tmp/petget_installed_patterns_system > /tmp/petget_installed_patterns_systemx
  109. mv -f /tmp/petget_installed_patterns_systemx /tmp/petget_installed_patterns_system
  110. fi
  111. #100711 this code repeated in findmissingpkgs.sh...
  112. cp -f /tmp/petget_installed_patterns_system /tmp/petget_installed_patterns_all
  113. if [ -s /root/.packages/user-installed-packages ];then
  114. INSTALLED_PATTERNS_USER="`cat /root/.packages/user-installed-packages | cut -f 2 -d '|' | sed -e 's%^%|%' -e 's%$%|%' -e 's%\\-%\\\\-%g'`"
  115. echo "$INSTALLED_PATTERNS_USER" >> /tmp/petget_installed_patterns_all
  116. #120822 find alt names in compat-distro pkgs, for user-installed pets...
  117. case $DISTRO_BINARY_COMPAT in
  118. ubuntu|debian|raspbian)
  119. #120904 bugfix, was very slow...
  120. MODIF1=`stat --format=%Y /root/.packages/user-installed-packages` #seconds since epoch.
  121. MODIF2=0
  122. [ -f /var/local/petget/installed_alt_ptns_pet_user ] && MODIF2=`stat --format=%Y /var/local/petget/installed_alt_ptns_pet_user`
  123. if [ $MODIF1 -gt $MODIF2 ];then
  124. INSTALLED_PTNS_PET="$(grep '\.pet|' /root/.packages/user-installed-packages | cut -f 2 -d '|')"
  125. if [ "$INSTALLED_PTNS_PET" != "" ];then
  126. xINSTALLED_PTNS_PET="$(echo "$INSTALLED_PTNS_PET" | sed -e 's%^%/%' -e 's%$%|%' -e 's%\-%\\-%g')"
  127. echo "$xINSTALLED_PTNS_PET" > /tmp/petget/fmp_xipp1
  128. INSTALLED_ALT_NAMES="$(grep --no-filename -f /tmp/petget/fmp_xipp1 /root/.packages/Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}-* | cut -f 2 -d '|')"
  129. if [ "$INSTALLED_ALT_NAMES" ];then
  130. INSTALLED_ALT_PTNS="$(echo "$INSTALLED_ALT_NAMES" | sed -e 's%^%|%' -e 's%$%|%' -e 's%\-%\\-%g')"
  131. echo "$INSTALLED_ALT_PTNS" > /var/local/petget/installed_alt_ptns_pet_user
  132. echo "$INSTALLED_ALT_PTNS" >> /tmp/petget_installed_patterns_all
  133. fi
  134. fi
  135. touch /var/local/petget/installed_alt_ptns_pet_user
  136. else
  137. cat /var/local/petget/installed_alt_ptns_pet_user >> /tmp/petget_installed_patterns_all
  138. fi
  139. ;;
  140. esac
  141. fi
  142. #process name aliases into patterns (used in filterpkgs.sh, findmissingpkgs.sh) ... 100126...
  143. xPKG_NAME_ALIASES="`echo "$PKG_NAME_ALIASES" | tr ' ' '\n' | grep -v '^$' | sed -e 's%^%|%' -e 's%$%|%' -e 's%,%|,|%g' -e 's%\\*%.*%g'`"
  144. echo "$xPKG_NAME_ALIASES" > /tmp/petget_pkg_name_aliases_patterns_raw #110706
  145. cp -f /tmp/petget_pkg_name_aliases_patterns_raw /tmp/petget_pkg_name_aliases_patterns #110706 _raw see findmissingpkgs.sh.
  146. #100711 above has a problem as it has wildcards. need to expand...
  147. #ex: PKG_NAME_ALIASES has an entry 'cxxlibs,glibc*,libc-*', the above creates '|cxxlibs|,|glibc.*|,|libc\-.*|',
  148. # after expansion: '|cxxlibs|,|glibc|,|libc-|,|glibc|,|glibc_dev|,|glibc_locales|,|glibc-solibs|,|glibc-zoneinfo|'
  149. echo -n "" > /tmp/petget_pkg_name_aliases_patterns_expanded
  150. for ONEALIASLINE in `cat /tmp/petget_pkg_name_aliases_patterns | tr '\n' ' '` #ex: |cxxlibs|,|glibc.*|,|libc\-.*|
  151. do
  152. echo -n "" > /tmp/petget_temp1
  153. for PARTONELINE in `echo -n "$ONEALIASLINE" | tr ',' ' '`
  154. do
  155. grep "$PARTONELINE" /tmp/petget_installed_patterns_all >> /tmp/petget_temp1
  156. done
  157. ZZZ="`echo "$ONEALIASLINE" | sed -e 's%\.\*%%g' | tr -d '\\'`"
  158. [ -s /tmp/petget_temp1 ] && ZZZ="${ZZZ},`cat /tmp/petget_temp1 | tr '\n' ',' | tr -s ',' | tr -d '\\'`"
  159. ZZZ="`echo -n "$ZZZ" | sed -e 's%,$%%'`"
  160. echo "$ZZZ" >> /tmp/petget_pkg_name_aliases_patterns_expanded
  161. done
  162. cp -f /tmp/petget_pkg_name_aliases_patterns_expanded /tmp/petget_pkg_name_aliases_patterns
  163. #w480 PKG_NAME_IGNORE is definedin PKGS_MANAGEMENT file... 100126...
  164. xPKG_NAME_IGNORE="`echo "$PKG_NAME_IGNORE" | tr ' ' '\n' | grep -v '^$' | sed -e 's%^%|%' -e 's%$%|%' -e 's%,%|,|%g' -e 's%\\*%.*%g' -e 's%\-%\\-%g'`"
  165. echo "$xPKG_NAME_IGNORE" > /tmp/petget_pkg_name_ignore_patterns
  166. repocnt=0
  167. COMPAT_REPO=""
  168. COMPAT_DBS=""
  169. echo -n "" > /tmp/petget_active_repo_list
  170. #120831 simplify...
  171. REPOS_RADIO=""
  172. repocnt=0
  173. #sort with -puppy-* repos last...
  174. if [ "$DISTRO_BINARY_COMPAT" = "puppy" ];then
  175. aPRE="`echo -n "$PKG_REPOS_ENABLED" | tr ' ' '\n' | grep '\-puppy\-' | tr -s '\n' | tr '\n' ' '`"
  176. bPRE="`echo -n "$PKG_REPOS_ENABLED" | tr ' ' '\n' | grep -v '\-puppy\-' | tr -s '\n' | tr '\n' ' '`"
  177. else
  178. aPRE="`echo -n "$PKG_REPOS_ENABLED" | tr ' ' '\n' | grep -v '\-puppy\-' | tr -s '\n' | tr '\n' ' '`"
  179. bPRE="`echo -n "$PKG_REPOS_ENABLED" | tr ' ' '\n' | grep '\-puppy\-' | tr -s '\n' | tr '\n' ' '`"
  180. fi
  181. for ONEREPO in $aPRE $bPRE #ex: ' Packages-puppy-precise-official Packages-puppy-noarch-official Packages-ubuntu-precise-main Packages-ubuntu-precise-multiverse '
  182. do
  183. [ ! -f /root/.packages/$ONEREPO ] && continue
  184. REPOCUT="`echo -n "$ONEREPO" | cut -f 2-4 -d '-'`"
  185. [ "$REPOS_RADIO" = "" ] && FIRST_DB="$REPOCUT"
  186. xREPOCUT="$(echo -n "$REPOCUT" | sed -e 's%\-official$%%')" #120905 window too wide.
  187. REPOS_RADIO="${REPOS_RADIO}<radiobutton><label>${xREPOCUT}</label><action>/tmp/filterversion.sh ${REPOCUT}</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>"
  188. echo "$REPOCUT" >> /tmp/petget_active_repo_list #120903 needed in findnames.sh
  189. repocnt=`expr $repocnt + 1`
  190. [ $repocnt -ge 5 ] && break
  191. done
  192. ##100116 quirky...
  193. #QUIRKY_DB=''
  194. #if [ "$DISTRO_COMPAT_VERSION" != "wary5" ];then #101126
  195. # if [ "`echo "$DISTRO_NAME" | grep -i 'quirky'`" != "" ];then
  196. # if [ "`echo -n "$PKG_REPOS_ENABLED" | grep 'puppy\-quirky'`" != "" ];then
  197. # echo 'puppy-quirky-official' >> /tmp/petget_active_repo_list
  198. # QUIRKY_DB='<radiobutton><label>puppy-quirky</label><action>/tmp/filterversion.sh puppy-quirky-official</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>'
  199. # FIRST_DB='puppy-quirky-official'
  200. # repocnt=1
  201. # fi
  202. # fi
  203. #fi
  204. #
  205. #if [ "$DISTRO_BINARY_COMPAT" != "puppy" ];then #w477 if compat-distro is puppy, bypass.
  206. # for ONE_DB in `ls -1 /root/.packages/Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}* | tr '\n' ' '`
  207. # do
  208. # BASEREPO="`basename $ONE_DB`"
  209. # bPATTERN=' '"$BASEREPO"' '
  210. # [ "`echo -n "$PKG_REPOS_ENABLED" | grep "$bPATTERN"`" = "" ] && continue
  211. # repocnt=`expr $repocnt + 1`
  212. # COMPAT_REPO="`echo -n "$ONE_DB" | rev | cut -f 1 -d '/' | rev | cut -f 2-4 -d '-'`"
  213. # if [ "$COMPAT_DBS" = "" ];then #101205
  214. # COMPAT_DBS="<radiobutton><label>${COMPAT_REPO}</label><action>/tmp/filterversion.sh ${COMPAT_REPO}</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>"
  215. # else
  216. # COMPAT_DBS="${COMPAT_DBS}
  217. #<radiobutton><label>${COMPAT_REPO}</label><action>/tmp/filterversion.sh ${COMPAT_REPO}</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>"
  218. # fi
  219. # echo "${COMPAT_REPO}" >> /tmp/petget_active_repo_list #read in findnames.sh
  220. # [ "$FIRST_DB" = "" ] && [ $repocnt = 1 ] && FIRST_DB="$COMPAT_REPO"
  221. # done
  222. #fi
  223. #
  224. #PUPPY_DBS=""
  225. #
  226. ##100903 another hack...
  227. #if [ "$DISTRO_COMPAT_VERSION" == "wary5" ];then
  228. # if [ "`echo -n "$PKG_REPOS_ENABLED" | grep 'puppy\-wary5'`" != "" ];then
  229. # echo 'puppy-wary5-official' >> /tmp/petget_active_repo_list
  230. # PUPPY_DBS='<radiobutton><label>puppy-wary5</label><action>/tmp/filterversion.sh puppy-wary5-official</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>'
  231. # FIRST_DB='puppy-wary5-official'
  232. # repocnt=1
  233. # fi
  234. #fi
  235. #
  236. ##100911 another hack...
  237. #if [ "$DISTRO_COMPAT_VERSION" == "lucid" ];then
  238. # if [ "`echo -n "$PKG_REPOS_ENABLED" | grep 'puppy\-lucid'`" != "" ];then
  239. # echo 'puppy-lucid-official' >> /tmp/petget_active_repo_list
  240. # PUPPY_DBS='<radiobutton><label>puppy-lucid</label><action>/tmp/filterversion.sh puppy-lucid-official</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>'
  241. # FIRST_DB='puppy-lucid-official'
  242. # repocnt=1
  243. # fi
  244. #fi
  245. #
  246. #xrepocnt=$repocnt #w476
  247. #for ONE_DB in `ls -1 /root/.packages/Packages-puppy* | sort -r | tr '\n' ' '`
  248. #do
  249. # BASEREPO="`basename $ONE_DB`"
  250. # #100903 if wary5, want to list quirky repo, as has same code base...
  251. # [ "$BASEREPO" = "Packages-puppy-quirky-official" ] && [ "$DISTRO_COMPAT_VERSION" != "wary5" ] && continue #100126 already handled above. 100903
  252. # [ "$BASEREPO" = "Packages-puppy-wary5-official" ] && continue #100903 already handled above.
  253. # [ "$BASEREPO" = "Packages-puppy-lucid-official" ] && continue #100911 already handled above.
  254. # bPATTERN=' '"$BASEREPO"' '
  255. # [ "`echo -n "$PKG_REPOS_ENABLED" | grep "$bPATTERN"`" = "" ] && continue
  256. # PUPPY_REPO="`echo -n "$ONE_DB" | rev | cut -f 1 -d '/' | rev | cut -f 2-4 -d '-'`"
  257. # #chop size of label down a bit, to fit in 800x600 window...
  258. # PUPPY_REPO_CUT="`echo -n "$ONE_DB" | rev | cut -f 1 -d '/' | rev | cut -f 2,3 -d '-'`"
  259. # PUPPY_REPO_FULL="`echo -n "$ONE_DB" | rev | cut -f 1 -d '/' | rev | cut -f 2-9 -d '-'`"
  260. # if [ "$PUPPY_DBS" = "" ];then #101205
  261. # PUPPY_DBS="<radiobutton><label>${PUPPY_REPO_CUT}</label><action>/tmp/filterversion.sh ${PUPPY_REPO_FULL}</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>"
  262. # else
  263. # PUPPY_DBS="${PUPPY_DBS}
  264. #<radiobutton><label>${PUPPY_REPO_CUT}</label><action>/tmp/filterversion.sh ${PUPPY_REPO_FULL}</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>"
  265. # fi
  266. # echo "${PUPPY_REPO}" >> /tmp/petget_active_repo_list #read in findnames.sh
  267. # [ "$FIRST_DB" = "" ] && [ $repocnt = $xrepocnt ] && FIRST_DB="$PUPPY_REPO" #w476
  268. # repocnt=`expr $repocnt + 1`
  269. #done
  270. FILTER_CATEG="Desktop"
  271. #note, cannot initialise radio buttons in gtkdialog...
  272. echo "Desktop" > /tmp/petget_filtercategory #must start with Desktop.
  273. echo "$FIRST_DB" > /tmp/petget/current-repo-triad #ex: slackware-12.2-official
  274. #if [ "$DISTRO_BINARY_COMPAT" = "ubuntu" -o "$DISTRO_BINARY_COMPAT" = "debian" ];then
  275. if [ 0 -eq 1 ];then #w020 disable this choice.
  276. #filter pkgs by first letter, for more speed. must start with ab...
  277. echo "ab" > /tmp/petget_pkg_first_char
  278. FIRSTCHARS="
  279. <radiobutton><label>a,b</label><action>echo ab > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  280. <radiobutton><label>c,d</label><action>echo cd > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  281. <radiobutton><label>e,f</label><action>echo ef > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  282. <radiobutton><label>g,h</label><action>echo gh > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  283. <radiobutton><label>i,j</label><action>echo ij > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  284. <radiobutton><label>k,l</label><action>echo kl > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  285. <radiobutton><label>m,n</label><action>echo mn > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  286. <radiobutton><label>o,p</label><action>echo op > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  287. <radiobutton><label>q,r</label><action>echo qr > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  288. <radiobutton><label>s,t</label><action>echo st > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  289. <radiobutton><label>u,v</label><action>echo uv > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  290. <radiobutton><label>w,x</label><action>echo wx > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  291. <radiobutton><label>y,z</label><action>echo yz > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  292. <radiobutton><label>0-9</label><action>echo 0123456789 > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  293. <radiobutton><label>ALL</label><action>echo ALL > /tmp/petget_pkg_first_char</action><action>/usr/local/petget/filterpkgs.sh</action><action>refresh:TREE1</action></radiobutton>
  294. "
  295. xFIRSTCHARS="<hbox>
  296. ${FIRSTCHARS}
  297. </hbox>"
  298. else
  299. #do not dispay the alphabetic radiobuttons...
  300. echo "ALL" > /tmp/petget_pkg_first_char
  301. FIRSTCHARS=""
  302. xFIRSTCHARS=""
  303. fi
  304. #130330 GUI filtering. see also ui_Classic, ui_Ziggy, filterpkgs.sh ...
  305. GUIONLYSTR="$(gettext 'GUI apps only')"
  306. ANYTYPESTR="$(gettext 'Any type')"
  307. GUIEXCSTR="$(gettext 'GUI, not')" #130331 (look in ui_Classic, ui_Ziggy to see context)
  308. NONGUISTR="$(gettext 'Any non-GUI type')" #130331
  309. export GUIONLYSTR ANYTYPESTR GUIEXCSTR NONGUISTR #used in ui_classic and ui_ziggy
  310. [ ! -f /var/local/petget/gui_filter ] && echo -n "$GUIONLYSTR" > /var/local/petget/gui_filter
  311. #finds pkgs in repository based on filter category and version and formats ready for display...
  312. /usr/local/petget/filterpkgs.sh $FILTER_CATEG #writes to /tmp/petget/filterpkgs.results
  313. echo '#!/bin/sh
  314. echo $1 > /tmp/petget/current-repo-triad
  315. ' > /tmp/filterversion.sh
  316. chmod 777 /tmp/filterversion.sh
  317. # <text use-markup=\"true\"><label>\"<b>To install or uninstall,</b>\"</label></text>
  318. ALLCATEGORY=''
  319. if [ "$DISTRO_BINARY_COMPAT" = "puppy" ];then #v424 reintroduce the 'ALL' category.
  320. ALLCATEGORY="<radiobutton><label>$(gettext 'ALL')</label><action>/usr/local/petget/filterpkgs.sh ALL</action><action>refresh:TREE1</action></radiobutton>"
  321. fi
  322. #100513 also for 't2' (quirky) builds...
  323. if [ "$DISTRO_BINARY_COMPAT" = "t2" ];then #reintroduce the 'ALL' category.
  324. ALLCATEGORY="<radiobutton><label>$(gettext 'ALL')</label><action>/usr/local/petget/filterpkgs.sh ALL</action><action>refresh:TREE1</action></radiobutton>"
  325. fi
  326. #120515 ditto for gentoo build...
  327. if [ "$DISTRO_BINARY_COMPAT" = "gentoo" ];then #reintroduce the 'ALL' category.
  328. ALLCATEGORY="<radiobutton><label>$(gettext 'ALL')</label><action>/usr/local/petget/filterpkgs.sh ALL</action><action>refresh:TREE1</action></radiobutton>"
  329. fi
  330. DB_ORDERED="$REPOS_RADIO" #120831
  331. ##w476 reverse COMPAT_DBS, PUPPY_DBS...
  332. ##100412 make sure first radiobutton matches list of pkgs...
  333. ##101205 bugfix...
  334. #DB_ORDERED="${QUIRKY_DB}
  335. #${PUPPY_DBS}
  336. #${COMPAT_DBS}"
  337. #FIRST_DB_cut="`echo -n "$FIRST_DB" | cut -f 1,2 -d '-' | sed -e 's%\\-%\\\\-%g'`" #ex: puppy-lucid-official cut to puppy\-lucid.
  338. #fdPATTERN='>'"$FIRST_DB_cut"'<'
  339. #DB_temp0="`echo "$DB_ORDERED" | sed -e 's%^$%%' | grep "$fdPATTERN"`"
  340. #if [ ! "$DB_temp0" ];then #120327 above may fail.
  341. # #ex: FIRST_DB=ubuntu-precise-main, DB_ORDERED=puppy-precise\npuppy-noarch\nubuntu-precise-main\nubuntu-precise-multiverse
  342. # FIRST_DB_cut="`echo -n "$FIRST_DB" | cut -f 1,2,3 -d '-' | sed -e 's%\\-%\\\\-%g'`" #ex: ubuntu-precise-main becomes ubuntu\-precise\-main
  343. # fdPATTERN='>'"$FIRST_DB_cut"'<'
  344. # DB_temp0="`echo "$DB_ORDERED" | sed -e 's%^$%%' | grep "$fdPATTERN"`"
  345. #fi
  346. #DB_temp1="`echo "$DB_ORDERED" | sed -e 's%^$%%' | grep -v "$fdPATTERN"`"
  347. #DB_ORDERED="$DB_temp0
  348. #$DB_temp1"
  349. # <text use-markup=\"true\"><label>\"<b>Just click on a package!</b>\"</label></text>
  350. # <text><label>\" \"</label></text>
  351. #110118 alternate User Interfaces...
  352. touch /var/local/petget/ui_choice
  353. UI="`cat /var/local/petget/ui_choice`"
  354. [ "$UI" = "" ] && UI="Classic"
  355. . /usr/local/petget/ui_${UI}
  356. RETPARAMS="`gtkdialog4 --program=MAIN_DIALOG`"
  357. #eval "$RETPARAMS"
  358. ###END###