diff options
author | Georg | 2022-01-02 06:36:45 +0100 |
---|---|---|
committer | Georg | 2022-01-02 06:36:45 +0100 |
commit | 935b8c642f8aaed31bca17faccaedf0e57ba9efd (patch) | |
tree | deb1d2bdd53aef299f59fb1aebc459884fc264f3 /scripts/sh/_templates/goapps/remove_app.sh | |
parent | 134560a32d52329a59906de5392e69df9608368c (diff) | |
parent | dc8f806686172d490ae50ac0f9f5d2cdc887d61b (diff) | |
download | system-935b8c642f8aaed31bca17faccaedf0e57ba9efd.tar.gz system-935b8c642f8aaed31bca17faccaedf0e57ba9efd.tar.bz2 system-935b8c642f8aaed31bca17faccaedf0e57ba9efd.zip |
Merge branch 'master' of ssh://git.com.de:28/LibertaCasa/system
Diffstat (limited to 'scripts/sh/_templates/goapps/remove_app.sh')
-rw-r--r-- | scripts/sh/_templates/goapps/remove_app.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/sh/_templates/goapps/remove_app.sh b/scripts/sh/_templates/goapps/remove_app.sh new file mode 100644 index 0000000..1def777 --- /dev/null +++ b/scripts/sh/_templates/goapps/remove_app.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Check for existing installation in `/opt`. + +if [ ! -d /opt/app ] +then +echo "This will kill running app services and cause data loss! Remove app? " +read text -r + +# https://github.com/koalaman/shellcheck/wiki/SC3015 +# https://github.com/koalaman/shellcheck/wiki/SC2003 +# Need a POSIX compatible regex soln below! +expr "$text" : "^[Yy]$" > /dev/null +if [ "$text" ] +then +echo "Removing app" +systemctl disable --now app.service || true +rm -f /etc/systemd/system/app.service +rm -rf /opt/app +userdel -f app +groupdel -f app +echo "OK" +fi +else +echo "Could not find a compatible installation of app." +fi |