-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmount.sh
39 lines (32 loc) · 807 Bytes
/
mount.sh
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
#!/bin/bash
# Ensure source is defined
if [ -z "$MOUNT_SOURCE" ]; then
echo "Need to set MOUNT_SOURCE"
exit 1
fi
# Ensure target is defined
if [ -z "$MOUNT_TARGET" ]; then
echo "Need to set MOUNT_TARGET"
exit 1
fi
# Wait for any required mounts
if [ "$WAIT_FOR_MNT" ]; then
while true ; do
if mount | grep -q "$WAIT_FOR_MNT" ; then
break
fi
echo "Waiting for mount $WAIT_FOR_MNT";
sleep 5
done
fi
# Make directories if required
mkdir -p $MOUNT_SOURCE
mkdir -p $MOUNT_TARGET
# Cleanup any existing mount
umount -f $MOUNT_TARGET
# Mount away!
if [ "$ENCFS_PASS" ]; then
exec encfs -o allow_other -f --extpass='/bin/echo $ENCFS_PASS' $MOUNT_SOURCE $MOUNT_TARGET
else
exec encfs -o allow_other -f $MOUNT_SOURCE $MOUNT_TARGET
fi