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