kadischi/rc userhome.desktop, NONE, 1.1 userhome.sh, NONE, 1.1 Makefile.am, 1.1.1.1, 1.2

Jasper O'neal Hartline (autopsy) fedora-extras-commits at redhat.com
Mon Jul 3 18:48:38 UTC 2006


Author: autopsy

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

Modified Files:
	Makefile.am 
Added Files:
	userhome.desktop userhome.sh 
Log Message:
User data and configuration dialog menu, calculate expected ISO size


--- NEW FILE userhome.desktop ---
[Desktop Entry]
Name=No name
Encoding=UTF-8
Version=1.0
Exec=/usr/bin/gnome-terminal --geometry 150x40+20+0 --execute /usr/sbin/userhome.sh
X-GNOME-Autostart-enabled=true


--- NEW FILE userhome.sh ---
#!/bin/bash
#
# Choose a disk, partition, filesystem type and mount it under /home
# set -x

get_fstype() {

    if [ -f /tmp/.disk.partition ]; then
        PARTITION=$(cat /tmp/.disk.partition)
        ### Begin filesytsem type choices
        dialog --backtitle "Kadischi User Data" --title "Kadischi user partition filesystem selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the filesystem type on $PARTITION to be mounted under /home" 20 60 3 ext2 "Extended Second Filesystem" ext3 "Extended Third Filesystem" vfat "Virtual FAT Filesystems" 2>/tmp/.disk.partition.fstype
    else
        exit 1
    fi
}



do_mount() {
    if [ -f /tmp/.disk.partition.fstype ]; then
        FSTYPE=$(cat /tmp/.disk.partition.fstype)
        umount /home
        mount -t $FSTYPE $PARTITION /home
        if [ "$?" -eq "0" ]; then
            dialog --backtitle "Kadischi User Data" --begin 12 45 --aspect 0 --shadow --msgbox "Success! Mounted $DISK$PARTITION on /home as $FSTYPE , Done! If a non-root user doesn't already exist, create one now and logout, then log back in as your user." 12 60
            sleep 20
            exit 0
        else
        
            echo "There was an error processing your request!"
                sleep 20
                exit 1
        fi
    else
        exit 1
    fi
}



do_cleanup() {
    ### Cleanup
    rm -rf /tmp/.disk
    rm -rf /tmp/.disk.partition
    rm -rf /tmp/.disk.partition.fstype
}



if [ "$UID" -eq "0" ]; then
    if [ -x /usr/bin/dialog ]; then

        dialog --backtitle "Kadischi User Data" --title "Kadischi data configuration and save" --begin 12 35  --aspect 0 --shadow --yesno \
            "This menu system is designed to allow a user to mount a partition as /home under the LiveCD environment to save user  data and configurations.
Would you like to continue?" 10 80

            if [ "$?" -eq "0" ]; then
            ### Begin user disk and partition selections
                dialog --backtitle "Kadischi User Data" --title "Kadischi user disk selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the
disk that contains our mountable partition" 20 60 8 /dev/hda "First IDE disk" /dev/hdb "Second IDE disk" /dev/hdc "Third IDE disk" /dev/hdd "Fourth IDE disk" /dev/sda "First SCSI disk" /dev/sdb "Second SCSI disk" /dev/sdc "Third SCSI disk" /dev/sdd "Fourth SCSI disk" 2>/tmp/.disk 

                if [ -f /tmp/.disk ]; then
                    DISK=$(cat /tmp/.disk)
                    if [ "$DISK" == "/dev/hda" ]; then
                       dialog --backtitle "Kadischi User Data" --title "Kadischi user partition selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the partition on $DISK to be mounted under /home" 20 60 4 /dev/hda1 "First partition" /dev/hda2 "Second partition" /dev/hda3 "Third partition" /dev/hda4 "Fourth partition" 2>/tmp/.disk.partition
                        if [ "$?" -eq "0" ]; then
                            get_fstype
                            do_mount
                            do_cleanup
                        else
                            do_cleanup
                            exit 1
                        fi

                    elif [ "$DISK" == "/dev/hdb" ]; then
                        dialog --backtitle "Kadischi User Data" --title "Kadischi user partition selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the partition on $DISK to be mounted under /home" 20 60 4 /dev/hdb1 "First partition" /dev/hdb2 "Second partition" /dev/hdb3 "Third partition" /dev/hdb4 "Fourth partition" 2>/tmp/.disk.partition
                        if [ "$?" -eq "0" ]; then
                            get_fstype
                            do_mount
                            do_cleanup
                        else
                            do_cleanup
                            exit 1
                        fi
 
                    elif [ "$DISK" == "/dev/hdc" ]; then
                        dialog --backtitle "Kadischi User Data" --title "Kadischi user partition selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the partition on $DISK to be mounted under /home" 20 60 4 /dev/hdc1 "First partition" /dev/hdc2 "Second partition" /dev/hdc3 "Third partition" /dev/hdc4 "Fourth partition" 2>/tmp/.disk.partition
                        if [ "$?" -eq "0" ]; then
                            get_fstype
                            do_mount
                            do_cleanup
                        else
                            do_cleanup
                            exit 1
                        fi       

                    elif [ "$DISK" == "/dev/hdd" ]; then
                        dialog --backtitle "Kadischi User Data" --title "Kadischi user partition selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the partition on $DISK to be mounted under /home" 20 60 4 /dev/hdd1 "First partition" /dev/hdd2 "Second partition" /dev/hdd3 "Third partition" /dev/hdd4 "Fourth partition" 2>/tmp/.disk.partition
                        if [ "$?" -eq "0" ]; then
                            get_fstype
                            do_mount
                            do_cleanup
                        else
                            do_cleanup
                            exit 1
                        fi
                 
                    elif [ "$DISK" == "/dev/sda" ]; then
                        dialog --backtitle "Kadischi User Data" --title "Kadischi user partition selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the partition on $DISK to be mounted under /home" 20 60 4 /dev/sda1 "First partition" /dev/sda2 "Second partition" /dev/sda3 "Third partition" /dev/sda4 "Fourth partition" 2>/tmp/.disk.partition
                        if [ "$?" -eq "0" ]; then
                            get_fstype
                            do_mount
                            do_cleanup
                        else
                            do_cleanup
                            exit 1
                        fi
                      
                    elif [ "$DISK" == "/dev/sdb" ]; then
                        dialog --backtitle "Kadischi User Data" --title "Kadischi user partition selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the partition on $DISK to be mounted under /home" 20 60 4 /dev/sdb1 "First partition" /dev/sdb2 "Second partition" /dev/sdb3 "Third partition" /dev/sdb4 "Fourth partition" 2>/tmp/.disk.partition
                        if [ "$?" -eq "0" ]; then
                            get_fstype
                            do_mount
                            do_cleanup
                        else
                            do_cleanup
                            exit 1
                        fi

                    elif [ "$DISK" == "/dev/sdc" ]; then
                        dialog --backtitle "Kadischi User Data" --title "Kadischi user partition selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the partition on $DISK to be mounted under /home" 20 60 4 /dev/sdc1 "First partition" /dev/sdc2 "Second partition" /dev/sdc3 "Third partition" /dev/sdc4 "Fourth partition" 2>/tmp/.disk.partition
                        if [ "$?" -eq "0" ]; then
                            get_fstype
                            do_mount
                            do_cleanup
                        else
                            do_cleanup
                            exit 1
                        fi
                    
                    elif [ "$DISK" == "/dev/sdd" ]; then
                        dialog --backtitle "Kadischi User Data" --title "Kadischi user partition selection" --begin 12 45 --aspect 0 --shadow --menu "Please choose the partition on $DISK to be mounted under /home" 20 60 4 /dev/sdd1 "First partition" /dev/sdd2 "Second partition" /dev/sdd3 "Third partition" /dev/sdd4 "Fourth partition" 2>/tmp/.disk.partition
                        if [ "$?" -eq "0" ]; then
                            get_fstype
                            do_mount
                            do_cleanup
                        else
                            do_cleanup
                            exit 1
                        fi
                    else
                        dialog --backtitle "Kadischi User Data" --title "Kadischi user partition selection" --begin 12 40 --aspect 0 --shadow --msgbox "There was an error processing the arguments provided, bailing!" 8 70
                        do_cleanup
                        sleep 20
                    fi
                else
                    exit 1 
                fi
            else
                 exit 1
            fi
    else
        ### Begin standard shell menu procedure and menu
        while [ -z $DONE ]; do
            echo "---------------------------------------------------------------------"
            echo "                Kadischi User Configuration and Save                 "
            echo "                                                                     "
            echo "    1) Disk                                                          "
            echo "    2) Partition                                                     "
            echo "    3) Filesystem type                                               "
            echo "    4) exit                                                          "
            echo "                                                                     "
            echo "    Please choose your disk, partition and filesystem type to mount  "
            echo "    as /home in the LiveCD environment or exit now!                  "
            echo "                                                                     "
            echo "                                                                     "
            echo "---------------------------------------------------------------------"
            echo -n "Selection: "
            read CHOICE
                case $CHOICE in
                                1) echo "Please provide the disk in which our mountable partition resides"
                                   echo -n "[/dev/hda]: "
                                       read DISK
                                       if [ ! "$DISK" ]; then
                                           DISK=/dev/hda
                                       fi
                                       ;;

                                2) echo "Please provide the partition number of which is our mountable partition"
                                   echo -n "[1]: "
                                       read PARTITION
                                       if [ ! "$PARTITION" ]; then
                                           PARTITION=1
                                       fi
                                       ;;
 
                                3) echo "Please provide the filesystem type of which our mountable partition is"
                                   echo -n "[ext2]: "
                                       read FSTYPE
                                       if [ ! "$FSTYPE" ]; then
                                            FSTYPE=ext2
                                       fi 
                                       ;;

                                4) echo "Bye!"
                                   exit 0 
                                       ;;
                    
                                *) echo "Unrecognized option!"
                esac
                if [ -n "$DISK" ] && [ -n "$PARTITION" ] && [ -n "$FSTYPE" ]; then
                    umount /home
                    mount -t $FSTYPE $DISK$PARTITION /home
                    if [ "$?" -eq "0" ]; then
                        echo "Successfully mounted $DISK$PARTITION on /home as $FSTYPE!"
                        echo "If a non-root user doesn't already exist, create one now."
                        echo "Done! Please logout and back ins as your user."
                        do_cleanup
                        sleep 20
                        exit 0
                    else
                        echo "There was an error processing your request to mount $DISK$PARTITION as $FSTYPE"
                        do_cleanup
                        sleep 20
                        exit 1
                    fi
                 else
                    echo "Still choices left!"
                    echo "                   "
                    echo "                   "
                 fi       
        done   
            exit 0
    fi
else
    if [ -x /usr/bin/dialog ]; then
        dialog --backtitle "Kadischi User Data" --begin 12 45 --aspect 0 --shadow --msgbox "You cannot run this application as non superuser (root)!" 6 60
        exit 0
    else
        echo "You cannot run this application as non superuser (root)!"
        exit 0
    fi
fi


Index: Makefile.am
===================================================================
RCS file: /cvs/devel/kadischi/rc/Makefile.am,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Makefile.am	21 Aug 2005 17:08:47 -0000	1.1.1.1
+++ Makefile.am	3 Jul 2006 18:48:36 -0000	1.2
@@ -1,3 +1,3 @@
 instldir = $(pkgdatadir)/install
 instl_SCRIPTS = rc.readonly-livecd readonly-halt
-instl_DATA = readonly-root
\ No newline at end of file
+instl_DATA = readonly-root userhome.sh userhome.desktop




More information about the fedora-extras-commits mailing list