From 227e3a61d9584e9e2d64d27ca732e491d8097621 Mon Sep 17 00:00:00 2001 From: Avi Date: Tue, 7 Nov 2017 14:32:04 -0600 Subject: [PATCH 1/5] Update issue_template.md --- .github/issue_template.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/issue_template.md b/.github/issue_template.md index 354f2ff..5e7947c 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -1,12 +1,12 @@ + #### First Checks: Replace the check box for each line with a ☑ or 'x' after confirming. From 6dd444bd85b26be3558de7d21d44df01120f5c3d Mon Sep 17 00:00:00 2001 From: Avi Date: Tue, 7 Nov 2017 14:33:06 -0600 Subject: [PATCH 2/5] Update issue_template.md --- .github/issue_template.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/issue_template.md b/.github/issue_template.md index 5e7947c..46c36dd 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -1,10 +1,14 @@ #### First Checks: From bcba7ee1de6abc04293c820b3ec146d318c5f91e Mon Sep 17 00:00:00 2001 From: Avi Date: Wed, 15 Nov 2017 12:19:28 -0600 Subject: [PATCH 3/5] Fix extra spaces (#10) Fix for extra spaces in log message when update takes under a minute. --- update_ombi.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/update_ombi.sh b/update_ombi.sh index 9fd9eff..6b322bb 100644 --- a/update_ombi.sh +++ b/update_ombi.sh @@ -306,5 +306,6 @@ if [ $seconds -ge 2 ]; then elif [ $seconds -eq 1 ]; then duration+=" $seconds second" fi -duration="${duration// / }" -.log 6 "Update complete...elapsed time $duration..." \ No newline at end of file +durationmsg="Update complete...elapsed time $duration..." +durationmsg="${durationmsg// / }" +.log 6 "$durationmsg" \ No newline at end of file From 715616ca0140d15b28340d5947e9017eddf28fc5 Mon Sep 17 00:00:00 2001 From: Avi Date: Wed, 15 Nov 2017 16:09:33 -0600 Subject: [PATCH 4/5] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 93207e5..eeae48c 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Ombi (tidusjar/Ombi) update script for Systemd (Ubuntu based distros) > * Installation Dir: **/opt/Ombi** > * User: **ombi** > * Group: **nogroup** +> * URL: **http://127.0.0.1:5000** > > The script also logs to /var/log/ombiupdater.log by default. Make sure that the user running the script has write access to this file. > You can override these defaults by setting the variables in the **Default variables** section at the top. @@ -45,4 +46,4 @@ ombi ALL=NOPASSWD: /bin/systemctl stop ombi.service, /bin/systemctl start omb ``` > ### Note: -> This assumes you're running the script as **ombi** and that the systemd service is named **ombi**. \ No newline at end of file +> This assumes you're running the script as **ombi** and that the systemd service is named **ombi**. From d0a39da0b9124ce7e708d01505b17445ec638cde Mon Sep 17 00:00:00 2001 From: Avi Date: Sun, 19 Nov 2017 01:42:40 -0600 Subject: [PATCH 5/5] IP/Port parsing Refactor parsing to accurately detect IP and port. Fix a few non-critical bugs. --- update_ombi.sh | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/update_ombi.sh b/update_ombi.sh index 6b322bb..9812e6f 100644 --- a/update_ombi.sh +++ b/update_ombi.sh @@ -38,7 +38,8 @@ defaultinstalldir="/opt/Ombi" ## User and Group Ombi runs as ## defaultuser="ombi" defaultgroup="nogroup" -defaulturl="http://127.0.0.1:5000" +defaultip="127.0.0.1" +defaultport="5000" ## Level of verbosity ## ## By default, none ## @@ -51,7 +52,7 @@ declare -i verbosity=-1 ############################################ name="update_ombi" -version="1.0.14" +version="1.1.01" SECONDS=0 while [ $# -gt 0 ]; do @@ -121,31 +122,54 @@ scriptuser=$(whoami) .log 7 "Update script running as: $scriptuser" if [ -e $ombiservicefile ]; then .log 6 "Ombi service file for systemd found...parsing..." + parseresults="Parsing complete: " ombiservice=$(<$ombiservicefile) installdir=$(grep -Po '(?<=WorkingDirectory=)(\S|(?<=\\)\s)+' <<< "$ombiservice") + if [ -n "${installdir}" ]; then + parseresults+="InstallDir: $installdir, " + fi user=$(grep -Po '(?<=User=)(\w+)' <<< "$ombiservice") + if [ -n "${user}" ]; then + parseresults+="User: $user, " + fi group=$(grep -Po '(?<=Group=)(\w+)' <<< "$ombiservice") - url=$(grep -Po '(?<=\-\-host )(.+)$' <<< "$ombiservice") - .log 6 "Parsing complete: InstallDir: $installdir, User: $user, Group: $group, URL: $url" + if [ -n "${group}" ]; then + parseresults+="Group: $group, " + fi + url=$(grep -Po '(?<=\-\-host )(http://.+)$' <<< "$ombiservice") + ip=$(grep -Po '(?<=http://)([\d\.]+):' <<< "$url") + if [ -n "${ip}" ]; then + parseresults+="IP: $ip, " + fi + port=$(grep -Po '(?<=:)(\d+)$' <<< "$url") + if [ -n "${port}" ]; then + parseresults+="Port: $port " + fi + parseresults="${parseresults// / }" + parseresults="${parseresults/%, /sudo }" + .log 6 "$parseresults" fi -if [ -z ${installdir+x} ]; then +if [ -z "${installdir}" ]; then .log 5 "InstallDir not parsed...setting to default: $defaultinstalldir" installdir="$defaultinstalldir" fi -if [ -z ${user+x} ]; then +if [ -z "${user}" ]; then .log 5 "User not parsed...setting to default: $defaultuser" user="$defaultuser" fi -if [ -z ${group+x} ]; then +if [ -z "${group}" ]; then .log 5 "Group not parsed...setting to default: $defaultgroup" group="$defaultgroup" fi -if [ -z ${url+x} ]; then - .log 5 "URL not parsed...setting to default: $defaulturl" - url="$defaulturl" +if [ -z "${ip}" ]; then + .log 5 "IP not parsed or set as \"*\"...setting to default: $defaultip" + ip="$defaultip" +fi +if [ -z "${port}" ]; then + .log 5 "Port not parsed...setting to default: $defaultport" + port="$defaultport" fi - .log 6 "Downloading Ombi update..." declare -i i=1 @@ -264,7 +288,7 @@ if [ $running -eq 1 ]; then while [ $k -le $l ] do sleep 5 - curl -sIL $url > /dev/null 2>&1 + curl -sIL $ip:$port > /dev/null 2>&1 if [ $? -ne 0 ]; then if [ $k -lt $l ]; then .log 4 "Ombi startup not confirmed...waiting 5 seconds...[attempt $k of $l]" @@ -292,6 +316,8 @@ fi .log 6 "Cleaning up..." rm -rf "$tempdir"/* "$tempdir" declare -i elapsedtime=$SECONDS +declare -i minutes=0 +declare -i seconds=0 if [ $elapsedtime -ge 60 ]; then minutes=$(($elapsedtime / 60)) fi