ports_deblob.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/ksh
  2. #########################
  3. # Name: ports_deblob.sh
  4. # Main: jadedctrl
  5. # Lisc: ISC
  6. # Desc: Delobbing OBSD ports
  7. # tree for use with
  8. # LBSD.
  9. #########################
  10. # Usage: ports_deblob.sh
  11. . ./libdeblob.sh
  12. PATCH_DIR=/tmp/ports_deblob/
  13. if [ -e $PATCH_DIR ]
  14. then
  15. self_destruct_sequence $PATCH_DIR
  16. mkdir $PATCH_DIR
  17. else
  18. mkdir $PATCH_DIR
  19. fi
  20. if test -z $1
  21. then
  22. SRC_DIR=/usr/ports/
  23. else
  24. SRC_DIR=$1
  25. fi
  26. portdirs="archivers astro audio biology books cad chinese comms converters databases devel"
  27. portdirs="$portdirs editors education emulators fonts games geo graphics inputmethods"
  28. portdirs="$portdirs japanese java korean lang mail math meta misc multimedia net news plan9"
  29. portdirs="$portdirs print productivity security shells sysutils telephony textproc www x11"
  30. for portdir in $portdirs
  31. do
  32. for portpath in $SRC_DIR/$portdir/*
  33. do
  34. port=$(echo $portpath | sed 's^.*/^^g')
  35. echo $port
  36. if grep "^$port$" files/ports/blacklist > /dev/null
  37. then
  38. echo "Non-free $port to be deleted!"
  39. filedel "$portdir/$port"
  40. elif grep "^$port$" files/ports/whitelist > /dev/null
  41. then
  42. echo "OK" > /dev/null
  43. else
  44. inputdone=0
  45. nfinput=''
  46. while [ $inputdone -eq 0 ]
  47. do
  48. grep -B1 "PERMIT_PACKAGE_CDROM" $SRC_DIR/$portdir/$port/Makefile
  49. echo "Is $port free or nonfree? (f/n)"
  50. read nfinput
  51. case $nfinput in
  52. f)
  53. echo "$port" >> files/ports/whitelist
  54. inputdone=1
  55. ;;
  56. n)
  57. echo "$port" >> files/ports/blacklist
  58. inputdone=1
  59. ;;
  60. esac
  61. done
  62. fi
  63. done
  64. done
  65. for port in $(cat files/ports/blacklist)
  66. do
  67. linedel "/$port " INDEX
  68. done
  69. #for port in $(cat files/ports/whitelist)
  70. #do
  71. # if grep "^$port-" $PATCH_DIR/INDEX || grep "/$port||" $PATCH_DIR/INDEX
  72. # then
  73. # echo "OK" > /dev/null
  74. # else
  75. # echo "$port" >> files/ports/blacklist
  76. # linedel "/$port " INDEX
  77. # echo "$port has a non-free depedency-- it has been added to the blacklist."
  78. # echo "You'll have to re-run this script in order to apply this change."
  79. # sleep 2
  80. # fi
  81. #done
  82. apply