Add 'bor' user during package installation

This commit is contained in:
Jerry 2022-07-28 12:33:23 -07:00
parent 6e8428bfaa
commit cd04702345
3 changed files with 19 additions and 1 deletions

View file

@ -75,12 +75,18 @@ nfpms:
description: Polygon Blockchain description: Polygon Blockchain
license: GPLv3 LGPLv3 license: GPLv3 LGPLv3
bindir: /usr/local/bin
formats: formats:
- apk - apk
- deb - deb
- rpm - rpm
contents: contents:
- dst: /var/lib/bor
type: dir
file_info:
mode: 0777
- src: builder/files/bor.service - src: builder/files/bor.service
dst: /lib/systemd/system/bor.service dst: /lib/systemd/system/bor.service
type: config type: config
@ -94,6 +100,9 @@ nfpms:
dst: /var/lib/bor/config.toml dst: /var/lib/bor/config.toml
type: config type: config
scripts:
postinstall: builder/files/bor-post-install.sh
overrides: overrides:
rpm: rpm:
replacements: replacements:

View file

@ -0,0 +1,9 @@
#!/bin/sh
set -e
PKG="bor"
if ! getent passwd $PKG >/dev/null ; then
adduser --disabled-password --disabled-login --shell /usr/sbin/nologin --quiet --system --no-create-home --home /nonexistent $PKG
echo "Created system user $PKG"
fi

View file

@ -8,7 +8,7 @@
RestartSec=5s RestartSec=5s
ExecStart=/usr/local/bin/bor server -config="/var/lib/bor/config.toml" ExecStart=/usr/local/bin/bor server -config="/var/lib/bor/config.toml"
Type=simple Type=simple
User=ubuntu User=bor
KillSignal=SIGINT KillSignal=SIGINT
TimeoutStopSec=120 TimeoutStopSec=120