diff options
Diffstat (limited to 'gogios.install')
-rw-r--r-- | gogios.install | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gogios.install b/gogios.install new file mode 100644 index 000000000000..b65fc5040178 --- /dev/null +++ b/gogios.install @@ -0,0 +1,34 @@ +post_install() { + if [ ! -f /etc/gingertechengine/checks.json ]; then + echo "Making default check file" + mv /etc/gingertechengine/example.json /etc/gingertechengine/checks.json + fi + + if [ ! -f /etc/gingertechengine/gogios.toml ]; then + echo "Making default config" + cp /etc/gingertechengine/gogios.sample.toml /etc/gingertechengine/gogios.toml + fi + + if id "gogios" >/dev/null 2>&1; then + echo "gogios user already exists" + else + useradd --system --no-create-home --shell /sbin/nologin gogios + fi + + chown gogios:gogios -R /var/log/gingertechnology + chown gogios:gogios -R /usr/lib/gingertechengine + chown gogios:gogios -R /etc/gingertechengine + chown gogios:gogios -R /opt/gingertechengine +} + +post_upgrade() { + post_install + + systemctl restart gogios +} + +pre_remove() { + systemctl stop gogios + systemctl disable gogios +} + |