From: thib Date: Sat, 27 Jan 2001 15:32:46 +0000 (+0000) Subject: bug corrected: use $USERNAME instead of "fcron" X-Git-Tag: ver1564~363 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6b114cb4ebca29818f162460b04176cc6b216fb;p=fcron bug corrected: use $USERNAME instead of "fcron" added code to add group fcron --- diff --git a/script/user-group b/script/user-group index d960432..27c48d7 100755 --- a/script/user-group +++ b/script/user-group @@ -4,7 +4,7 @@ # them if necessary. # -# $Id: user-group,v 1.3 2001-01-07 12:45:38 thib Exp $ +# $Id: user-group,v 1.4 2001-01-27 15:32:46 thib Exp $ # take 3 arguments : username # groupname @@ -31,9 +31,9 @@ else echo "no." CMD="" if useradd -D 2> /dev/null; then - CMD="useradd -c 'fcron' fcron" + CMD="useradd -c '$USERNAME' $USERNAME" elif adduser -D 2> /dev/null; then - CMD="adduser -c 'fcron' fcron" + CMD="adduser -c '$USERNAME' $USERNAME" fi if test -z "$CMD"; then echo "Could not determine the command to use to add a user." @@ -67,3 +67,47 @@ if test $INSTALLED -eq 0; then echo "with configure script." exit 1 fi + + +INSTALL="nothing" +INSTALLED=0 +CMD="groupadd $GROUPNAME" + +echo -n "Checking if $GROUPNAME is in /etc/group ... " +if grep "^$GROUPNAME:" /etc/group > /dev/null; then + echo "yes." + INSTALLED=1 +else + echo "no." + if test -z "$CMD"; then + echo "Could not determine the command to use to add a group." + echo "Please add group \"GROUPNAME\" manually" + echo "(or choose another groupname with configure script)." + exit 1 + fi + if test $ANSWER -eq 2; then + while test \( ! -z "$INSTALL" \) -a \( "$INSTALL" != "y" \) -a \( "$INSTALL" != "n" \); + do + echo "Would you like to add $GROUPNAME in /etc/passwd with the following command ?" + echo " $CMD" + read -p "Please answer with 'y' or 'n' (default: 'y'): " INSTALL NOTHING + done + if test \( -z "$INSTALL" \) -o \( "$INSTALL" = "y" \); then + if $CMD; then + INSTALLED=1 + fi + fi + elif test $ANSWER -eq 1; then + # automatic answer given by configure script (option --with-answer-all) + if $CMD; then + INSTALLED=1 + fi + fi +fi + + +if test $INSTALLED -eq 0; then + echo "Group $GROUPNAME does not exist : please create it or choose another groupname" + echo "with configure script." + exit 1 +fi