btrfish/utils.fish

30 lines
677 B
Fish
Raw Permalink Normal View History

2016-05-05 01:15:35 +02:00
#!/usr/bin/fish
2016-05-05 02:04:21 +02:00
function get-subvol-mounts
2016-06-19 21:23:31 +02:00
cat /etc/fstab | grep btrfs | column -t | tr -s ' ' | cut -d' ' -f2,4 | sed 's/\(.*\)\s.*,subvol=\(.*\)$/\2 \1/'
2016-05-05 02:04:21 +02:00
end
2016-05-05 02:52:02 +02:00
function receive-on-target
ssh -i $sshkey $targetuser@$targethost sudo btrfs receive $targetpath
end
2016-05-05 03:48:13 +02:00
function rename-target-subvolume
2016-05-05 03:48:31 +02:00
ssh -i $sshkey $targetuser@$targethost mv -v $targetpath/$argv[1] $targetpath/$argv[2]
2016-05-05 03:48:13 +02:00
end
function delete-target-subvolume
ssh -i $sshkey $targetuser@$targethost sudo btrfs subvolume delete $targetpath/$argv[1]
end
2016-05-05 02:04:21 +02:00
function get-subvol
echo $argv | cut -d' ' -f1
end
function get-mount
echo $argv | cut -d' ' -f2
2016-05-05 01:15:35 +02:00
end
function clean-name
echo $argv | sed 's/\//-/g'
end