Adjust configuration files on the fly only when the according lines aren't comments.
authorMichael Prokop <mika@grml.org>
Mon, 23 Feb 2009 09:48:30 +0000 (10:48 +0100)
committerMichael Prokop <mika@grml.org>
Mon, 23 Feb 2009 10:22:37 +0000 (11:22 +0100)
debian/changelog
grml-live

index a845a92..ed65959 100644 (file)
@@ -54,8 +54,10 @@ grml-live (0.9.9) unstable; urgency=low
     with debootstrap).
   * Support NO_ADDONS via configuration file.
   * Always skip mksquashfs part when using -q option.
+  * Adjust configuration files on the fly only when the according lines
+    aren't comments.
 
- -- Michael Prokop <mika@grml.org>  Mon, 23 Feb 2009 10:39:57 +0100
+ -- Michael Prokop <mika@grml.org>  Mon, 23 Feb 2009 11:22:13 +0100
 
 grml-live (0.9.8) unstable; urgency=low
 
index 5c55828..f9ddd19 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -359,11 +359,11 @@ if [ -n "$SUITE" ] ; then
    esac
 
    DIST=" etch\| stable\| lenny\| squeeze\| testing\| sid\| unstable"
-   sed "s/\(deb .\+\)\([ \t]*\) $DIST\([ \t]*\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list | sponge /etc/grml/fai/apt/sources.list
+   sed "s/\(^deb .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE \4\5/" /etc/grml/fai/apt/sources.list | sponge /etc/grml/fai/apt/sources.list
    for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
        if [ -n "$file" ] ; then
-          sed "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF | sponge $LIVE_CONF
-          sed "s/\(deb .\+\)\([ \t]*\) $DIST\([ \t]*\)\(main \)/\1\2 $SUITE \3\4/" "$file" | sponge "$file"
+          sed "s/^SUITE=.*/SUITE=\"$SUITE\"/" $file | sponge $file
+          sed "s/\(^deb .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE \4\5/""$file" | sponge "$file"
        fi
    done
 
@@ -379,11 +379,11 @@ if [ -n "$SUITE" ] ; then
 
    for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
        if [ -n "$file" ] ; then
-          sed "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file" | sponge "$file"
+          sed "s|^FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file" | sponge "$file"
        fi
    done
 
-   sed "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
+   sed "s|^FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
 fi
 
 # set $ARCH
@@ -391,7 +391,7 @@ fi
 if grep -q -- 'FAI_DEBOOTSTRAP_OPTS.*--arch' "$NFSROOT_CONF" ; then
    sed "s/--arch [a-z0-9]* /--arch $ARCH /" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
 else
-   sed "s|FAI_DEBOOTSTRAP_OPTS=\"\(.*\)|FAI_DEBOOTSTRAP_OPTS=\"--arch $ARCH \1|" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
+   sed "s|^FAI_DEBOOTSTRAP_OPTS=\"\(.*\)|FAI_DEBOOTSTRAP_OPTS=\"--arch $ARCH \1|" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
 fi
 # }}}