kadischi/post_install_scripts 01prelink.sh, 1.7, 1.8 04userconfig.pl, 1.3, 1.4 07accounts.sh, 1.10, 1.11

Jasper O'neal Hartline (autopsy) fedora-extras-commits at redhat.com
Mon Apr 16 15:30:38 UTC 2007


Author: autopsy

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

Modified Files:
	01prelink.sh 04userconfig.pl 07accounts.sh 
Log Message:
Fix Xen kernel installs, implement Zenity into several post_scripts


Index: 01prelink.sh
===================================================================
RCS file: /cvs/devel/kadischi/post_install_scripts/01prelink.sh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- 01prelink.sh	9 Jul 2006 06:10:24 -0000	1.7
+++ 01prelink.sh	16 Apr 2007 15:30:36 -0000	1.8
@@ -7,11 +7,19 @@
 SYSDIR=$1
 
 if [ -f $SYSDIR/etc/prelink.conf ]; then
-   echo "[kadischi]: Prelinking.. "
-   /usr/sbin/chroot $SYSDIR /bin/mount -t proc /proc /proc || sleep 1
-   /usr/sbin/chroot $SYSDIR /usr/sbin/prelink --all >/dev/null 2>&1
-   /usr/sbin/chroot $SYSDIR /bin/umount /proc || sleep 1
-   exit 0
+   echo -n "[kadischi]: Prelinking.."
+       /usr/sbin/chroot $SYSDIR /bin/mount -t proc /proc /proc || sleep 1
+       /usr/sbin/chroot $SYSDIR /usr/sbin/prelink --all >/dev/null 2>&1 &
+       if [ "$?" -eq "0" ]; then
+           /sbin/pidof prelink >/dev/null 2>&1
+           while [ "$?" -eq "0" ]; do
+               echo -n "."
+               sleep 8
+               /sbin/pidof prelink >/dev/null 2>&1
+           done
+           /usr/sbin/chroot $SYSDIR /bin/umount /proc || sleep 1
+           exit 0
+       fi 
 else
    echo "[kadischi]: No prelink.conf found.. won't prelink."
    exit 0


Index: 04userconfig.pl
===================================================================
RCS file: /cvs/devel/kadischi/post_install_scripts/04userconfig.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- 04userconfig.pl	5 Jul 2006 05:34:51 -0000	1.3
+++ 04userconfig.pl	16 Apr 2007 15:30:36 -0000	1.4
@@ -19,22 +19,65 @@
     elsif ($i =~ m/-C/g) {
         $INTERACTIVE = 0;
      }
+    else {
+        $INTERACTIVE = 1;
+    }
 }
 
 if ($INTERACTIVE != 1) {
     print("[kadischi]: Skipping user firewall and services configuration..\n");
 }
 else {
-    $LOKKIT = "$SYSDIR/usr/sbin/lokkit";
-    $NTSYSV = "$SYSDIR/usr/sbin/ntsysv";
-    
-    
-    if (-e $LOKKIT) {
-    system("/usr/sbin/chroot $SYSDIR /usr/sbin/lokkit");
-    }
+    foreach $i (@ARGV) {
+        if ($i =~ m/--graphical/g) {
+            $GRAPHICAL = 1;
+        }
+        elsif ($i !~ m/--graphical/g and $i !~ m/--text/g) {
+            $GRAPHICAL = 1;
+        }
+        else {
+            $GRAPHICAL = 0;
+        }
+}
+
+        if ($GRAPHICAL == 1) {
+            $ZENITY = "$SYSDIR/usr/bin/zenity";
+            if (-e $ZENITY) {
+                $RETURN = `/usr/sbin/chroot $SYSDIR /usr/bin/zenity --text \"Firewall Configuration\" --list --column \"Item\" --column \"Option\" --checklist TRUE Enabled FALSE Disabled`;
+                if ($? > 0) {
+                    exit 0;
+                }
+                
+                if ($RETURN =~ m/Enabled/g) {
+                    system("/usr/sbin/chroot $SYSDIR /sbin/chkconfig --level 35 iptables on");
+                }
+                elsif ($RETURN =~ m/Disabled/g) {
+                    system("/usr/sbin/chroot $SYSDIR /sbin/chkconfig --level 35 iptables off");
+                }
+                else {
+                    system("/usr/sbin/chroot $SYSDIR /sbin/chkconfig --level 35 iptables on");
+                }
 
+                $RETURN = `/usr/sbin/chroot $SYSDIR /usr/bin/zenity --text \"Services Configuration\" --list --column \"Option\" --column \"Item\" --checklist \$(cd /etc/init.d/ && for i in *; do echo "FALSE \$i"; done) --width 400 --height 700`;
+                if ($? > 0) {
+                    exit 0;
+                }
+                $RETURN =~ tr/|/ /;
+                system("for i in $RETURN\ do /usr/sbin/chroot $SYSDIR /sbin/chkconfig --level 3 \$i on; done");
+                system("for i in $RETURN\ do /usr/sbin/chroot $SYSDIR /sbin/chkconfig --level 5 \$i on; done");
+                
+            }
+        }        
+        else {              
+            $LOKKIT = "$SYSDIR/usr/sbin/lokkit";
+            $NTSYSV = "$SYSDIR/usr/sbin/ntsysv";
+                
+            if (-e $LOKKIT) {
+                system("/usr/sbin/chroot $SYSDIR /usr/sbin/lokkit");
+            }
     
-    if (-e $NTSYSV) {
-    system("/usr/sbin/chroot $SYSDIR /usr/sbin/ntsysv --level 35");
-    }
-}
+            if (-e $NTSYSV) {
+                system("/usr/sbin/chroot $SYSDIR /usr/sbin/ntsysv --level 35");
+            }
+        }
+    } 


Index: 07accounts.sh
===================================================================
RCS file: /cvs/devel/kadischi/post_install_scripts/07accounts.sh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- 07accounts.sh	17 Aug 2006 15:43:50 -0000	1.10
+++ 07accounts.sh	16 Apr 2007 15:30:36 -0000	1.11
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Allow creation of addition user accounts.
-
+# set -x
 
 
  . /etc/kadischi/kadischi.conf
@@ -10,13 +10,34 @@
 ANACONDA_ARGS=$3
 USING_KICKSTART=$(echo $ANACONDA_ARGS | /bin/grep -G [--]kickstart)
 USING_CMDLINE=$(echo $ANACONDA_ARGS | /bin/egrep -- "-C|--cmdline")
-
+USING_GRAPHICAL=$(echo $ANACONDA_ARGS | /bin/grep -G [--]graphical)
+USING_TEXT=$(echo $ANACONDA_ARGS | /bin/grep -G [--]text)
 
 if [ -n "$USING_KICKSTART" ] || [ -n "$USING_CMDLINE" ]; then
    echo "[kadischi]: Not going to interactive user accounts configuration.."
    exit 0
 else
    echo "Going to user accounts configuration.."
+   if [ -n "$USING_GRAPHICAL" ] || [ ! -n "$USING_GRAPHICAL" ] && [ ! -n "$USING_TEXT" ]; then
+       if [ -x /usr/bin/zenity ]; then
+           /usr/bin/zenity --question --title "User Accounts Creation" --text "A non-root user should be created, create one now?"
+           if [ "$?" -ne "0" ]; then
+               exit 0
+           fi
+           /usr/bin/zenity --entry --title "User Accounts Creation" --text "Please enter the new user account username: " 2>&1 >$SYSDIR/.accounts.name
+           /usr/bin/zenity --title "User Accounts Creation" --text "Please choose your shell: " --list --checklist --column "Option" --column "Shell" TRUE /bin/bash FALSE /usr/bin/ksh FALSE /bin/csh FALSE /bin/tcsh FALSE /bin/zsh --width 120 --height 300 2>&1 >$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/zenity --info --title "User Accounts Creation" --text "User: $NEWUSERNAME Shell: $NEWSHELL GID: 100 successfully created!"
+           fi
+       else
+           continue
+       fi
+   else     
    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 [ $? -ne "0" ]; then
@@ -24,7 +45,13 @@
       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
+               if [ "$?" -ne "0" ]; then
+                   exit 0
+               fi
                /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
+               if [ "$?" -ne "0" ]; then
+                   exit 0
+               fi
                NEWUSERNAME=$(/bin/cat $SYSDIR/.accounts.name)
                NEWSHELL=$(/bin/cat $SYSDIR/.accounts.shell)
                if [ -n $NEWUSERNAME ] && [ -n $NEWSHELL ]; then
@@ -75,3 +102,4 @@
       fi
    fi
 fi
+fi




More information about the fedora-extras-commits mailing list