]> arthur.barton.de Git - ax-linux.git/commitdiff
btrfs-mksnapshot: Enhance detection of btrfs filesystem name
authorAlexander Barton <alex@barton.de>
Fri, 26 Dec 2014 23:43:24 +0000 (00:43 +0100)
committerAlexander Barton <alex@barton.de>
Fri, 26 Dec 2014 23:43:24 +0000 (00:43 +0100)
btrfs/mksnapshot/btrfs-mksnapshot

index c4a4282f95f3380e6523945f37459fb5c1846e43..3386b471e423ceb17789e2cd8238b901f2c4368e 100755 (executable)
@@ -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