aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2020-06-10 03:25:03 -0400
committertdro <tdro@users.noreply.github.com>2020-06-10 03:25:03 -0400
commit1ab2e557d675169b3e2d8b49caf1df9cf8d752ab (patch)
tree824184c706818c2cad1f29231663d42bcf61f166
parent862b3c7b847e8980ec9d2f305b4af93722da7f44 (diff)
downloaddotfiles-1ab2e557d675169b3e2d8b49caf1df9cf8d752ab.tar.gz
dotfiles-1ab2e557d675169b3e2d8b49caf1df9cf8d752ab.tar.bz2
dotfiles-1ab2e557d675169b3e2d8b49caf1df9cf8d752ab.zip
.local/bin/scripts: Add sshfs-mount
-rwxr-xr-x.local/bin/scripts/sshfs-mount17
1 files changed, 17 insertions, 0 deletions
diff --git a/.local/bin/scripts/sshfs-mount b/.local/bin/scripts/sshfs-mount
new file mode 100755
index 0000000..de95aa0
--- /dev/null
+++ b/.local/bin/scripts/sshfs-mount
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+input="$1"
+host="${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";
+sshfs -f -o follow_symlinks,idmap=user,identityfile="$HOME"/.ssh/mobile,identityfile="$HOME"/.ssh/ansible root@"$host":/ "$mount_path";