From: Alexander Barton Date: Fri, 26 Dec 2014 23:43:24 +0000 (+0100) Subject: btrfs-mksnapshot: Enhance detection of btrfs filesystem name X-Git-Url: https://arthur.barton.de/gitweb/?p=ax-linux.git;a=commitdiff_plain;h=599aea272fcc70a5cc603918a2f7548db458a44c btrfs-mksnapshot: Enhance detection of btrfs filesystem name --- diff --git a/btrfs/mksnapshot/btrfs-mksnapshot b/btrfs/mksnapshot/btrfs-mksnapshot index c4a4282..3386b47 100755 --- a/btrfs/mksnapshot/btrfs-mksnapshot +++ b/btrfs/mksnapshot/btrfs-mksnapshot @@ -49,12 +49,15 @@ done [ -z "$DRY_RUN" ] || echo "VOLUME_PATH=$VOLUME_PATH" # Detect btrfs filesystem -FS_NAME=`grep " btrfs " /etc/fstab \ - | grep "^LABEL=" \ - | grep " $VOLUME_PATH " \ - | cut -d'"' -f2 \ - | cut -d'=' -f2- \ - | cut -d' ' -f1` +FS_NAME=`btrfs fi sh -m / 2>/dev/null | head -1 | cut -d"'" -f2` +if [ -z "$FS_NAME" ]; then + FS_NAME=`grep " btrfs " /etc/fstab \ + | grep "^LABEL=" \ + | grep " $VOLUME_PATH " \ + | cut -d'"' -f2 \ + | cut -d'=' -f2- \ + | cut -d' ' -f1` +fi if [ -z "$FS_NAME" ]; then echo "$NAME: Failed to detect btrfs filesystem label for \"$VOLUME_PATH\"!" exit 1