summaryrefslogtreecommitdiffstats
path: root/scripts/sh/_templates/goapps/deploy_app.sh
diff options
context:
space:
mode:
authorPratyush Desai2021-12-22 05:13:49 +0100
committerPratyush Desai2021-12-22 05:13:49 +0100
commitdc8f806686172d490ae50ac0f9f5d2cdc887d61b (patch)
treeca0e9662475f508ac499ed285521c2a1b79d1497 /scripts/sh/_templates/goapps/deploy_app.sh
parent53bd1dc536c07e5230bafc6c1b05ffd6f8fd471b (diff)
parent628d53cb3f51749e2f22a5fc83b1c5592b848dac (diff)
downloadsystem-dc8f806686172d490ae50ac0f9f5d2cdc887d61b.tar.gz
system-dc8f806686172d490ae50ac0f9f5d2cdc887d61b.tar.bz2
system-dc8f806686172d490ae50ac0f9f5d2cdc887d61b.zip
Merge pull request 'sh templates and owncast unit file' (#9) from script_owncast into master
Reviewed-on: https://git.com.de/LibertaCasa/system/pulls/9
Diffstat (limited to 'scripts/sh/_templates/goapps/deploy_app.sh')
-rw-r--r--scripts/sh/_templates/goapps/deploy_app.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/sh/_templates/goapps/deploy_app.sh b/scripts/sh/_templates/goapps/deploy_app.sh
new file mode 100644
index 0000000..74762ad
--- /dev/null
+++ b/scripts/sh/_templates/goapps/deploy_app.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+DISTRIB=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
+echo "Detected $DISTRIB"
+if [ ${DISTRIB} = "openSUSE Leap" ]
+echo
+then
+if [ ! -d /opt/app ]
+then
+echo "app not found. Preparing Install"
+
+# Distrib package manager installs deps
+zypper in --no-recommends -y git make
+REPO="<repo_url.git>"
+mkdir /opt/app
+useradd -rUd /opt/app -s /bin/false app
+chown app:app /opt/app
+chmod 750 /opt/app
+usermod -aG app pratyush
+usermod -aG app georg
+sudo -u app git clone $REPO /opt/app/app-git
+cd /opt/app/app-git || exit
+sudo -u app make build
+sudo -u app chmod +x app
+ln -s /opt/app/app-git/app /opt/app/app
+
+# Insert application specific commands here.
+
+# consider a change in directory structure based on applications?
+# update the statement below accordingly.
+sudo cp path/to/unitfile /etc/systemd/system/app.service
+sudo systemctl daemon-reload
+sudo systemctl enable --now app.service
+else
+echo "Existing app installation or leftovers detected. Consider remove_app.sh."
+fi
+else
+echo "This is currently only compatible with SUSE Leap nodes."
+fi \ No newline at end of file