fetchinfo.sh 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/bin/sh
  2. #called from installpreview.sh.
  3. #passed param (also variable TREE1) is name of pkg, ex: abiword-1.2.3.
  4. #/tmp/petget/current-repo-triad has the repository that installing from.
  5. #w019 now have /root/.packages/PKGS_HOMEPAGES
  6. #101221 yaf-splash fix.
  7. #110523 Scientific Linux docs.
  8. #120203 BK: internationalized.
  9. #120515 support gentoo arm distro (built from bin tarballs from a gentoo sd image).
  10. #120719 support raspbian.
  11. [ "$(cat /var/local/petget/nt_category 2>/dev/null)" != "true" ] && \
  12. [ -f /tmp/install_quietly ] && set -x
  13. #; mkdir -p /tmp/PPM_LOGs ; NAME=$(basename "$0"); exec 1>> /tmp/PPM_LOGs/"$NAME".log 2>&1
  14. export TEXTDOMAIN=petget___fetchinfo.sh
  15. export OUTPUT_CHARSET=UTF-8
  16. . /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION
  17. . /root/.packages/DISTRO_PKGS_SPECS
  18. #ex: TREE1=abiword-1.2.4 (first field in database entry).
  19. DB_FILE=Packages-`cat /tmp/petget/current-repo-triad` #ex: Packages-slackware-12.2-official
  20. tPATTERN='^'"$TREE1"'|'
  21. DB_ENTRY="`grep "$tPATTERN" /root/.packages/$DB_FILE | head -n 1`"
  22. #line format: pkgname|nameonly|version|pkgrelease|category|size|path|fullfilename|dependencies|description|
  23. #optionally on the end: compileddistro|compiledrelease|repo| (fields 11,12,13)
  24. DB_nameonly="`echo -n "$DB_ENTRY" | cut -f 2 -d '|'`"
  25. DB_fullfilename="`echo -n "$DB_ENTRY" | cut -f 8 -d '|'`"
  26. DB_DISTRO="`echo -n "$DB_FILE" | cut -f 2 -d '-'`" #exs: slackware arch ubuntu
  27. DB_RELEASE="`echo -n "$DB_FILE" | cut -f 3 -d '-'`" #exs: 12.2 200902 intrepid
  28. DB_SUB="`echo -n "$DB_FILE" | cut -f 4 -d '-'`" #exs: official extra universe
  29. case $DB_DISTRO in
  30. slackware)
  31. if [ ! -f /root/.packages/PACKAGES.TXT-${DB_SUB} ];then
  32. # /usr/lib/gtkdialog/box_splash -font "8x16" -outline 0 -margin 4 -text "Please wait, downloading database file to /root/.packages/PACKAGES.TXT-${DB_SUB}..." &
  33. if [ ! -f /tmp/install_quietly ]; then
  34. /usr/lib/gtkdialog/box_splash -close never -text "$(gettext 'Please wait, downloading database file to') /root/.packages/PACKAGES.TXT-${DB_SUB}..." &
  35. X5PID=$!
  36. fi
  37. cd /root/.packages
  38. case $DB_SUB in
  39. official)
  40. wget http://slackware.cs.utah.edu/pub/slackware/slackware-${DB_RELEASE}/PACKAGES.TXT
  41. ;;
  42. slacky)
  43. wget http://repository.slacky.eu/slackware-${DB_RELEASE}/PACKAGES.TXT
  44. ;;
  45. esac
  46. sync
  47. mv -f PACKAGES.TXT PACKAGES.TXT-${DB_SUB}
  48. [ ! -f /tmp/install_quietly ] && kill $X5PID || echo
  49. fi
  50. cat /root/.packages/PACKAGES.TXT-${DB_SUB} | tr -s ' ' | sed -e 's% $%%' | tr '%' ' ' | tr '\n' '%' | sed -e 's/%%/@/g' | grep -o "PACKAGE NAME: ${DB_fullfilename}[^@]*" | tr '%' '\n' > /tmp/petget_slackware_pkg_extra_info
  51. sync
  52. nohup defaulttextviewer /tmp/petget_slackware_pkg_extra_info &
  53. ;;
  54. debian|raspbian)
  55. nohup defaulthtmlviewer http://packages.debian.org/${DB_RELEASE}/${DB_nameonly} &
  56. ;;
  57. devuan)
  58. nohup defaulthtmlviewer http://packages.devuan.org/ &
  59. ;;
  60. ubuntu)
  61. nohup defaulthtmlviewer http://packages.ubuntu.com/${DB_RELEASE}/${DB_nameonly} &
  62. ;;
  63. arch)
  64. nohup defaulthtmlviewer http://www.archlinux.org/packages/${DB_SUB}/i686/${DB_nameonly}/ &
  65. ;;
  66. puppy|t2|gentoo)
  67. #HOMELINK="`grep 'Homepage:' /tmp/gethomepage_2 | grep -o 'href=".*' | cut -f 2 -d '"'`"
  68. #w019 fast (see also /usr/sbin/indexgen.sh)...
  69. HOMESITE="http://en.wikipedia.org/wiki/${DB_nameonly}"
  70. #121217 pkg name might differ - and _ chars...
  71. nPTN1="^$(echo "${DB_nameonly}" | tr '-' '_') "
  72. nPTN2="^$(echo "${DB_nameonly}" | tr '_' '-') "
  73. REALHOME="`cat /root/.packages/PKGS_HOMEPAGES | grep -i "$nPTN1" | head -n 1 | cut -f 2 -d ' '`"
  74. [ "$REALHOME" = "" ] && REALHOME="`cat /root/.packages/PKGS_HOMEPAGES | grep -i "$nPTN2" | head -n 1 | cut -f 2 -d ' '`"
  75. [ "$REALHOME" != "" ] && HOMESITE="$REALHOME"
  76. nohup defaulthtmlviewer $HOMESITE &
  77. ;;
  78. scientific) #110523
  79. ###THIS IS INCOMPLETE###
  80. if [ ! -f /root/.packages/primary.xml ];then
  81. if [ ! -f /tmp/install_quietly ];then
  82. /usr/lib/gtkdialog/box_splash -close never -text "$(gettext 'Please wait, downloading database file to') /root/.packages/primary.xml..." &
  83. X5PID=$!
  84. fi
  85. cd /root/.packages
  86. wget http://ftp.scientificlinux.org/linux/scientific/${DISTRO_COMPAT_VERSION}/i386/os/repodata/primary.xml.gz
  87. sync
  88. gunzip primary.xml.gz
  89. [ ! -f /tmp/install_quietly ] && kill $X5PID || echo
  90. fi
  91. sync
  92. ###TODO: NEED TO EXTRACT INFO ON ONE PKG ONLY###
  93. nohup defaulttextviewer /root/.packages/primary.xml &
  94. ;;
  95. esac
  96. ###END###