diff options
author | Thadeu Lima de Souza Cascardo <cascardo@debian.org> | 2017-10-24 12:30:47 -0200 |
---|---|---|
committer | Louis Bouchard <louis@ubuntu.com> | 2017-11-01 14:39:39 +0100 |
commit | 1d98c22f2a6b53d232329bd40c5335974cd1a3a6 (patch) | |
tree | 752bd4c689b7e0d1f36b88f978227beada8a029a /debian/kdump-tools.postinst | |
parent | a54ad2b2fc1e91ba1e9758427b42bb67300ddf17 (diff) |
Add ucf support
/etc/default/kdump-tools was already changed by the maintainer script,
so it should not be a conffile. ucf allows the maintainer scripts to ask
the user about changes done by the user to the config file.
Invoking debconf first in the script is desired, because the frontend
might exec and invoke the script itself again. Also, we install the
generated file instead of the original file, as we will replace some of
the settings. (Closes: 877250)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@debian.org>
Diffstat (limited to 'debian/kdump-tools.postinst')
-rwxr-xr-x | debian/kdump-tools.postinst | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/debian/kdump-tools.postinst b/debian/kdump-tools.postinst index 8ea7108..9183180 100755 --- a/debian/kdump-tools.postinst +++ b/debian/kdump-tools.postinst @@ -3,6 +3,7 @@ set -e update_param() { + . $INITCONFFILE eval old=\"'$'$1\" eval new=\"'$'new_$1\" @@ -32,8 +33,20 @@ update_param() { case "$1" in configure) - # create smaller initrd.img files for kdump use - /etc/kernel/postinst.d/kdump-tools $(uname -r) > /dev/null 2>&1 +# ------------------------- Debconf questions start --------------------- + # Handle debconf + . /usr/share/debconf/confmodule + db_get kdump-tools/use_kdump || RET=true + if [ "${RET}" = "true" ]; then + new_USE_KDUMP="1" + else + new_USE_KDUMP="0" + fi +# ------------------------- Debconf questions end --------------------- + + INITCONFFILE=`mktemp /etc/default/kdump-tools.XXXXXX` + cp -pf /usr/share/kdump-tools/kdump-tools.conf $INITCONFFILE + update_param USE_KDUMP # Customize crashkernel= value according to architecture ARCH="$(arch)" @@ -45,14 +58,19 @@ case "$1" in sed -i "/parameters/{s|\"$| crashkernel=${DEF_PRESET}\"|}" /etc/zipl.conf zipl fi - HAS_CIO="$(grep cio_ignore /etc/default/kdump-tools)" || true - if test -z "$HAS_CIO"; then - CIO_IGNORE="$(cio_ignore -u -k)" - sed -i "s/\#KDUMP_CMDLINE_APPEND/KDUMP_CMDLINE_APPEND/" /etc/default/kdump-tools - sed -i "/KDUMP_CMDLINE_APPEND/{s|\"$| ${CIO_IGNORE}\"|}" /etc/default/kdump-tools - fi + CIO_IGNORE="$(cio_ignore -u -k)" + sed -i "s/\#KDUMP_CMDLINE_APPEND/KDUMP_CMDLINE_APPEND/" $INITCONFFILE + sed -i "/KDUMP_CMDLINE_APPEND/{s|\"$| ${CIO_IGNORE}\"|}" $INITCONFFILE ;; esac + + ucfr kdump-tools /etc/default/kdump-tools + UCF_FORCE_CONFFMISS=1 ucf --debconf-ok $INITCONFFILE /etc/default/kdump-tools + rm -f $INITCONFFILE + sync /etc/default/kdump-tools + + # create smaller initrd.img files for kdump use + /etc/kernel/postinst.d/kdump-tools $(uname -r) > /dev/null 2>&1 ;; abort-upgrade|abort-remove|abort-deconfigure) @@ -65,27 +83,10 @@ case "$1" in ;; esac -# Handle debconf -. /usr/share/debconf/confmodule - -INITCONFFILE=/etc/default/kdump-tools - -# ------------------------- Debconf questions start --------------------- - -db_get kdump-tools/use_kdump || RET=true -if [ "${RET}" = "true" ]; then - new_USE_KDUMP="1" -else - new_USE_KDUMP="0" -fi -update_param USE_KDUMP - -# ------------------------- Debconf questions end --------------------- if [ -x /usr/sbin/update-grub ] && [ -e /boot/grub/grub.cfg ]; then update-grub fi - # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. |