86-all-groups 718 Bytes
Newer Older
1 2 3 4 5
#!/bin/sh -efu
### Ensure that all the necesary system groups exist

SCRIPT="/usr/share/install2/postinstall.d/86-all-groups"

6 7 8
# the script will be packaged into the installer-common-stage2
[ ! -x "$SCRIPT" ] || exit 0

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
cat > "$SCRIPT" << EOF
#!/bin/sh -efu

. install2-init-functions

# don't override the script start message on the same line
echo "Ensuring that all the necesary system groups exist"

echo '/usr/share/install3/default-groups
/etc/alterator/auth/user-groups
/etc/alterator/auth/admin-groups' \
| while read LIST; do
    [ -s "\$destdir\$LIST" ] || continue
    for GROUP in \$(cat "\$destdir\$LIST"); do
        exec_chroot groupadd -r "\$GROUP" &>/dev/null ||:
    done
done
EOF
chmod +x "$SCRIPT"