32 lines
672 B
Bash
Executable file
32 lines
672 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -- $1
|
|
|
|
fs=$1
|
|
mp=$2
|
|
type=$3
|
|
options=$4
|
|
dump=$5
|
|
pass=$6
|
|
|
|
case $type in
|
|
btrfs)
|
|
# import workaround from Kali's partman-btrfs commit:7f43d2c
|
|
options="${options%,subvol=*}"
|
|
#for removing the option subvol,when thats the only option
|
|
#eg: options=="subvol=@", no comma present
|
|
options="${options%subvol=*}"
|
|
mount -t btrfs ${options:+-o "$options"} $fs /target"$mp" || exit 1
|
|
if [ $mp = / ]; then
|
|
btrfs subvolume create /target$mp/@rootfs
|
|
chmod 755 /target$mp/@rootfs
|
|
umount /target$mp
|
|
options="${options:+$options,}subvol=@rootfs"
|
|
mount -t btrfs -o $options $fs /target$mp
|
|
fi
|
|
echo "umount /target$mp"
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
exit 1
|