diff --git a/HostConfig.sh b/HostConfig.sh index 065b2e1..323d5bc 100644 --- a/HostConfig.sh +++ b/HostConfig.sh @@ -1,3 +1,45 @@ + +# Extract specified value from override file if it exists (Null if not) +GetOverride() { + + Retval="" + + # Don't know if we have pushd so do it long hand + CurrDir="$(pwd)" + + # Find the metadata dir if customized + if [ -e /etc/systemd/system/plexmediaserver.service.d ]; then + + # Get there + cd /etc/systemd/system/plexmediaserver.service.d + + # Glob up all 'conf files' found + ConfFile="$(find override.conf local.conf *.conf 2>/dev/null | head -1)" + + # If there is one, search it + if [ "$ConfFile" != "" ]; then + Retval="$(grep "$1" $ConfFile | head -1 | sed -e "s/.*${1}=//" | tr -d \" | tr -d \')" + fi + + fi + + # Go back to where we were + cd "$CurrDir" + + # What did we find + echo "$Retval" +} + +# Universal output function +Output() { + if [ $Scripted -gt 0 ]; then + echo \[$(date "+%Y-%m-%d %H.%M.%S")\] "$@" + else + echo "$@" + fi + # $LOG_TOOL \[$(date "+%Y-%m-%d %H.%M.%S")\] "$@" +} + # Determine which host we are running on and set variables HostConfig() {