Skip to content

Commit

Permalink
Add 'heimdall' user during package installation
Browse files Browse the repository at this point in the history
  • Loading branch information
cffls committed Jul 30, 2022
1 parent a4d5d67 commit 8467363
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ nfpms:
description: Polygon Blockchain
license: GPLv3 LGPLv3

bindir: /usr/local/bin

formats:
- apk
- deb
Expand All @@ -194,6 +196,13 @@ nfpms:
- src: builder/files/genesis-testnet-v4.json
dst: /etc/heimdall/genesis-testnet-v4.json
type: config
- dst: /var/lib/heimdall
type: dir
file_info:
mode: 0777

scripts:
postinstall: builder/files/heimdall-post-install.sh

overrides:
rpm:
Expand All @@ -212,7 +221,6 @@ dockers:
ids:
- heimdalld-linux-amd64
- heimdallcli-linux-amd64
- bridge-linux-amd64
build_flag_templates:
- --platform=linux/amd64
extra_files:
Expand All @@ -228,7 +236,6 @@ dockers:
ids:
- heimdalld-linux-arm64
- heimdallcli-linux-arm64
- bridge-linux-arm64
build_flag_templates:
- --platform=linux/arm64/v8
extra_files:
Expand Down
10 changes: 10 additions & 0 deletions builder/files/heimdall-post-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -e

PKG="heimdall"

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

3 changes: 1 addition & 2 deletions builder/files/heimdalld.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
WorkingDirectory=/usr/local/bin
ExecStart=/usr/local/bin/heimdalld start --home /var/lib/heimdall \
--chain=mainnet \
--bridge --all \
--rest-server
Type=simple
User=ubuntu
LimitNOFILE=65536
User=heimdall
[Install]
WantedBy=multi-user.target

0 comments on commit 8467363

Please sign in to comment.