btrfish/bootstrap.fish

26 lines
530 B
Fish
Raw Normal View History

2016-05-05 01:03:24 +02:00
#!/usr/bin/fish
set scriptdir (dirname (status --current-filename))
source $scriptdir/config.fish
2016-05-05 01:15:35 +02:00
source $scriptdir/utils.fish
2016-05-05 01:03:24 +02:00
if test -d $subvoldir
echo "Backup directory already exists, aborting..."
exit
end
2016-05-05 01:15:35 +02:00
echo "Creating subvolume directory..."
2016-05-05 01:03:24 +02:00
mkdir $subvoldir
2016-05-05 02:04:21 +02:00
echo "Creating initial snapshots..."
for pair in (get-subvol-mounts)
set subvol (get-subvol $pair)
set mount (get-mount $pair)
2016-05-05 01:15:35 +02:00
set safename (clean-name $subvol)
2016-05-05 02:04:21 +02:00
set safepath $subvoldir/$safename
sudo btrfs subvolume snapshot -r $mount $safepath
2016-05-05 01:03:24 +02:00
end