OpenSDE Packages Database (without history before r20070)
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.

72 lines
2.1 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../uclibc/conffiles-functions.in
  5. # Copyright (C) 2006 - 2007 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. # $conffiles is a list of patters of the form
  16. # ^[XO-] <pattern> [<value>]
  17. # X means enable, O disable, and - removes it
  18. # pattern can use '*' as a wildcard for [^ #]
  19. # optionaly can set a value different that y
  20. conffiles_apply() {
  21. local file= rule=
  22. local action= prerule= value= x=
  23. if [ ! -f $builddir/config.sed ]; then
  24. for file in $conffiles $extraconffiles; do if [ -f "$file" ]; then
  25. sed -e '/^[ \t]*$/d;' -e '/^[ \t]*#.*/d;' "$file" |
  26. while read action prerule value x; do
  27. rule="$(echo $prerule | sed 's/\*/[^ #]*/')"
  28. rule="^\(# \)\?\($rule\)[= ].*\$"
  29. if [ -z "$value" ]; then
  30. value='y'
  31. fi
  32. case "$action" in
  33. X) echo "apply_conffiles: rule $prerule=$value." >&2
  34. echo "s,$rule,\2=$value,g" >> $builddir/config.sed
  35. ;;
  36. O) echo "apply_conffiles: rule unset $prerule." >&2
  37. echo "s,$rule,# \2 is not set,g" >> $builddir/config.sed
  38. ;;
  39. -) echo "apply_conffiles: rule remove $prerule." >&2
  40. echo "s,$rule,,g" >> $builddir/config.sed
  41. ;;
  42. *)
  43. abort "apply_conffiles: bad rule $action $prerule $value"
  44. ;;
  45. esac
  46. done
  47. fi ; done
  48. fi
  49. sed -f $builddir/config.sed .config
  50. }
  51. # get default config, and filter considering <n>
  52. # levels, because new options can appear and other disappear
  53. conffiles_loop() {
  54. local loops="${1:-1}"
  55. shift
  56. cp -v .config .config.1
  57. j=2 ; for (( i=0 ; i<loops ; i++, j++ )) {
  58. conffiles_apply > .config.$j
  59. cp -v .config.$j .config
  60. eval $MAKE "$@" oldconfig
  61. (( j++ )) ; cp -v .config .config.$j
  62. }
  63. }