Fix regression of /etc/default/iodine handling.
authorgregor herrmann <gregoa@debian.org>
Sat, 21 Jun 2014 21:34:47 +0000 (23:34 +0200)
committergregor herrmann <gregoa@debian.org>
Sat, 21 Jun 2014 21:45:01 +0000 (23:45 +0200)
Affects especially $(...) constructs.

- debian/config: use awk again for getting existing values instead of
  sourcing the file. Cf. #612723
- debian/postinst: update perl substitution command to use single quotes as
  regexp delimiters in order to avoid variable substitution.

Thanks: "Debian bug at v.nix.is" for the bug report.
Closes: #752263
debian/config
debian/postinst

index 020a21470956ff6b1f54b82b3f5cb65d9fd917f7..73c692209193fd63d01f0df1a4512f1f5496d5f2 100644 (file)
@@ -4,10 +4,16 @@ CONFIGFILE=/etc/default/iodine
 set -e
 . /usr/share/debconf/confmodule
 
+getvalue() {
+       awk '/^'"$1"'=/ {sub("^'"$1"'=\"", ""); sub("\"$", ""); value=$0;} END {print value}' /etc/default/iodine
+}
+
 if [ -s $CONFIGFILE ] ; then
-       . $CONFIGFILE
+       START_IODINED="$(getvalue START_IODINED)"
        db_set iodine/start_daemon    "$START_IODINED"
+       IODINED_ARGS="$(getvalue IODINED_ARGS)"
        db_set iodine/daemon_options  "$IODINED_ARGS"
+       IODINED_PASSWORD="$(getvalue IODINED_PASSWORD)"
        db_set iodine/daemon_password "$IODINED_PASSWORD"
 fi
 
index 61d5fdd6e822fd563582bdb9b64cd452a7a77bc6..3591e219c61b2756a289bc11d3fd775781a54d94 100644 (file)
@@ -61,9 +61,12 @@ EOF
         test -z "$IODINED_PASSWORD" || grep -Eq '^ *IODINED_PASSWORD=' $CONFIGFILE || \
             echo "IODINED_PASSWORD=" >> $CONFIGFILE
 
-        perl -p -e "s{^ *START_IODINED=.*}{START_IODINED=\"$START_IODINED\"}; \
-                    s{^ *IODINED_ARGS=.*}{IODINED_ARGS=\"$IODINED_ARGS\"}; \
-                    s{^ *IODINED_PASSWORD=.*}{IODINED_PASSWORD=\"$IODINED_PASSWORD\"};" \
+        # PATTERN may contain variables, which will be interpolated every time the pattern search
+        # is evaluated, except for when the delimiter is a single quote.
+        # (perldoc perlop)
+        perl -p -e "s'^ *START_IODINED=.*'START_IODINED=\"$START_IODINED\"'; \
+                    s'^ *IODINED_ARGS=.*'IODINED_ARGS=\"$IODINED_ARGS\"'; \
+                    s'^ *IODINED_PASSWORD=.*'IODINED_PASSWORD=\"$IODINED_PASSWORD\"';" \
             < $CONFIGFILE > $CONFIGFILE.tmp
 
         mv -f $CONFIGFILE.tmp $CONFIGFILE