fetchinfo.sh 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. export TEXTDOMAIN=petget___fetchinfo.sh
  12. export OUTPUT_CHARSET=UTF-8
  13. . /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION
  14. . /root/.packages/DISTRO_PKGS_SPECS
  15. #ex: TREE1=abiword-1.2.4 (first field in database entry).
  16. DB_FILE=Packages-`cat /tmp/petget/current-repo-triad` #ex: Packages-slackware-12.2-official
  17. tPATTERN='^'"$TREE1"'|'
  18. DB_ENTRY="`grep "$tPATTERN" /root/.packages/$DB_FILE | head -n 1`"
  19. #line format: pkgname|nameonly|version|pkgrelease|category|size|path|fullfilename|dependencies|description|
  20. #optionally on the end: compileddistro|compiledrelease|repo| (fields 11,12,13)
  21. DB_nameonly="`echo -n "$DB_ENTRY" | cut -f 2 -d '|'`"
  22. DB_fullfilename="`echo -n "$DB_ENTRY" | cut -f 8 -d '|'`"
  23. DB_DISTRO="`echo -n "$DB_FILE" | cut -f 2 -d '-'`" #exs: slackware arch ubuntu
  24. DB_RELEASE="`echo -n "$DB_FILE" | cut -f 3 -d '-'`" #exs: 12.2 200902 intrepid
  25. DB_SUB="`echo -n "$DB_FILE" | cut -f 4 -d '-'`" #exs: official extra universe
  26. case $DB_DISTRO in
  27. slackware)
  28. if [ ! -f /root/.packages/PACKAGES.TXT-${DB_SUB} ];then
  29. # /usr/X11R7/bin/yaf-splash -font "8x16" -outline 0 -margin 4 -bg orange -text "Please wait, downloading database file to /root/.packages/PACKAGES.TXT-${DB_SUB}..." &
  30. yaf-splash -close never -bg orange -text "$(gettext 'Please wait, downloading database file to') /root/.packages/PACKAGES.TXT-${DB_SUB}..." &
  31. X5PID=$!
  32. cd /root/.packages
  33. case $DB_SUB in
  34. official)
  35. wget http://slackware.cs.utah.edu/pub/slackware/slackware-${DB_RELEASE}/PACKAGES.TXT
  36. ;;
  37. slacky)
  38. wget http://repository.slacky.eu/slackware-${DB_RELEASE}/PACKAGES.TXT
  39. ;;
  40. esac
  41. sync
  42. mv -f PACKAGES.TXT PACKAGES.TXT-${DB_SUB}
  43. kill $X5PID
  44. fi
  45. 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
  46. sync
  47. nohup defaulttextviewer /tmp/petget_slackware_pkg_extra_info &
  48. ;;
  49. debian|raspbian)
  50. nohup defaulthtmlviewer http://packages.debian.org/${DB_RELEASE}/${DB_nameonly} &
  51. ;;
  52. ubuntu)
  53. nohup defaulthtmlviewer http://packages.ubuntu.com/${DB_RELEASE}/${DB_nameonly} &
  54. ;;
  55. arch)
  56. nohup defaulthtmlviewer http://www.archlinux.org/packages/${DB_SUB}/i686/${DB_nameonly}/ &
  57. ;;
  58. puppy|t2|gentoo)
  59. #HOMELINK="`grep 'Homepage:' /tmp/gethomepage_2 | grep -o 'href=".*' | cut -f 2 -d '"'`"
  60. #w019 fast (see also /usr/sbin/indexgen.sh)...
  61. HOMESITE="http://en.wikipedia.org/wiki/${DB_nameonly}"
  62. #121217 pkg name might differ - and _ chars...
  63. nPTN1="^$(echo "${DB_nameonly}" | tr '-' '_') "
  64. nPTN2="^$(echo "${DB_nameonly}" | tr '_' '-') "
  65. REALHOME="`cat /root/.packages/PKGS_HOMEPAGES | grep -i "$nPTN1" | head -n 1 | cut -f 2 -d ' '`"
  66. [ "$REALHOME" = "" ] && REALHOME="`cat /root/.packages/PKGS_HOMEPAGES | grep -i "$nPTN2" | head -n 1 | cut -f 2 -d ' '`"
  67. [ "$REALHOME" != "" ] && HOMESITE="$REALHOME"
  68. nohup defaulthtmlviewer $HOMESITE &
  69. ;;
  70. scientific) #110523
  71. ###THIS IS INCOMPLETE###
  72. if [ ! -f /root/.packages/primary.xml ];then
  73. yaf-splash -close never -bg orange -text "$(gettext 'Please wait, downloading database file to') /root/.packages/primary.xml..." &
  74. X5PID=$!
  75. cd /root/.packages
  76. wget http://ftp.scientificlinux.org/linux/scientific/${DISTRO_COMPAT_VERSION}/i386/os/repodata/primary.xml.gz
  77. sync
  78. gunzip primary.xml.gz
  79. kill $X5PID
  80. fi
  81. sync
  82. ###TODO: NEED TO EXTRACT INFO ON ONE PKG ONLY###
  83. nohup defaulttextviewer /root/.packages/primary.xml &
  84. ;;
  85. esac
  86. ###END###