Browse Source

Create n2n user and use in the supernode service

pull/149/head
emanuele-f 5 years ago
parent
commit
636c57768f
  1. 10
      packages/debian/debian/postinst
  2. 3
      packages/etc/systemd/system/supernode.service.in
  3. 10
      packages/rpm/n2n.spec.in

10
packages/debian/debian/postinst

@ -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

3
packages/etc/systemd/system/supernode.service.in

@ -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

10
packages/rpm/n2n.spec.in

@ -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

Loading…
Cancel
Save