kadischi/desktop userhome.sh,NONE,1.1 Makefile.am,1.4,1.5
Jasper O'neal Hartline (autopsy)
fedora-extras-commits at redhat.com
Wed Feb 28 11:34:37 UTC 2007
- Previous message: kadischi/desktop Makefile.am, 1.3, 1.4 kadischi.apps, 1.2, NONE kadischi.pam, 1.1, NONE
- Next message: kadischi/rc Makefile.am,1.3,1.4 userhome.sh,1.9,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: autopsy
Update of /cvs/devel/kadischi/desktop
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6266/kadischi/desktop
Modified Files:
Makefile.am
Added Files:
userhome.sh
Log Message:
Organize some files.
--- NEW FILE userhome.sh ---
#!/bin/bash
# Choose a disk, partition, filesystem type and mount it under /home
#variables
TITLE="Kadischi User Data"
TEXT="Kadischi data configuration and save"
introduction() {
fstype="$fstype $(zenity --title "$TITLE" --question --text "This dialog is designed to allow a user to mount a device under /home to store specific \
user data and configurations, would you like to continue?" \
--height=300 --width=300)"
[ "$(echo $?)" != "0" ] && exit 1
}
get_fstype() {
fstype="$fstype $(zenity --list --title "$TITLE" --radiolist --text "Choose the filesystem type for $partition to be mounted under /home" \
--column "" --column "Device" --column "Description" --separator " " \
"" "ext2" "Extended Second Filesystem" \
"" "ext3" "Extended Third Filesystem" \
"" "vfat" "Virtual FAT Filesystems" \
--height=300 --width=300)"
[ "$(echo $?)" != "0" ] && exit 1
}
select_device () {
device="$device $(zenity --list --title "$TITLE" --radiolist --text "Select the device containing our mountable partition for /home" \
--column "" --column "Device" --column "Description" --separator " " \
"" "/dev/hda" "First IDE disk" \
"" "/dev/hdb" "Second IDE disk" \
"" "/dev/hdc" "Third IDE disk" \
"" "/dev/hdd" "Fourth IDE disk" \
"" "/dev/sda" "First USB/SCSI disk" \
"" "/dev/sdb" "Second USB/SCSI disk" \
"" "/dev/sdc" "Third USB/SCSI disk" \
"" "/dev/sdd" "Fourth USB/SCSI disk" \
--height=400 --width=300)"
[ "$(echo $?)" != "0" ] && exit 1
}
select_partitions () {
partition="$partition $(zenity --list --title "$TITLE" --radiolist --text "Select the partition that will be mounted under /home" \
--column "" --column "Partition" --column "Description" --separator " " \
"" "/dev/$1d$21" "First partition" \
"" "/dev/$1d$22" "Second partition" \
"" "/dev/$1d$23" "Third partition" \
"" "/dev/$1d$24" "Fourth partition" \
--height=300 --width=300)"
[ "$(echo $?)" != "0" ] && exit 1
}
do_mount() {
tar -cf /tmp/home.tar /home
umount -l /home
mount -t $fstype $partition /home
if [ "$?" -eq "0" ]; then
tar --directory / -xf /tmp/home.tar && rm -rf /tmp/home.tar
fi
if [ "$?" -eq "0" ]; then
zenity --title "Kadischi User Data" --info --text "Success! Mounted $partition on /home as $fstype, If a non-root user doesn't already exist, create one now and logout, then log back in as your user."
sleep 20
exit 0
else
zenity --error --text "There was an error processing your request"
exit 1
fi
}
if [ "$UID" -eq "0" ]; then
if [ -x /usr/bin/zenity ]; then
introduction
select_device
case $device in
' /dev/hda')
select_partitions h a
;;
' /dev/hdb')
select_partitions h b
;;
' /dev/hdc')
select_partitions h c
;;
' /dev/hdd')
select_partitions h d
;;
' /dev/sda')
select_partitions s a
;;
' /dev/sdb')
select_partitions s b
;;
' /dev/sdc')
select_partitions s c
;;
' /dev/sdd')
select_partitions s d
;;
esac
get_fstype
do_mount
else
### Begin dialog and shell sections
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 6 9 --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 6 9 --aspect 0 --shadow --msgbox "Success! Mounted $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 6 9 --aspect 0 --shadow --yesno \
"This dialog 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 6 9 --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 6 9 --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 6 9 --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 6 9 --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 6 9 --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 6 9 --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 6 9 --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 6 9 --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 6 9 --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 6 9 --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
clear
echo "---------------------------------------------------------------------"
echo -e " \033[0;31mKadischi User Configuration and Save "
echo -en "\033[0m"
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 $PARTITION /home
if [ "$?" -eq "0" ]; then
echo "Successfully mounted $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 $PARTITION as $FSTYPE"
do_cleanup
sleep 20
exit 1
fi
else
echo " "
echo "Still choices left!"
echo "Move on to the next available option."
echo " "
sleep 5
fi
done
exit 0
fi
else
if [ -x /usr/bin/dialog ]; then
dialog --backtitle "Kadischi User Data" --begin 6 9 --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
#### End dialog and shell sections
fi
else
zenity --error --text "You cannot run this application as non superuser (root)!"
exit 0
fi
Index: Makefile.am
===================================================================
RCS file: /cvs/devel/kadischi/desktop/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Makefile.am 28 Feb 2007 11:31:39 -0000 1.4
+++ Makefile.am 28 Feb 2007 11:34:35 -0000 1.5
@@ -1,5 +1,5 @@
instldir = $(pkgdatadir)/desktop
-instl_DATA = userhome.desktop
+instl_DATA = userhome.desktop userhome.sh
install-data-hook:
- Previous message: kadischi/desktop Makefile.am, 1.3, 1.4 kadischi.apps, 1.2, NONE kadischi.pam, 1.1, NONE
- Next message: kadischi/rc Makefile.am,1.3,1.4 userhome.sh,1.9,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the scm-commits
mailing list