File: btrfs

package info (click to toggle)
partman-btrfs 66
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 532 kB
  • sloc: sh: 334; makefile: 2
file content (32 lines) | stat: -rwxr-xr-x 672 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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