From b84c9c171280ec5aca2093a87638bb4b8d0c0800 Mon Sep 17 00:00:00 2001 From: Antoine Jacoutot Date: Sat, 18 Jul 2015 20:27:38 +0000 Subject: Add groups before users. --- usr.sbin/sysmerge/sysmerge.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'usr.sbin/sysmerge') diff --git a/usr.sbin/sysmerge/sysmerge.sh b/usr.sbin/sysmerge/sysmerge.sh index aa507bdcfd8..0134ff9afd7 100644 --- a/usr.sbin/sysmerge/sysmerge.sh +++ b/usr.sbin/sysmerge/sysmerge.sh @@ -1,6 +1,6 @@ #!/bin/ksh - # -# $OpenBSD: sysmerge.sh,v 1.196 2015/06/02 17:29:28 jung Exp $ +# $OpenBSD: sysmerge.sh,v 1.197 2015/07/18 20:27:37 ajacoutot Exp $ # # Copyright (c) 2008-2014 Antoine Jacoutot # Copyright (c) 1998-2003 Douglas Barton @@ -335,11 +335,19 @@ sm_install() { sm_add_user_grp() { local _g _p _gid _l _u _rest _newgrp _newusr - local _pw=./etc/master.passwd local _gr=./etc/group + local _pw=./etc/master.passwd ${PKGMODE} && return + while IFS=: read -r -- _g _p _gid _rest; do + if ! grep -Eq "^${_g}:" /etc/group; then + echo "===> Adding the ${_g} group" + groupadd -g ${_gid} ${_g} && \ + set -A _newgrp -- ${_newgrp[@]} ${_g} + fi + done <${_gr} + while read _l; do _u=${_l%%:*} if [[ ${_u} != root ]]; then @@ -350,14 +358,6 @@ sm_add_user_grp() { fi fi done <${_pw} - - while IFS=: read -r -- _g _p _gid _rest; do - if ! grep -Eq "^${_g}:" /etc/group; then - echo "===> Adding the ${_g} group" - groupadd -g ${_gid} ${_g} && \ - set -A _newgrp -- ${_newgrp[@]} ${_g} - fi - done <${_gr} } sm_merge_loop() { -- cgit v1.2.3