From d05d500c0caa81319658f0b23a3c5c877baf7e7f Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 23 Feb 2009 10:48:30 +0100 Subject: [PATCH] Adjust configuration files on the fly only when the according lines aren't comments. --- debian/changelog | 4 +++- grml-live | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index a845a92..ed65959 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Mon, 23 Feb 2009 10:39:57 +0100 + -- Michael Prokop Mon, 23 Feb 2009 11:22:13 +0100 grml-live (0.9.8) unstable; urgency=low diff --git a/grml-live b/grml-live index 5c55828..f9ddd19 100755 --- 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 # }}} -- 2.1.4