Last active
January 29, 2018 21:48
-
-
Save dcrdev/8fbc9280045dad89b333d74a307fb131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
initScriptLocation="/etc/init/emby-server.conf" | |
function main() { | |
service emby-server stop | |
read -p 'Username: ' euser | |
if [ -d "/var/lib/emby" ]; then | |
chown -R "$euser":"$euser" "/var/lib/emby"; | |
else | |
chown -R "$euser":"$euser" "/var/lib/emby-server"; | |
fi | |
sed -i "s/setuid emby/setuid $euser/g" "$initScriptLocation" | |
initctl reload-configuration | |
service emby-server start | |
} | |
function elevate { | |
echo "Attempting to Elevate..." 1>&2 | |
sudo "$0" "$@" | |
exit $? | |
} | |
# Test for root. | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root!" | |
elevate | |
fi | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment