2
0
mirror of https://github.com/spritsail/plex-media-server.git synced 2024-11-05 01:16:23 +00:00

Print clearer warning about permission change

This commit is contained in:
Joe Groocock 2018-08-19 21:09:26 +01:00
parent 9360ec8b65
commit 210576c0ea
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86

View File

@ -1,19 +1,25 @@
#!/bin/sh
set -e
# ANSI colour escape sequences
RED='\033[0;31m'
RESET='\033[0m'
if su-exec -e [ ! -w "/config" ]; then
2>&1 echo "Warning: No permission to write in '/config' directory."
2>&1 echo " Correcting permissions to prevent a crash"
2>&1 echo -e "${RED}####################### WARNING #######################${RESET}"
2>&1 echo
(
set -x
2>&1 echo -e "${RED} No permission to write in '/config' directory.${RESET}"
2>&1 echo -e "${RED} Correcting permissions to prevent a crash.${RESET}"
2>&1 echo
2>&1 echo -e "${RED}#######################################################${RESET}"
chown $SUID:$SGID /config
chmod o+rw /config
)
fi
exec su-exec -e sh <<EOF
# Generate a default configuration, including some user-specified values
# Generate a default configuration on first run, including some user-specified values
if [ ! -e "/config/Preferences.xml" ]; then
gen-config.sh
fi
@ -25,4 +31,5 @@ tail -Fn 0 "/config/Logs/Plex Media Server.log" 2>/dev/null &
export PLEX_MEDIA_SERVER_PIDFILE="\$(mktemp -ut pms-pid.XXXXXX)"
exec "\$PLEX_MEDIA_SERVER_HOME/Plex Media Server"
EOF