From b08b63c39ee1987b4616c4a8de0f866b00c48888 Mon Sep 17 00:00:00 2001 From: Devin Slick Date: Fri, 23 Oct 2015 19:51:39 -0500 Subject: [PATCH] Added check for root in AUTOSTART The script never should get to the point of trying to restart a reinstalled service if it wasn't installed with sudo, but it's a good idea to have this check regardless. --- plexupdate.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plexupdate.sh b/plexupdate.sh index 36c362a..f540ccc 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -320,4 +320,18 @@ if [ "${AUTOSTART}" == "yes" ]; then sudo service plexmediaserver start fi +if [ "${AUTOSTART}" == "yes" then + if [ "${REDHAT}" == "no" ]; then + echo "The AUTOSTART [-s] option may not be needed on your distribution." + fi + id | grep 'uid=0(' 2>&1 >/dev/null + if [ $? -ne 0 ]; then + echo "Error: You need to be root to use autoinstall option." + exit 1 + elif [ "${REDHAT}" == "no" ]; then + echo "The AUTOSTART [-s] option may not be needed on your distribution." + fi + sudo service plexmediaserver start +fi + exit 0