Skip to content

Commit 3449797

Browse files
Use lsblk to show all FS labels
Previously, e2label was used, but that only works for ext partitions. Using lsblk allows showing the filesystem labels for all filesystems supported by the kernel.
1 parent 11a38f8 commit 3449797

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

rpi-clone

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -738,13 +738,10 @@ do
738738
src_name[p]="${src_mounted_dir[p]}"
739739
fi
740740

741-
if [[ "$part_type" == *"ext"* ]]
741+
label=`lsblk --raw --output label --noheadings "${src_device[p]}"`
742+
if [ "$label" != "" ]
742743
then
743-
label=`e2label ${src_device[p]} 2> /dev/null`
744-
if [ "$label" != "" ]
745-
then
746-
src_label[p]="$label"
747-
fi
744+
src_label[p]="$label"
748745
fi
749746
done
750747

@@ -1143,16 +1140,15 @@ do
11431140
if [[ "$part_type" == *"linux-swap"* ]]
11441141
then
11451142
dst_fs_type[p]="swap"
1146-
elif [[ "$part_type" == *"ext"* ]]
1143+
elif ((p == ext_num))
11471144
then
1148-
label=`e2label ${dst_device[p]} 2> /dev/null`
1145+
dst_fs_type[p]="EXT"
1146+
else
1147+
label=`lsblk --raw --output label --noheadings "${dst_device[p]}"`
11491148
if [ "$label" != "" ]
11501149
then
11511150
dst_label[p]="$label"
11521151
fi
1153-
elif ((p == ext_num))
1154-
then
1155-
dst_fs_type[p]="EXT"
11561152
fi
11571153
done
11581154

0 commit comments

Comments
 (0)