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