diff --git a/sysuser-tools.changes b/sysuser-tools.changes index 569db8d..a77dcb5 100644 --- a/sysuser-tools.changes +++ b/sysuser-tools.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Sep 27 11:06:52 UTC 2017 - dimstar@opensuse.org + +- sysusers2shadow.sh: Exit if one of the useradd/groupadd/usermod + call fails: the resulting system is quite undefined if this + should happen. +- sysusers-generate-pre: exit the pre script with the exit code + of sysusers2shadow.sh. + ------------------------------------------------------------------- Mon Jun 19 14:07:51 CEST 2017 - kukuk@suse.de diff --git a/sysusers-generate-pre b/sysusers-generate-pre index 4ac7c81..d10d4f6 100644 --- a/sysusers-generate-pre +++ b/sysusers-generate-pre @@ -19,6 +19,6 @@ lines=`wc -l < "$tmpfile"` echo '#!/bin/bash' echo "tail -n $lines \$0 | /usr/sbin/sysusers2shadow" -echo "exit 0" +echo "exit $?" echo '######## data below ########' cat "$tmpfile" diff --git a/sysusers2shadow.sh b/sysusers2shadow.sh index 618efb5..61d28f0 100644 --- a/sysusers2shadow.sh +++ b/sysusers2shadow.sh @@ -12,7 +12,7 @@ do ARGUMENTS="-g ${arr[2]} $ARGUMENTS" fi echo "groupadd -r $ARGUMENTS" - /usr/bin/getent group "${arr[1]}" >> /dev/null || /usr/sbin/groupadd -r $ARGUMENTS + /usr/bin/getent group "${arr[1]}" >> /dev/null || /usr/sbin/groupadd -r $ARGUMENTS || exit $? ;; u*) eval arr=( $LINE ) @@ -30,12 +30,12 @@ do ARGUMENTS="-U $ARGUMENTS" fi echo "useradd -r -s /sbin/nologin -c \"${arr[3]}\" $ARGUMENTS" - /usr/bin/getent passwd ${arr[1]} >> /dev/null || /usr/sbin/useradd -r -s /sbin/nologin -c "${arr[3]}" $ARGUMENTS + /usr/bin/getent passwd ${arr[1]} >> /dev/null || /usr/sbin/useradd -r -s /sbin/nologin -c "${arr[3]}" $ARGUMENTS || exit $? ;; m*) eval arr=( $LINE ) echo "usermod -a -G ${arr[2]} ${arr[1]}" - /usr/sbin/usermod -a -G ${arr[2]} ${arr[1]} + /usr/sbin/usermod -a -G ${arr[2]} ${arr[1]} || exit $? ;; r*) echo "range option ignored: \"$LINE\""