mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.2 KiB

  1. #!/bin/bash
  2. comment '- Additional Package Selection'
  3. block_begin 3
  4. choice ROCKCFG_PKGSEL_TPL none none 'No package preselection template' \
  5. $( cd misc/pkgsel ; grep -H "^# TITLE: " *.in | \
  6. tr ' ' '_' | sed 's,\.in:#_TITLE:_, ,' )
  7. if [ "$ROCKCFG_EXPERT" == 1 ] ; then
  8. if [ -f misc/pkgsel/${ROCKCFG_PKGSEL_TPL}.in ]; then
  9. pkgfilter sed -e "$( . ./misc/pkgsel/macros
  10. . ./misc/pkgsel/${ROCKCFG_PKGSEL_TPL}.in)"
  11. fi
  12. fi
  13. bool 'Custom package selection' ROCKCFG_PKGSEL 0
  14. if [ "$ROCKCFG_PKGSEL" = 1 ] ; then
  15. menu_begin MENU_PKGSEL_RULES 'Edit package selection rules'
  16. editfile ROCKCFG_PKGSEL_FILE config/$config.$swpid/pkgsel \
  17. 'Package selection rules'
  18. menu_end
  19. # Syntax for package selection rules is:
  20. # <action> <patternlist>
  21. # <action> is a single character: x or X enables the packages matching
  22. # <patternlist>, o or O disables them, - omits them in the packages list.
  23. # <patternlist> consists of one or more white-space separated sed patterns.
  24. # <action> is performed on every line in the list matching all patterns of a rule.
  25. # If the first <pattern> of a rule is a !, <action> is performed on every line
  26. # _not_ matching _any_ <pattern> of a rule.
  27. if [ "$ROCKCFG_EXPERT" == 1 ] ; then
  28. filterscript=""
  29. while read action not patternlist ; do
  30. [ "$not" != "!" ] && { patternlist="$not" ; not="" ; }
  31. case "$action" in
  32. [xX]) action='s,^O ,X ,' ;;
  33. [oO]) action='s,^X ,O ,' ;;
  34. -) action='d' ;;
  35. *) continue ;;
  36. esac
  37. while read pattern ; do
  38. filterscript="$filterscript /[ =]$pattern / $not $action ;"
  39. done < <( echo "$patternlist" | tr '\t ' '\n\n' )
  40. done < config/$config.$swpid/pkgsel
  41. pkgfilter sed -e "$filterscript"
  42. fi
  43. fi
  44. startprog ROCKCFG_SHOW_PKGLIST 'Show the current package list' \
  45. "sort -k1,1r -k3,3n \
  46. < config/$config.$swpid/packages \
  47. | cut -f1,2,4,5,8- -d' ' | sed 's, [^ ]*$,,' \
  48. | tr ' ' '\t' | expand -t2,13,30, \
  49. > config/$config.$swpid/packages.txt ; \
  50. ./src/rockdialog.bin --title 'ROCK Linux Config - Package List' \
  51. --backtitle 'ROCK Linux $rockver Configuration' \
  52. --textbox config/$config.$swpid/packages.txt \
  53. $(( $lines - 4 )) $(( $columns - 5 ))"
  54. block_end
  55. comment ' '