From d6f7a9555f5115ab60cb95c02a6b477e9340dcf8 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 28 Sep 2022 20:49:41 -0400 Subject: [PATCH] *Add systemd service to package --- nfpm.yaml | 6 ++++++ pkg/scripts/postinstall.sh | 3 +++ pkg/scripts/preremove.sh | 3 +++ systemd.service | 13 +++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 pkg/scripts/postinstall.sh create mode 100644 pkg/scripts/preremove.sh create mode 100644 systemd.service diff --git a/nfpm.yaml b/nfpm.yaml index 06861e5..2e45d77 100644 --- a/nfpm.yaml +++ b/nfpm.yaml @@ -14,5 +14,11 @@ license: "MIT" contents: - src: ./dist/index dst: /usr/bin/lumeweb-relay +- src: ./systemd.service + dst: /etc/systemd/system/lumeweb-relay.service + type: config depends: - lumeweb-relay-plugin-core +scripts: + postinstall: ./pkg/scripts/postinstall.sh + preremove: ./pkg/scripts/preremove.sh diff --git a/pkg/scripts/postinstall.sh b/pkg/scripts/postinstall.sh new file mode 100644 index 0000000..e0ab4b1 --- /dev/null +++ b/pkg/scripts/postinstall.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +systemctl enable lumeweb-relay.service diff --git a/pkg/scripts/preremove.sh b/pkg/scripts/preremove.sh new file mode 100644 index 0000000..0889194 --- /dev/null +++ b/pkg/scripts/preremove.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +systemctl disable lumeweb-relay.service diff --git a/systemd.service b/systemd.service new file mode 100644 index 0000000..7150f17 --- /dev/null +++ b/systemd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Lume Web Relay +After=network.target +Wants=network-online.target + +[Service] +Restart=always +Type=simple +ExecStart=/usr/bin/lumeweb-relay +Environment= + +[Install] +WantedBy=multi-user.target