From 625d6b643e7292aab8c547bffaf90234c3d5ec7c Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 2 Oct 2017 23:27:12 +0200 Subject: [PATCH 1/6] Update README.md Fixing description on how to install the service --- service/README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/service/README.md b/service/README.md index 58ad6f9..805ef88 100644 --- a/service/README.md +++ b/service/README.md @@ -8,10 +8,14 @@ We assume that BOSWatch is installed to /opt/boswatch! Otherwise you need to ada Enter the frequency and the decoder(s) you want to use in line 7; you can add more specific switches if you need to ### Install the service -1. Copy the file to /lib/systemd/system: sudo cp /opt/boswatch/service/boswatch.service /lib/systemd/system/ -2. Change the rights: sudo chmod 644 /lib/systemd/system/boswatch.service -3. Enable the service: sudo systemctl enable boswatch.service -4. Start the service: sudo systemctl start boswatch.service +1. Use the install-script install_service.sh as sudo: `sudo bash install_service.sh` (self explaining) + +OR + +1. Copy the file to /etc/systemd/system: sudo cp /opt/boswatch/service/boswatch.service /etc/systemd/system/ +2. Enable the service: sudo systemctl enable boswatch.service +3. Start the service: sudo systemctl start boswatch.service +4. Check the status: sudo systemctl status boswatch.service --- From d248a7d45dce3c4042a29b0fcaa04eed3ebe85e1 Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 2 Oct 2017 23:41:57 +0200 Subject: [PATCH 2/6] Installscript for service A tiny to script to install and register the service automatically There is also a possibility to remove the service --- service/install_service.sh | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 service/install_service.sh diff --git a/service/install_service.sh b/service/install_service.sh new file mode 100644 index 0000000..d973b5a --- /dev/null +++ b/service/install_service.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Tiny script to install BOSWatch-service to use it via systemctl +# Just a few simple steps are required to (un)register your service + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root!" 1>&2 + exit 1 +fi + +read -p"Do you want to install (i) or remove (r) the service? " action + +if [ "$action" == "i" ]; then + + # 1 Check whether the right data are in the service-file + + read -p"Did you adapt the file boswatch.service (y/n)? " response + + if [ "$response" == "y" ]; then + # 2 Copy the file + cp boswatch.service /etc/systemd/system + + # 3 Enable the service and check status + systemctl enable boswatch.service + systemctl is-enabled boswatch.service + + # 4 fire it up + systemctl start boswatch.service + + # 5 post the status + systemctl status boswatch.service + else + echo "Please adapt your personal boswatch.service-file" + exit 1 + fi +else # we want to remove the service + # stop it... + systemctl stop boswatch.service + + # disable it + systemctl disable boswatch.service + + # and remove it + rm /etc/systemd/system/boswatch.service +fi From eacb72adeadfa24a6836c83c9f552e9516145e9f Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 08:50:11 +0200 Subject: [PATCH 3/6] edit CL --- CHANGELOG.md | 1 + service/install_service.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5777b2f..621b231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### __[v2.2.2]__ - unreleased ##### Added +- Installations Script für Services [#316](https://github.com/Schrolli91/BOSWatch/pull/316) ##### Changed - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) ##### Deprecated diff --git a/service/install_service.sh b/service/install_service.sh index d973b5a..1ec6c7e 100644 --- a/service/install_service.sh +++ b/service/install_service.sh @@ -13,9 +13,9 @@ read -p"Do you want to install (i) or remove (r) the service? " action if [ "$action" == "i" ]; then # 1 Check whether the right data are in the service-file - + read -p"Did you adapt the file boswatch.service (y/n)? " response - + if [ "$response" == "y" ]; then # 2 Copy the file cp boswatch.service /etc/systemd/system @@ -36,7 +36,7 @@ if [ "$action" == "i" ]; then else # we want to remove the service # stop it... systemctl stop boswatch.service - + # disable it systemctl disable boswatch.service From 3fed1ac12af8690213766e0e81d71c237530ed2c Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 16:00:31 +0200 Subject: [PATCH 4/6] decouple vers nr and branch name --- boswatch.py | 1 + includes/globalVars.py | 5 +++-- includes/shellHeader.py | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/boswatch.py b/boswatch.py index e8b7b3a..f21937b 100755 --- a/boswatch.py +++ b/boswatch.py @@ -162,6 +162,7 @@ try: # try: logging.debug("SW Version: %s",globalVars.versionNr) + logging.debug("Branch: %s",globalVars.branch) logging.debug("Build Date: %s",globalVars.buildDate) logging.debug("BOSWatch given arguments") if args.test: diff --git a/includes/globalVars.py b/includes/globalVars.py index c081608..be4305d 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,8 +9,9 @@ Global variables """ # version info -versionNr = "2.2.2-dev" -buildDate = "in dev" +versionNr = "2.2.2" +branch = "dev" +buildDate = "unreleased" # Global variables diff --git a/includes/shellHeader.py b/includes/shellHeader.py index 561603a..ab82eae 100644 --- a/includes/shellHeader.py +++ b/includes/shellHeader.py @@ -31,6 +31,7 @@ def printHeader(args): print " by Bastian Schroll, Jens Herrmann " print "" print "SW Version: "+globalVars.versionNr + print "Branch: "+globalVars.branch print "Build Date: "+globalVars.buildDate print "" From e503130a03e4a9b30abea05eb1ed825b24d101a8 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 16:03:27 +0200 Subject: [PATCH 5/6] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5777b2f..4648a8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ##### Added ##### Changed - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) +- Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c) ##### Deprecated ##### Removed ##### Fixed From e86059a2f3d98847379febd2daafe7c7c4023843 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 3 Oct 2017 17:08:22 +0200 Subject: [PATCH 6/6] Update install_service.sh Adding errorhandling due to wrong input characters --- service/install_service.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/service/install_service.sh b/service/install_service.sh index 1ec6c7e..2789a35 100644 --- a/service/install_service.sh +++ b/service/install_service.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Tiny script to install BOSWatch-service to use it via systemctl +# Tiny script to install BOSWatch-service via systemctl # Just a few simple steps are required to (un)register your service if [[ $EUID -ne 0 ]]; then @@ -13,9 +13,9 @@ read -p"Do you want to install (i) or remove (r) the service? " action if [ "$action" == "i" ]; then # 1 Check whether the right data are in the service-file - + read -p"Did you adapt the file boswatch.service (y/n)? " response - + if [ "$response" == "y" ]; then # 2 Copy the file cp boswatch.service /etc/systemd/system @@ -29,17 +29,23 @@ if [ "$action" == "i" ]; then # 5 post the status systemctl status boswatch.service - else + elif [ "$response" == "n" ]; then echo "Please adapt your personal boswatch.service-file" exit 1 + else + echo "Invalid input - please try again" + exit 1 fi -else # we want to remove the service +elif [ "$action" == "r" ]; then # we want to remove the service # stop it... systemctl stop boswatch.service - + # disable it systemctl disable boswatch.service # and remove it rm /etc/systemd/system/boswatch.service +else # error handling + echo "Invalid input - please try again" + exit 1 fi