From fddad2718fb994d4fd016c03e1e05ef6c67aae14 Mon Sep 17 00:00:00 2001 From: Antoine Joubert Date: Mon, 16 Dec 2019 17:57:13 +0100 Subject: [PATCH] rec: debian postinst / do not fail on user creation if it already exists --- .../debian/recursor/debian-buster/pdns-recursor.postinst | 8 ++++++-- .../debian/recursor/debian-jessie/pdns-recursor.postinst | 8 ++++++-- .../debian/recursor/debian-stretch/pdns-recursor.postinst | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/builder-support/debian/recursor/debian-buster/pdns-recursor.postinst b/builder-support/debian/recursor/debian-buster/pdns-recursor.postinst index c4a755daad..4e1da70992 100644 --- a/builder-support/debian/recursor/debian-buster/pdns-recursor.postinst +++ b/builder-support/debian/recursor/debian-buster/pdns-recursor.postinst @@ -3,8 +3,12 @@ set -e case "$1" in configure) - addgroup --system pdns - adduser --system --home /var/spool/powerdns --shell /bin/false --ingroup pdns --disabled-password --disabled-login --gecos "PowerDNS" pdns + if [ -z "`getent group pdns`" ]; then + addgroup --system pdns + fi + if [ -z "`getent passwd pdns`" ]; then + adduser --system --home /var/spool/powerdns --shell /bin/false --ingroup pdns --disabled-password --disabled-login --gecos "PowerDNS" pdns + fi if [ "`stat -c '%U:%G' /etc/powerdns/recursor.conf`" = "root:root" ]; then chown root:pdns /etc/powerdns/recursor.conf # Make sure that pdns can read it; the default used to be 0600 diff --git a/builder-support/debian/recursor/debian-jessie/pdns-recursor.postinst b/builder-support/debian/recursor/debian-jessie/pdns-recursor.postinst index c4a755daad..4e1da70992 100644 --- a/builder-support/debian/recursor/debian-jessie/pdns-recursor.postinst +++ b/builder-support/debian/recursor/debian-jessie/pdns-recursor.postinst @@ -3,8 +3,12 @@ set -e case "$1" in configure) - addgroup --system pdns - adduser --system --home /var/spool/powerdns --shell /bin/false --ingroup pdns --disabled-password --disabled-login --gecos "PowerDNS" pdns + if [ -z "`getent group pdns`" ]; then + addgroup --system pdns + fi + if [ -z "`getent passwd pdns`" ]; then + adduser --system --home /var/spool/powerdns --shell /bin/false --ingroup pdns --disabled-password --disabled-login --gecos "PowerDNS" pdns + fi if [ "`stat -c '%U:%G' /etc/powerdns/recursor.conf`" = "root:root" ]; then chown root:pdns /etc/powerdns/recursor.conf # Make sure that pdns can read it; the default used to be 0600 diff --git a/builder-support/debian/recursor/debian-stretch/pdns-recursor.postinst b/builder-support/debian/recursor/debian-stretch/pdns-recursor.postinst index c4a755daad..4e1da70992 100644 --- a/builder-support/debian/recursor/debian-stretch/pdns-recursor.postinst +++ b/builder-support/debian/recursor/debian-stretch/pdns-recursor.postinst @@ -3,8 +3,12 @@ set -e case "$1" in configure) - addgroup --system pdns - adduser --system --home /var/spool/powerdns --shell /bin/false --ingroup pdns --disabled-password --disabled-login --gecos "PowerDNS" pdns + if [ -z "`getent group pdns`" ]; then + addgroup --system pdns + fi + if [ -z "`getent passwd pdns`" ]; then + adduser --system --home /var/spool/powerdns --shell /bin/false --ingroup pdns --disabled-password --disabled-login --gecos "PowerDNS" pdns + fi if [ "`stat -c '%U:%G' /etc/powerdns/recursor.conf`" = "root:root" ]; then chown root:pdns /etc/powerdns/recursor.conf # Make sure that pdns can read it; the default used to be 0600 -- 2.47.2