forked from dannyti/seedbox-from-scratch
-
Notifications
You must be signed in to change notification settings - Fork 4
/
createFileManagerUserInstall
executable file
·49 lines (39 loc) · 1.94 KB
/
createFileManagerUserInstall
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
42
43
44
45
46
47
48
49
#!/bin/bash
# Hellish Tech
# No commercial usage without authorization
exec 1> >(logger -s -t $(basename $0)) 2>&1
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-u|--username)
USERNAME="$2"
shift # past argument
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
USERPASSWORD=$(echo "$(cat /etc/seedbox-from-scratch/users/${USERNAME}.info)" | grep "Password: " | head -n1 | awk '{print $2}')
SYSTEMHOSTNAME=`cat /etc/seedbox-from-scratch/hostname.info`
WEBSERVERPORT=$(/etc/seedbox-from-scratch/sfsgetAvailablePort -sp 8081 -ep 8180)
USERUID=$(id -u ${USERNAME})
USERGID=$(id -g ${USERNAME})
docker pull hacdias/filebrowser
docker run --restart=always -d --name ${USERNAME}_filemanager -e LOCAL_USER_ID=${USERUID} -h ${SYSTEMHOSTNAME} -v /home/${USERNAME}:/srv -p ${WEBSERVERPORT}:80 -e PGID=${USERGID} -e PUID=${USERUID} -v /etc/seedbox-from-scratch/ssl:/etc/ssl/certs -v /etc/localtime:/etc/localtime:ro hacdias/filebrowser
CHECKIFRUNNING=$(/etc/seedbox-from-scratch/sfsRunningUserDockerInfo -u ${USERNAME} -d filemanager | tr -cd '[[:alnum:]]._-' )
if [[ (${CHECKIFRUNNING} == "STOPPED") || (${CHECKIFRUNNING} == "RUNNING") ]]; then
echo "SERVICE: FILEMANAGER" > /home/${USERNAME}/private/filemanager.serviceinfo
echo "USERNAME: $USERNAME" >> /home/${USERNAME}/private/filemanager.serviceinfo
echo "ACCESSURL: http://$SYSTEMHOSTNAME:$WEBSERVERPORT" >> /home/${USERNAME}/private/filemanager.serviceinfo
echo "USERNAME: admin" >> /home/${USERNAME}/private/filemanager.serviceinfo
echo "PASSWORD: admin" >> /home/${USERNAME}/private/filemanager.serviceinfo
echo "Change your username and password once logged into the system. We are not responsible for users failure to secure the system." >> /home/${USERNAME}/private/filemanager.serviceinfo
chown www-data:www-data /home/${USERNAME}/private/*.serviceinfo
fi
if [[ -n $1 ]]; then
echo "Last line of file specified as non-opt/last argument:"
tail -1 $1
fi