30 lines
677 B
Fish
Executable File
30 lines
677 B
Fish
Executable File
#!/usr/bin/fish
|
|
|
|
function get-subvol-mounts
|
|
cat /etc/fstab | grep btrfs | column -t | tr -s ' ' | cut -d' ' -f2,4 | sed 's/\(.*\)\s.*,subvol=\(.*\)$/\2 \1/'
|
|
end
|
|
|
|
function receive-on-target
|
|
ssh -i $sshkey $targetuser@$targethost sudo btrfs receive $targetpath
|
|
end
|
|
|
|
function rename-target-subvolume
|
|
ssh -i $sshkey $targetuser@$targethost mv -v $targetpath/$argv[1] $targetpath/$argv[2]
|
|
end
|
|
|
|
function delete-target-subvolume
|
|
ssh -i $sshkey $targetuser@$targethost sudo btrfs subvolume delete $targetpath/$argv[1]
|
|
end
|
|
|
|
function get-subvol
|
|
echo $argv | cut -d' ' -f1
|
|
end
|
|
|
|
function get-mount
|
|
echo $argv | cut -d' ' -f2
|
|
end
|
|
|
|
function clean-name
|
|
echo $argv | sed 's/\//-/g'
|
|
end
|