Last active
March 21, 2019 15:59
-
-
Save hazcod/fd2efccb9c26f24f35d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export ENCFS6_CONFIG="/home/media/data/.encfs.xml" | |
crypt_mount="/tmp/.media" | |
uncrypt_mount="/tmp/media" | |
uploadcrypt="/home/media/data/uploading" | |
upload="/home/media/data/uploadme" | |
user="media" | |
group="media" | |
read -s -p "password: " pwd | |
mkdir -p "$crypt_mount" | |
mkdir -p "$uncrypt_mount" | |
chmod 740 "$uncrypt_mount" | |
uid=$(id -u "$user") | |
gid=$(getent group "$group" | cut -d: -f 3) | |
if acdcli mount "$crypt_mount" --ro --allow-root; then | |
if echo "$pwd" | encfs -S -o umask=0740,uid="$uid",gid="$gid" "$crypt_mount" "$uncrypt_mount"; then | |
if echo "$pwd" | encfs -S "$uploadcrypt" "$upload"; then | |
echo "done" | |
exit 0 | |
else | |
echo "Failed to setup local encfs" | |
exit 1 | |
fi | |
else | |
echo "Failed setting up media mount" | |
exit 1 | |
fi | |
unset pwd | |
else | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment