diff options
author | Manoj Srivastava <srivasta@debian.org> | 2009-01-25 01:37:50 -0600 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2009-01-25 01:43:40 -0600 |
commit | 99736ccbce553061b51786df554805d64feff863 (patch) | |
tree | ada4dd9c7739e0f942eeefca1bc81adc4b694564 /ucf | |
parent | 67e17f11262d35647fc1b414ac46bc25afbea8ea (diff) |
Move the debconf stuff _after_ command line parsing
If it is done earlier, the DEBCONF_OK flag is not set yet. This is
majorly bad. Closes: Bug#512832, Bug#512905
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
Diffstat (limited to 'ucf')
-rwxr-xr-x | ucf | 144 |
1 files changed, 73 insertions, 71 deletions
@@ -253,77 +253,6 @@ replace_conf_file () { -###################################################################### -######## ######### -######## DebConf stuff ######### -######## ######### -###################################################################### - -# Is debconf already running? Kinda tricky, because it will be after the -# confmodule is sourced, so only test before that. -if [ -z "$DEBCONF_ALREADY_RUNNING" ]; then - if [ "$DEBIAN_HAS_FRONTEND" ]; then - DEBCONF_ALREADY_RUNNING='YES' - else - DEBCONF_ALREADY_RUNNING='NO' - fi -fi - -export DEBCONF_ALREADY_RUNNING - -if [ -z "$DEBCONF_OK" ]; then - if [ "$DEBCONF_ALREADY_RUNNING" = 'YES' ]; then - DEBCONF_OK='NO' - else - DEBCONF_OK='YES' - fi -fi - -# Time to start nagging the users who call ucf without debconf-ok -if [ "$DEBCONF_ALREADY_RUNNING" ] && [ "$DEBCONF_OK" = NO ]; then - # Commented out for now, uncomment after a while to begin nagging - # maintainers to fix their scripts. - cat \ -<<END -*** WARNING: ucf was run from a maintainer script that uses debconf, but - the script did not pass --debconf-ok to ucf. The maintainer - script should be fixed to not stop debconf before calling ucf, - and pass it this parameter. For now, ucf will revert to using - old-style, non-debconf prompting. Ugh! - - Please inform the package maintainer about this problem. -END -fi - -# Start up debconf or at least get the db_* commands available, but -# only if it is OK to use debconf. -if [ "$DEBCONF_OK" = "YES" ] && [ -e /usr/share/debconf/confmodule ]; then - if test $(id -u) = 0; then - . /usr/share/debconf/confmodule - - # Load our templates, just in case our template has - # not been loaded or the Debconf DB lost or corrupted - # since then. - db_x_loadtemplatefile /var/lib/dpkg/info/ucf.templates ucf - else - echo >&2 "$progname: Not loading confmodule, since we are not running as root." - fi - # Only set the title if debconf was not already running. - # If it was running, then we do not want to clobber the - # title used for configuring the whole package with debconf. - if [ "$DEBCONF_ALREADY_RUNNING" = 'NO' ]; then - if ! db_settitle ucf/title 2>/dev/null; then - # Older debconf that does not support that command. - if test $(id -u) = 0; then - db_title "Modified configuration file" - else - echo >&2 "$progname: Not changing title, since we are not running as root." - fi - fi - fi -fi - - ###################################################################### ######## ######### @@ -627,6 +556,79 @@ fi ###################################################################### ######## ######### +######## DebConf stuff ######### +######## ######### +###################################################################### + +# Is debconf already running? Kinda tricky, because it will be after the +# confmodule is sourced, so only test before that. +if [ -z "$DEBCONF_ALREADY_RUNNING" ]; then + if [ "$DEBIAN_HAS_FRONTEND" ]; then + DEBCONF_ALREADY_RUNNING='YES' + else + DEBCONF_ALREADY_RUNNING='NO' + fi +fi + +export DEBCONF_ALREADY_RUNNING + +if [ -z "$DEBCONF_OK" ]; then + if [ "$DEBCONF_ALREADY_RUNNING" = 'YES' ]; then + DEBCONF_OK='NO' + else + DEBCONF_OK='YES' + fi +fi + +# Time to start nagging the users who call ucf without debconf-ok +if [ "$DEBCONF_ALREADY_RUNNING" = 'YES' ] && [ "$DEBCONF_OK" = NO ]; then + # Commented out for now, uncomment after a while to begin nagging + # maintainers to fix their scripts. + cat \ +<<END +*** WARNING: ucf was run from a maintainer script that uses debconf, but + the script did not pass --debconf-ok to ucf. The maintainer + script should be fixed to not stop debconf before calling ucf, + and pass it this parameter. For now, ucf will revert to using + old-style, non-debconf prompting. Ugh! + + Please inform the package maintainer about this problem. +END +fi + +# Start up debconf or at least get the db_* commands available +if [ -e /usr/share/debconf/confmodule ]; then + if test $(id -u) = 0; then + . /usr/share/debconf/confmodule + + # Load our templates, just in case our template has + # not been loaded or the Debconf DB lost or corrupted + # since then, but only if it is OK to use debconf. + if [ "$DEBCONF_OK" = 'YES' ]; then + db_x_loadtemplatefile /var/lib/dpkg/info/ucf.templates ucf + fi + else + echo >&2 "$progname: Not loading confmodule, since we are not running as root." + fi + # Only set the title if debconf was not already running. + # If it was running, then we do not want to clobber the + # title used for configuring the whole package with debconf. + if [ "$DEBCONF_ALREADY_RUNNING" = 'NO' ]; then + if ! db_settitle ucf/title 2>/dev/null; then + # Older debconf that does not support that command. + if test $(id -u) = 0; then + db_title "Modified configuration file" + else + echo >&2 "$progname: Not changing title, since we are not running as root." + fi + fi + fi +fi + + + +###################################################################### +######## ######### ######## Start Processing ######### ######## ######### ###################################################################### |