findwoofinstalledpkgs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/sh
  2. #(c) Copyright Barry Kauler 2009, puppylinux.com
  3. #this script finds all builtin packages in Puppy Linux.
  4. #110821 completely rewritten.
  5. #111204 do not use /var/local/woof, instead 'status' directory (better for running from different save-files).
  6. #121028 exclude pkgs that go into devx only from woof-installed-packages.
  7. #121102 file DISTRO_SPECS has new variable DISTRO_DB_SUBNAME. ex: for 14.0-based slacko, DISTRO_DB_SUBNAME=slacko14
  8. export LANG=C
  9. . ./DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION
  10. [ ! "$DISTRO_DB_SUBNAME" ] && DISTRO_DB_SUBNAME="$DISTRO_COMPAT_VERSION" #121102 fallback if DISTRO_DB_SUBNAME not defined in file DISTRO_SPECS.
  11. if [ -f ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then #w478
  12. . ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} #has FALLBACKS_COMPAT_VERSIONS
  13. else
  14. . ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT} #has FALLBACKS_COMPAT_VERSIONS
  15. fi
  16. echo "Creating file woof-installed-packages..."
  17. #remove comments from PKGS_SPECS_TABLE... make sure '|' on end... get rid of old |+udev,+whatever on end...
  18. PKGS_SPECS_TABLE="`echo "$PKGS_SPECS_TABLE" | grep -v '^#' | grep -v '^$' | tr '\t' ' ' | tr -s ' ' | tr '+' '&' | sed -e 's%|&.*%%' | tr '&' '+' | sed -e 's% #.*%%' -e 's% $%%' -e 's%$%|%' -e 's%||$%|%'`"
  19. #new script to find all pkgs for build...
  20. ./support/findpkgs
  21. #...returns file status/findpkgs_FINAL_PKGS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
  22. # each line is full db entry for pkg, prefixed with :generic-name:, pet/compat and repo-filename.
  23. # ex: :a52dec:|compat|Packages-puppy-wary5-official|a52dec-0.7.4-w5|a52dec|0.7.4-w5||BuildingBlock|68K||a52dec-0.7.4-w5.pet||A free ATSC A52 stream decoder|puppy|wary5||
  24. if [ $? -ne 0 ];then
  25. echo
  26. echo "ERROR: Script support/findpkgs aborted with an error, exiting."
  27. exit 1
  28. fi
  29. if [ ! -f status/findpkgs_FINAL_PKGS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then
  30. echo
  31. echo "ERROR: Something went wrong with support/findpkgs, exiting."
  32. exit 1
  33. fi
  34. #need to find exactly what has gone into the build and the devx...
  35. echo -n "" > /tmp/woof-installed-packages-tmp
  36. echo -n "" > /tmp/devx-only-installed-packages-tmp #121028
  37. cat status/findpkgs_FINAL_PKGS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} |
  38. while read ONELINE
  39. do
  40. #ex: :a52dec:|compat|Packages-puppy-wary5-official|a52dec-0.7.4-w5|a52dec|0.7.4-w5||BuildingBlock|68K||a52dec-0.7.4-w5.pet||A free ATSC A52 stream decoder|puppy|wary5||
  41. ADBENTRY="`echo -n "$ONELINE" | cut -f 4-19 -d '|'`"
  42. GENERICNAMES="`echo -n "$ONELINE" | cut -f 1 -d '|' | tr ':' ' '`"
  43. NAMEONLY="`echo -n "$ADBENTRY" | cut -f 2 -d '|'`"
  44. case $NAMEONLY in
  45. *_DEV)
  46. PTN1='^dev$'
  47. PTN2='dev>exe$'
  48. ;;
  49. *_DOC)
  50. PTN1='^doc>exe$'
  51. PTN2='^doc>dev$'
  52. ;;
  53. *_NLS)
  54. PTN1='^nls>exe$'
  55. PTN2='^nls>dev$'
  56. ;;
  57. *) #allow all thru...
  58. PTN1=''
  59. PTN2=''
  60. ;;
  61. esac
  62. PTN3='exe>dev$' #121028
  63. for AGENERICNAME in $GENERICNAMES
  64. do
  65. gnPTN="^yes|${AGENERICNAME}|"
  66. SPLITUPS="`echo "$PKGS_SPECS_TABLE" | grep "$gnPTN" | cut -f 4 -d '|' | tr ',' '\n'`"
  67. FLG3="`echo "$SPLITUPS" | grep "$PTN3"`" #121028
  68. if [ "$FLG3" ];then #121028
  69. echo "$ADBENTRY" >> /tmp/devx-only-installed-packages-tmp
  70. break
  71. fi
  72. FLG1="`echo "$SPLITUPS" | grep "$PTN1"`"
  73. FLG2="`echo "$SPLITUPS" | grep "$PTN2"`"
  74. sumFLGS="${FLG1}${FLG2}"
  75. if [ "$sumFLGS" ];then
  76. echo "$ADBENTRY" >> /tmp/woof-installed-packages-tmp
  77. break
  78. fi
  79. done
  80. done
  81. sync
  82. # added for rootfs-packages
  83. [ -f /tmp/rootfs-packages.specs ] && cat /tmp/rootfs-packages.specs >> /tmp/woof-installed-packages-tmp
  84. #grep '|pet|' status/findpkgs_FINAL_PKGS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} | cut -f 4-19 -d '|' > /tmp/woof-installed-packages-pet
  85. #sync
  86. #grep '|compat|' status/findpkgs_FINAL_PKGS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} | cut -f 4-19 -d '|' > /tmp/woof-installed-packages-compat
  87. #sync
  88. #
  89. ##sort alphabetically...
  90. #sort --key=1 --field-separator="|" /tmp/woof-installed-packages-pet > /tmp/petget_woof-installed-packages
  91. #mv -f /tmp/petget_woof-installed-packages /tmp/woof-installed-packages-pet
  92. #sort --key=1 --field-separator="|" /tmp/woof-installed-packages-compat > /tmp/petget_woof-installed-packages
  93. #mv -f /tmp/petget_woof-installed-packages /tmp/woof-installed-packages-compat
  94. sort --key=1 --field-separator="|" /tmp/woof-installed-packages-tmp > woof-installed-packages
  95. if [ -s /tmp/devx-only-installed-packages-tmp ];then
  96. sort --key=1 --field-separator="|" /tmp/devx-only-installed-packages-tmp > devx-only-installed-packages
  97. fi
  98. ###END###