kadischi/post_install_scripts 07accounts.sh,1.5,1.6

Jasper O'neal Hartline (autopsy) fedora-extras-commits at redhat.com
Wed Jun 21 20:17:34 UTC 2006


Author: autopsy

Update of /cvs/devel/kadischi/post_install_scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4170/kadischi/post_install_scripts

Modified Files:
	07accounts.sh 
Log Message:
Major brush on 07accounts.sh


Index: 07accounts.sh
===================================================================
RCS file: /cvs/devel/kadischi/post_install_scripts/07accounts.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- 07accounts.sh	21 Jun 2006 16:53:59 -0000	1.5
+++ 07accounts.sh	21 Jun 2006 20:17:32 -0000	1.6
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Allow creation of addition user accounts.
-# We will let useradd handle with defaults.
+
 
 
  . /etc/kadischi/kadischi.conf
@@ -11,30 +11,39 @@
 USING_KICKSTART=$(echo $ANACONDA_ARGS | grep -G [--]kickstart)
 USING_CMDLINE=$(echo $ANACONDA_ARGS | egrep -- "-C|--cmdline")
 
+
 if [ $USING_KICKSTART ] || [ $USING_CMDLINE ]; then
    exit 0
 else
    echo "Going to user accounts configuration.."
    if [ -x /usr/bin/dialog ]; then
-      /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --yesno "A non-root user account should be created, create one now?" 5 65
-      if [ $? -eq "0" ]; then
-         /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --inputbox "Account Username:" 10 65 2>$SYSDIR/.accounts.name
-         /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --aspect 12 --radiolist "Account Shell:" 0 0 0 /bin/bash "Bourne Again Shell" on /usr/bin/ksh "Korn Shell" off /bin/csh "C Shell" off /bin/tcsh "THe C Shell" off /bin/zsh "The Z Shell" off 2>$SYSDIR/.accounts.shell
-         NEWUSERNAME=$(/bin/cat $SYSDIR/.accounts.name)
-         NEWSHELL=$(/bin/cat $SYSDIR/.accounts.shell)
-         if [ -n $NEWUSERNAME ] && [ -n $NEWSHELL ]; then
-            /usr/sbin/chroot $SYSDIR /usr/sbin/useradd -d /home/$NEWUSERNAME -m -s $NEWSHELL -g 100 $NEWUSERNAME
-            /usr/sbin/chroot $SYSDIR /usr/bin/passwd $NEWUSERNAME
-            /usr/sbin/chroot $SYSDIR /bin/rm -rf {.accounts.name,.accounts.shell}
-         else
-            /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --msgbox "Username or Shell not specified, exiting!" 5 65
-         fi
-       else
-          exit 0
-       fi
+      /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --yesno "A non-root user account should be created, create one now?" 5 65;
+      if [ $? -ne "0" ]; then
+         exit 0 
+      else
+         while [ -z $NEWUSERNAME ] && [ -z $NEWSHELL ]; do
+               /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --inputbox "Account Username:" 8 65 2>$SYSDIR/.accounts.name
+               /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --aspect 10 --radiolist "Account Shell:" 0 0 0 /bin/bash "Bourne Again Shell" on /usr/bin/ksh "Korn Shell" off /bin/csh "C Shell" off /bin/tcsh "The C Shell" off /bin/zsh "The Z Shell" off 2>$SYSDIR/.accounts.shell
+               NEWUSERNAME=$(/bin/cat $SYSDIR/.accounts.name)
+               NEWSHELL=$(/bin/cat $SYSDIR/.accounts.shell)
+               if [ -n $NEWUSERNAME ] && [ -n $NEWSHELL ]; then
+                  /usr/sbin/chroot $SYSDIR /usr/sbin/useradd -d /home/$NEWUSERNAME -m -s $NEWSHELL -g 100 $NEWUSERNAME
+                  /usr/sbin/chroot $SYSDIR /usr/bin/passwd $NEWUSERNAME
+                  /usr/sbin/chroot $SYSDIR /bin/rm -rf {.accounts.name,.accounts.shell}
+                  /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --msgbox "User: $NEWUSERNAME Shell: $NEWSHELL GID: 100 successfully created!" 5 75
+                  unset NEWUSERNAME NEWSHELL
+                  /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --yesno "Would you like to create another user?" 5 65
+                  if [ "$?" -ne "0" ]; then 
+                     exit 0
+                  fi
+               else
+                  /usr/bin/dialog --title "Kadischi User Accounts Configuration" --begin 10 35 --msgbox "Username or Shell not specified!" 5 65
+               fi 
+         done
+      fi
    else
-      if [ $USING_KICKSTART ] || [ $USING_CMDLINE ]; then   
-         exit 0
+      if [ $USING_KICKSTART ] || [ $USING_CMDLINE ]; then
+         exit 1
       else
          echo "A non-root user should be created, create one now?"
          echo -n "[yes/no] "
@@ -58,7 +67,7 @@
                read CHOICE
             done
          else
-            exit 0
+            exit 1
          fi
       fi
    fi




More information about the fedora-extras-commits mailing list