Merge pull request #2 from mrworf/master

Added systemd support for AUTOSTART
This commit is contained in:
Devin Slick 2015-10-27 13:27:26 -05:00
commit f47dbd86d4
2 changed files with 18 additions and 9 deletions

View file

@ -72,3 +72,11 @@ echo -e > ~/.plexupdate 'EMAIL=<plex email account>\nPASS="<plex password>"'
nano -w ~/.plexupdate nano -w ~/.plexupdate
sudo ./plexupdate.sh -a sudo ./plexupdate.sh -a
``` ```
# FAQ
## My password is rejected even though correct
If you use certain characters, such as dollar sign, in your password, bash will interpret that as a reference to a variable. To resolve this, enclose your password with single quotes instead of the normal quotes.
Ie, `PASS="MyP4$$w0rD"` will not work, but changing to it to `PASS='MyP4$$w0rD'` will

View file

@ -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,15 @@ 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 # Check for systemd
if [ -f "/bin/systemctl" ]; then
systemctl start plexmediaserver.service
else
service plexmediaserver start
fi
fi fi
exit 0 exit 0