From ae1680fdef094c2ec9ce2327da8c59924df361c7 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 17 Sep 2017 21:21:11 -0500 Subject: adelie-build-cd: adelie-base provides group/passwd/shadow now --- addgroup | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 addgroup (limited to 'addgroup') diff --git a/addgroup b/addgroup new file mode 100755 index 0000000..051df36 --- /dev/null +++ b/addgroup @@ -0,0 +1,36 @@ +#!/bin/sh +# addgroup - BusyBox compatibility shim +# bbshim +# +# Copyright © 2017 A. Wilcox. All rights reserved. +# Licensed under the terms of the NCSA Open Source license. +# + +ARG= +CMDLINE= + +while getopts :g:S ARG +do + case $ARG in + g) CMDLINE="$CMDLINE -g \"$OPTARG\"" ;; + S) CMDLINE="$CMDLINE -r" ;; + :) exit 1 ;; + \?) exit 1 ;; + esac +done + +shift $(($OPTIND - 1)) + +if [ -z "$*" ]; then + echo "$0: group name is required" >&2 + exit 1 +fi + +set "$@" + + +if [ -n "$2" ]; then + exec usermod -a -G $2 $1 +fi + +groupadd $CMDLINE $1 -- cgit v1.2.3-70-g09d2