diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2017-09-17 21:21:11 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2017-09-17 21:21:11 -0500 |
commit | ae1680fdef094c2ec9ce2327da8c59924df361c7 (patch) | |
tree | 4f100e931abc1e97f37d0ff077bb00716f506eff /addgroup | |
parent | 94d3ade3514db4652d76d7ca4014569fcf13e2be (diff) | |
download | image-ae1680fdef094c2ec9ce2327da8c59924df361c7.tar.gz image-ae1680fdef094c2ec9ce2327da8c59924df361c7.tar.bz2 image-ae1680fdef094c2ec9ce2327da8c59924df361c7.tar.xz image-ae1680fdef094c2ec9ce2327da8c59924df361c7.zip |
adelie-build-cd: adelie-base provides group/passwd/shadow now
Diffstat (limited to 'addgroup')
-rwxr-xr-x | addgroup | 36 |
1 files changed, 36 insertions, 0 deletions
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 |