-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·41 lines (35 loc) · 649 Bytes
/
Copy pathentrypoint.sh
File metadata and controls
executable file
·41 lines (35 loc) · 649 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
cleanup() {
echo "Cleaning up now... "
sync
umount -vl /mount
echo "Cleanup done!"
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]
then
# sync and unmount on shutdown
trap cleanup EXIT
UID="${UID:-0}"
GID="${GID:-0}"
PORT="${PORT:-22}"
CMD=(
sshfs
-f
-o reconnect
-o ServerAliveInterval=15
-o ServerAliveCountMax=3
-o UserKnownHostsFile=/dev/null
-o StrictHostKeyChecking=no
-o allow_other
-o auto_unmount
-o uid="$UID"
-o gid="$GID"
-o port="$PORT"
"$@" /mount
)
if [[ -n "$SSHPASS" ]]
then
CMD=(sshpass -e "${CMD[@]}")
fi
exec "${CMD[@]}"
fi