Detect BTRFS filesystem

This commit is contained in:
Jeremy Gardais 2020-10-19 18:37:48 +02:00
parent 97c530fc70
commit ebdd32854c
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 32 additions and 19 deletions

13
debian/chroot.mount vendored
View File

@ -15,6 +15,14 @@ new_hostname=""
vgname=$(vgdisplay --short | tail -n 1 | sed 's/.*"\(.*\)" .*/\1/')
## If the script should create extra volume (eg. backup, virt, Proxmox,…)
manage_extra_lv=0
## Is BTRFS {{{
root_fs_type=$(lsblk -f /dev/mapper/"${vgname}"-root | awk '/root/ { print $2 }')
if [ "${root_fs_type}" = "btrfs" ]; then
manage_btrfs=0
else
manage_btrfs=1
fi
## }}}
## Colors definition {{{
BLACK='\033[49;30m'
BLACKB='\033[49;90m'
@ -35,6 +43,10 @@ RESET='\033[0m'
mkdir -p -- /target
mountpoint -q /target || mount -- /dev/mapper/"${vgname}"-root /target
##
if [ "${manage_btrfs}" -eq 0 ]; then
printf '%b\n' "The root system is in ${GREEN}BTRFS${RESET}, no extra mount is required."
else
### boot - grub
mountpoint -q /target/boot || mount -- ${hdd}1 /target/boot
@ -57,6 +69,7 @@ if [ "${manage_extra_lv}" -eq 0 ]; then
### Extra vz LV
mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/var/lib/vz
fi
fi
### Swap
swapon -- /dev/mapper/"${vgname}"-swap