Implement bootstrap
This commit is contained in:
parent
bd767dac81
commit
783414ce40
|
@ -1 +1,2 @@
|
|||
.*
|
||||
subvols/
|
||||
|
|
|
@ -13,8 +13,13 @@ end
|
|||
echo "Creating subvolume directory..."
|
||||
mkdir $subvoldir
|
||||
|
||||
for subvol in (get-subvols)
|
||||
echo "Creating initial snapshots..."
|
||||
for pair in (get-subvol-mounts)
|
||||
set subvol (get-subvol $pair)
|
||||
set mount (get-mount $pair)
|
||||
|
||||
set safename (clean-name $subvol)
|
||||
echo "Creating initial snapshot for $subvol ($subvoldir/$safename)"
|
||||
echo $subvol
|
||||
set safepath $subvoldir/$safename
|
||||
|
||||
sudo btrfs subvolume snapshot -r $mount $safepath
|
||||
end
|
||||
|
|
13
utils.fish
13
utils.fish
|
@ -1,7 +1,16 @@
|
|||
#!/usr/bin/fish
|
||||
|
||||
function get-subvols
|
||||
cat /etc/fstab | grep subvol | sed 's/.*subvol=//;s/)//;s/\t\| \|0//g'
|
||||
function get-subvol-mounts
|
||||
#cat /etc/fstab | grep subvol | sed 's/.*subvol=//;s/)//;s/\t\| \|0//g'
|
||||
cat /etc/fstab | grep btrfs | cut -d\t -f2,4 | sed 's/\(.*\)\t.*,subvol=\(.*\)$/\2 \1/'
|
||||
end
|
||||
|
||||
function get-subvol
|
||||
echo $argv | cut -d' ' -f1
|
||||
end
|
||||
|
||||
function get-mount
|
||||
echo $argv | cut -d' ' -f2
|
||||
end
|
||||
|
||||
function clean-name
|
||||
|
|
Loading…
Reference in New Issue