ports_deblob.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/sh
  2. ########################################
  3. # name: ports_deblob.sh
  4. # main: jadedctrl
  5. # lisc: isc
  6. # desc: delobbing obsd ports tree for
  7. # use with lbsd.
  8. ########################################
  9. . ./libdeblob.sh
  10. if test -z "$1"; then
  11. echo "usage: ports_deblob.sh ports_dir"
  12. exit 2
  13. else
  14. SRC_DIR="$1"
  15. fi
  16. PATCH_DIR=/tmp/ports_deblob/
  17. mkdir "$PATCH_DIR" 2>/dev/null
  18. # --------------------------------------
  19. portdirs="archivers astro audio biology books cad chinese comms converters"
  20. portdirs="$portdirs databases devel editors education emulators fonts games"
  21. portdirs="$portdirs geo graphics inputmethods japanese java korean lang mail"
  22. portdirs="$portdirs math meta misc multimedia net news plan9 print productivity"
  23. portdirs="$portdirs productivity security shells sysutils telephony textproc"
  24. portdirs="$portdirs www x11"
  25. # --------------------------------------
  26. for portdir in $portdirs; do
  27. echo "========"
  28. echo "$portdir"
  29. echo "========"
  30. for portpath in $SRC_DIR/$portdir/*; do
  31. local port=$(echo $portpath | sed 's^.*/^^g')
  32. printf "."
  33. case "$(libre_status "$portdir/$port")" in
  34. "nonfree")
  35. echo
  36. echo "Non-free $port, flagged for deletion."
  37. dirdel "$portdir/$port"
  38. ;;
  39. "libre")
  40. ;;
  41. *)
  42. port_lisc_preview $portdir/$port
  43. yn_prompt "Is $port (f)ree or (n)on-free?" \
  44. 'f' 'n'
  45. local status="$?"
  46. if test "$status" -eq 1; then
  47. add_nonfree_port "$portdir/$port"
  48. echo
  49. echo "$port flagged for deletion."
  50. dirdel "$portdir/$port"
  51. elif test "$status" -eq 0; then
  52. add_libre_port "$portdir/$port"
  53. fi
  54. ;;
  55. esac
  56. done
  57. echo
  58. done
  59. # --------------------------------------
  60. # INDEX mucking
  61. # you'll notice that this is the only part of these scripts
  62. # (other than libdeblob, obviously) that actually directly
  63. # modifies both a file in SRC_DIR and PATCH_DIR.
  64. # that's just because INDEX is way too big to be parseable
  65. # through libdeblob functions.
  66. # this isn't cool...
  67. cp "$SRC_DIR/INDEX" "$PATCH_DIR/ADD_INDEX"
  68. rm "$SRC_DIR/INDEX"
  69. for port in $(cat files/ports/blacklist); do
  70. grep -v "$port" "$PATCH_DIR/ADD_INDEX" > "$PATCH_DIR/ADD_INDEX.temp"
  71. mv "$PATCH_DIR/ADD_INDEX.temp" "$PATCH_DIR/ADD_INDEX"
  72. done
  73. rm "$PATCH_DIR/ADD_INDEX.temp"
  74. # --------------------------------------
  75. apply