From 9abdaa8993d992d38abccecd952ae7d7b6931c37 Mon Sep 17 00:00:00 2001 From: schmidtw Date: Tue, 23 Jul 2024 18:14:52 -0700 Subject: [PATCH] chore:Add user and group for xmidt-agent, as well as set the service to preset (enabled). --- .goreleaser.yml | 5 +++++ .release/ipk/postinstall.sh | 5 +++++ .release/ipk/preinstall.sh | 13 +++++++++++++ 3 files changed, 23 insertions(+) create mode 100755 .release/ipk/postinstall.sh create mode 100755 .release/ipk/preinstall.sh diff --git a/.goreleaser.yml b/.goreleaser.yml index 33a5cb8..8ef756f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -97,9 +97,14 @@ nfpms: - src: .release/ipk/config.yml dst: /etc/xmidt-agent/01-config.yml + scripts: + preinstall: .release/ipk/preinstall.sh + postinstall: .release/ipk/postinstall.sh + ipk: fields: Bugs: https://github.com/xmidt-org/xmidt-agent/issues + - id: openwrt file_name_template: '{{ .PackageName }}_{{ .Version }}_openwrt_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}' diff --git a/.release/ipk/postinstall.sh b/.release/ipk/postinstall.sh new file mode 100755 index 0000000..48bffb6 --- /dev/null +++ b/.release/ipk/postinstall.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# SPDX-FileCopyrightText: 2024 Comcast Cable Communications Management, LLC +# SPDX-License-Identifier: Apache-2.0 + +systemctl preset xmidt-agent.service >/dev/null 2>&1 diff --git a/.release/ipk/preinstall.sh b/.release/ipk/preinstall.sh new file mode 100755 index 0000000..4623429 --- /dev/null +++ b/.release/ipk/preinstall.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# SPDX-FileCopyrightText: 2024 Comcast Cable Communications Management, LLC +# SPDX-License-Identifier: Apache-2.0 + +getent group xmidt-agent > /dev/null || groupadd -r xmidt-agent +getent passwd xmidt-agent > /dev/null || \ + useradd \ + -d /var/run/xmidt-agent \ + -r \ + -g xmidt-agent \ + -s /sbin/nologin \ + -c "Xmidt-Agent Client" \ + xmidt-agent \ No newline at end of file