Create n2n user and use in the supernode service

This commit is contained in:
emanuele-f 2019-06-19 00:07:14 +02:00
parent 4ca0ae34a4
commit 636c57768f
3 changed files with 22 additions and 1 deletions

View File

@ -17,6 +17,16 @@ esac
umask 022
if ! grep -q n2n /etc/group; then
echo 'Creating n2n group'
/usr/sbin/groupadd -r n2n
fi
if ! /usr/bin/id -u n2n > /dev/null 2>&1; then
echo "Creating n2n user..."
/usr/sbin/useradd -M -N -g n2n -r -s /bin/false n2n
fi
echo "Rebuilding ld cache..."
/sbin/ldconfig

View File

@ -5,7 +5,8 @@ Wants=network-online.target
[Service]
Type=simple
ExecStartPre=
User=n2n
Group=n2n
ExecStart=/usr/sbin/supernode /etc/n2n/supernode.conf -f
Restart=on-abnormal
RestartSec=5

View File

@ -69,6 +69,16 @@ rm -fr $RPM_BUILD_ROOT
%pre
if ! grep -q n2n /etc/group; then
echo 'Creating n2n group'
/usr/sbin/groupadd -r n2n
fi
if ! /usr/bin/id -u n2n > /dev/null 2>&1; then
echo 'Creating n2n user'
/usr/sbin/useradd -M -N -g n2n -r -s /bin/false n2n
fi
%post
if [ ! -f /.dockerenv ]; then
/bin/systemctl daemon-reload