kadischi/post_install_scripts 07accounts.sh,1.3,1.4

Jasper O'neal Hartline (autopsy) fedora-extras-commits at redhat.com
Wed Jun 21 15:51:39 UTC 2006


Author: autopsy

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

Modified Files:
	07accounts.sh 
Log Message:
Introduce dialog into 07accounts.sh


Index: 07accounts.sh
===================================================================
RCS file: /cvs/devel/kadischi/post_install_scripts/07accounts.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- 07accounts.sh	17 Jun 2006 20:35:55 -0000	1.3
+++ 07accounts.sh	21 Jun 2006 15:51:37 -0000	1.4
@@ -11,33 +11,55 @@
 USING_KICKSTART=$(echo $ANACONDA_ARGS | grep -G [--]kickstart)
 USING_CMDLINE=$(echo $ANACONDA_ARGS | egrep -- "-C|--cmdline")
 
-
-
-if [ $USING_KICKSTART ] || [ $USING_CMDLINE ]; then   
+if [ $USING_KICKSTART ] || [ $USING_CMDLINE ]; then
    exit 0
 else
-   echo "A non-root user should be created, create one now?"
-   echo -n "[yes/no] "
-   read CHOICE
-   if [ $CHOICE == "y" ] || [ $CHOICE == "yes" ]; then
-      while [ $CHOICE == "y" ] || [ $CHOICE == "yes" ]; do
-         echo -n "Username: "
-         read NEWUSERNAME
-         echo -n "User shell: "
-         read NEWSHELL
+   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 --inputbox "Account Shell: " 10 65 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
-            echo "User: $NEWUSERNAME, Home: /home/$NEWUSERNAME, GID: 100 created successfully."
+            /usr/sbin/chroot $SYSDIR /bin/rm -rf {.accounts.name,.accounts.shell}
          else
-            echo "Username or shell wasn't specified."
+            /usr/bin/dialog --title "User Accounts Configuration" --begin 10 35 --msgbox "Username or Shell not specified, exiting!"
          fi
-         echo "                                      "
-         echo "Would you like to create another user?"
+       else
+          exit 0
+       fi
+   else
+      if [ $USING_KICKSTART ] || [ $USING_CMDLINE ]; then   
+         exit 0
+      else
+         echo "A non-root user should be created, create one now?"
          echo -n "[yes/no] "
          read CHOICE
-      done
-   else
-      exit 0
+         if [ $CHOICE == "y" ] || [ $CHOICE == "yes" ]; then
+            while [ $CHOICE == "y" ] || [ $CHOICE == "yes" ]; do
+               echo -n "Username: "
+               read NEWUSERNAME
+               echo -n "User shell: "
+               read NEWSHELL
+               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
+                  echo "User: $NEWUSERNAME, Home: /home/$NEWUSERNAME, GID: 100 created successfully."
+               else
+                  echo "Username or shell wasn't specified."
+               fi
+               echo "                                      "
+               echo "Would you like to create another user?"
+               echo -n "[yes/no] "
+               read CHOICE
+            done
+         else
+            exit 0
+         fi
+      fi
    fi
 fi




More information about the fedora-extras-commits mailing list