aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/scripts/sshfs-mount
blob: e99e7738b20d74ca76a5de0c58f5e78a61263bd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

input="$1"
server="${input#*@}"
folder="${input%@*}"
mount_path="$HOME/Shares/SSHFS/$folder"

[ "$2" = 'stop' ] && fusermount -u "$mount_path";
[ "$2" = 'stop' ] && exit;

# evaulate the keychain
eval "$(keychain --dir "$HOME"/.cache/keychain --eval --agents ssh -Q --quiet "$HOME"/.ssh/mobile)";

# mount the directory
mkdir -p "$mount_path";
fusermount -u "$mount_path";
# TODO: Add setting remote server path with argument
sshfs -f -o follow_symlinks,idmap=user,identityfile="$HOME"/.ssh/mobile,identityfile="$HOME"/.ssh/ansible root@"$server":/ "$mount_path";