debian/postinst: use perl and fancy regex delimiters instead of sed
authorgregor herrmann <gregoa@debian.org>
Tue, 14 May 2013 15:10:34 +0000 (17:10 +0200)
committergregor herrmann <gregoa@debian.org>
Tue, 14 May 2013 15:10:34 +0000 (17:10 +0200)
for updating the configuration file. The typical `sed -e s///' breaks if
IODINED_ARGS contains slashes.

Thanks: Pierre Ynard for the bug report.
Closes: #708187
debian/postinst

index c6649470d7c474f7ee73338af22b3491b44e1d0e..61d5fdd6e822fd563582bdb9b64cd452a7a77bc6 100644 (file)
@@ -61,9 +61,9 @@ EOF
         test -z "$IODINED_PASSWORD" || grep -Eq '^ *IODINED_PASSWORD=' $CONFIGFILE || \
             echo "IODINED_PASSWORD=" >> $CONFIGFILE
 
-        sed -e "s/^ *START_IODINED=.*/START_IODINED=\"$START_IODINED\"/" \
-            -e "s/^ *IODINED_ARGS=.*/IODINED_ARGS=\"$IODINED_ARGS\"/" \
-            -e "s/^ *IODINED_PASSWORD=.*/IODINED_PASSWORD=\"$IODINED_PASSWORD\"/" \
+        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