From: Michael Prokop Date: Sun, 28 Oct 2012 11:16:57 +0000 (+0100) Subject: grml-udev-rebuildfstab: write label name into comment when label feature is disabled X-Git-Tag: v0.3.1~1 X-Git-Url: https://git.grml.org/?a=commitdiff_plain;h=5d4fd63d819628ae407caa5eff1c0647e7861f2b;p=grml-udev-config.git grml-udev-rebuildfstab: write label name into comment when label feature is disabled While at it log invalid label names, as the "$addinfo" doesn't receive the according place with the way it's used nowadays. --- diff --git a/scripts/grml-udev-rebuildfstab b/scripts/grml-udev-rebuildfstab index c0371cf..40d8078 100755 --- a/scripts/grml-udev-rebuildfstab +++ b/scripts/grml-udev-rebuildfstab @@ -165,7 +165,7 @@ if "$LABEL" && [ -n "$ID_FS_LABEL_ENC" ] ; then # see check_for_label() in scanpartitions for details case $ID_FS_LABEL_ENC in *\x*) - addinfo=" # special char in label ($ID_FS_LABEL_ENC) not supported" + logit "special char in label ($ID_FS_LABEL_ENC) not supported, skipping label for $DEVNAME" break ;; *) echo "LABEL=$ID_FS_LABEL_ENC" @@ -276,12 +276,20 @@ ntfs|vfat|msdos) ;; esac +# when we don't use labels then write the label information into the comment +if ! "$LABEL" && [ -n "$ID_FS_LABEL_ENC" ] ; then + addinfo="# LABEL=$ID_FS_LABEL_ENC" + devinfo="" +else # otherwise (when using labels) write the device name into the comment + devinfo="# $DEVNAME" +fi + case $ACTION in add|change) ( flock -x 200 echo "$ADDEDBYGRML $DEVNAME" >> /etc/fstab - echo "$device $mountpoint $ID_FS_TYPE $options 0 0 $addinfo # $DEVNAME" >> /etc/fstab + echo "$device $mountpoint $ID_FS_TYPE $options 0 0 ${addinfo}${devinfo}" >> /etc/fstab ) 200>/var/run/rebuildfstab.lock