aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2022-10-28 09:40:29 +0200
committerGuido Günther <agx@sigxcpu.org>2022-10-28 09:58:14 +0200
commit30304306b0cc40ade234470b56daa262d4252123 (patch)
treea323e1b6e80376fb8e859512ecc62f4b42c49c40
parent84944732baf788d0a42ee927331ebb1cff26ad14 (diff)
d/postinst: Don't fail in container without apt
Closes: #1020895
-rw-r--r--debian/postinst22
1 files changed, 12 insertions, 10 deletions
diff --git a/debian/postinst b/debian/postinst
index 8a56265..cc9b9dd 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -12,10 +12,17 @@ case "$1" in
db_get whatmaps/enable_service_restarts || true
DBVAL="$RET"
- # Configuration file doesn't exist but user wants updates enabled so
- # recreate it:
- if [ ! -f $APT_CONF ] && [ $DBVAL = "true" ]; then
- cat << EOF > $APT_CONF
+ if [ -f $APT_CONF ]; then
+ case $DBVAL in
+ "true") VAL=1;;
+ *) VAL=0;;
+ esac
+ sed -i -e "s,^\(\s*Whatmaps::Enable-Restart\s\+\"\)\S\+\(\"\s*;\),\1${VAL}\2," $APT_CONF
+ else
+ # Configuration file doesn't exist but user wants updates enabled so
+ # recreate it:
+ if [ $DBVAL = "true" ]; then
+ cat << EOF > $APT_CONF
// Set to 1 or true to enable service restarts on security updates
Whatmaps::Enable-Restart "1";
@@ -25,12 +32,7 @@ Whatmaps::Security-Update-Origins {
"\${distro_id} \${distro_codename}-security";
};
EOF
- else
- case $DBVAL in
- "true") VAL=1;;
- *) VAL=0;;
- esac
- sed -i -e "s,^\(\s*Whatmaps::Enable-Restart\s\+\"\)\S\+\(\"\s*;\),\1${VAL}\2," $APT_CONF
+ fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)