mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-07-15 09:42:58 -07:00
Moved root test for autostart
Better to fail early than to wait until the last moment. Also improved help text.
This commit is contained in:
parent
7eec8724e8
commit
5ef0da8489
1 changed files with 5 additions and 9 deletions
|
@ -80,7 +80,7 @@ set -- $(getopt aufhko: -- "$@")
|
||||||
while true;
|
while true;
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
(-h) echo -e "Usage: $(basename $0) [-afhkop]\n\na = Auto install if download was successful (requires root)\nd = Auto delete after auto install\nf = Force download even if it's the same version or file already exists (WILL NOT OVERWRITE)\nh = This help\nk = Reuse last authentication\no = 32-bit version (default 64 bit)\np = Public Plex Media Server version\nu = Auto update plexupdate.sh before running it (experimental)\n"; exit 0;;
|
(-h) echo -e "Usage: $(basename $0) [-afhkopsuU]\n\na = Auto install if download was successful (requires root)\nd = Auto delete after auto install\nf = Force download even if it's the same version or file already exists (WILL NOT OVERWRITE)\nh = This help\nk = Reuse last authentication\no = 32-bit version (default 64 bit)\np = Public Plex Media Server version\nu = Auto update plexupdate.sh before running it (experimental)\nU = Do not autoupdate plexupdate.sh (experimental, default)\ns = Auto start (needed for some distros)\n"; exit 0;;
|
||||||
(-a) AUTOINSTALL=yes;;
|
(-a) AUTOINSTALL=yes;;
|
||||||
(-d) AUTODELETE=yes;;
|
(-d) AUTODELETE=yes;;
|
||||||
(-f) FORCE=yes;;
|
(-f) FORCE=yes;;
|
||||||
|
@ -131,10 +131,10 @@ if [ "${EMAIL}" == "" -o "${PASS}" == "" ] && [ "${PUBLIC}" == "no" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${AUTOINSTALL}" == "yes" ]; then
|
if [ "${AUTOINSTALL}" == "yes" -o "${AUTOSTART}" == "yes" ]; then
|
||||||
id | grep 'uid=0(' 2>&1 >/dev/null
|
id | grep 'uid=0(' 2>&1 >/dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error: You need to be root to use autoinstall option."
|
echo "Error: You need to be root to use autoinstall/autostart option."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -314,14 +314,10 @@ if [ "${AUTODELETE}" == "yes" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${AUTOSTART}" == "yes" ]; then
|
if [ "${AUTOSTART}" == "yes" ]; then
|
||||||
id | grep 'uid=0(' 2>&1 >/dev/null
|
if [ "${REDHAT}" == "no" ]; then
|
||||||
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."
|
echo "The AUTOSTART [-s] option may not be needed on your distribution."
|
||||||
fi
|
fi
|
||||||
sudo service plexmediaserver start
|
service plexmediaserver start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue