2008-05-03 17:02:57 +00:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
#Framework, welches ein komplettes Linux System aus den Sourcen erstellt
|
|
|
|
|
#dieses Framework wird im CVS Repository
|
|
|
|
|
#:pserver:cvs.compuextreme.de:/Data/cvs zur Verf<72>gung gestellt
|
|
|
|
|
#
|
|
|
|
|
#Lage dieser Datei im Archiv: $Source: $
|
|
|
|
|
#
|
|
|
|
|
#(c) 2003 Harald Kueller, Germany
|
|
|
|
|
#This program is free software; you can redistribute it and/or
|
|
|
|
|
#modify ist under the terms of the GNU General Public License
|
|
|
|
|
#as published by the Free Software Foundation; either version
|
|
|
|
|
#2 of the License, or (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
#This program is distributed in the hope that it will be useful,
|
|
|
|
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
#See the GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
#You should have received a copy of the GNU General Public License
|
|
|
|
|
#along with this program; if not write to the Free Software Foundation,
|
|
|
|
|
#Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
#
|
|
|
|
|
#Script:
|
|
|
|
|
#BasisScript Viitor_Setup
|
|
|
|
|
#Sammlung von Scripts zur Erkennung, Auswahl und Partitionierung
|
|
|
|
|
#von Festplatten
|
|
|
|
|
#Letzte <20>nderung von: $Author: $
|
|
|
|
|
#Datum der letzten <20>nderung: $Date: $
|
|
|
|
|
#Version der Datei: $Revision: $
|
|
|
|
|
#
|
|
|
|
|
#$Log: $
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
GetHDDev() {
|
|
|
|
|
HD=""
|
|
|
|
|
NumEntrys=0
|
|
|
|
|
for i in `\ls /dev/{h,s}d? 2>/dev/null`; do
|
|
|
|
|
DEVNAME=`basename $i`
|
|
|
|
|
if [ "`cat /sys/block/$DEVNAME/device/type 2>/dev/null`" == "0" ] || \
|
|
|
|
|
[ "`cat /sys/block/$DEVNAME/device/media 2>/dev/null`" == "disk" ]; then
|
|
|
|
|
if [ "`cat /sys/block/$DEVNAME/removable 2>/dev/null`" == "0" ]; then
|
|
|
|
|
HD="$HD /dev/${DEVNAME} hd${NumEntrys}"
|
|
|
|
|
(( NumEntrys++ ))
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
HD="$HD Partitionierung Verlassen"
|
|
|
|
|
(( NumEntrys = $NumEntrys + 2 ))
|
|
|
|
|
$DIALOGPRG --stdout --clear --title "Viitor Setup Programm" \
|
|
|
|
|
--menu "Select HD to setup" 0 0 $NumEntrys \
|
|
|
|
|
$HD
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetHDPart() {
|
|
|
|
|
PART=""
|
|
|
|
|
NumEntrys=0
|
|
|
|
|
for i in `/bin/ls /dev/discs`; do
|
|
|
|
|
for j in `fdisk -l /dev/discs/$i/disc|grep "^\/dev\/discs"|awk '{print $1}'`; do
|
|
|
|
|
PART=$PART" $i `basename $j`"
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
echo $PART
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HDMenue() {
|
|
|
|
|
while FUNC=`$DIALOGPRG --stdout --clear --title "Viitor Setup Programm" \
|
|
|
|
|
--menu "Select Task" 0 0 6 \
|
|
|
|
|
"Partition" "HD" \
|
|
|
|
|
"Volume" "Management" \
|
|
|
|
|
"Format" "HD/Volume" \
|
|
|
|
|
"Mount" "Points" \
|
|
|
|
|
"Exit" "PartitionMenue"`; do
|
|
|
|
|
case $FUNC in
|
|
|
|
|
Partition)
|
|
|
|
|
if [ ${DIALOGPRG} == "Xdialog" ]; then
|
2010-02-15 18:58:33 +00:00
|
|
|
|
/usr/X11R7/sbin/gparted
|
2008-05-03 17:02:57 +00:00
|
|
|
|
else
|
|
|
|
|
while PHD=`GetHDDev`; do
|
|
|
|
|
if [ "$PHD" == "Partitionierung" ]; then
|
|
|
|
|
break
|
|
|
|
|
else
|
|
|
|
|
cfdisk $PHD
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
Volume)
|
|
|
|
|
VolumeMenue
|
|
|
|
|
;;
|
|
|
|
|
Format)
|
|
|
|
|
PART=""
|
|
|
|
|
FSPART=`FindFormatablePart`
|
|
|
|
|
if [ ! $? == "0" ];then
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
if [ ! "$FSPART" ]; then
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
SelectFilesystemForPart $FSPART
|
|
|
|
|
if [ ! $? = "0" ];then
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
exec 3</tmp/format$$.tmp
|
|
|
|
|
while read <&3 PARTITION FILESYS; do
|
|
|
|
|
PART=$PART"\n$PARTITION"
|
|
|
|
|
done
|
|
|
|
|
exec 3>&-
|
|
|
|
|
if ! $DIALOGPRG --title "Viitor Setup" \
|
|
|
|
|
--yesno "Should i really Format the Followin Partitions:\n$PART" 0 0; then
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
exec 3</tmp/format$$.tmp
|
|
|
|
|
while read <&3 PARTITION FILESYS; do
|
|
|
|
|
PARTITION=`echo $PARTITION|sed -e "s/\"//g"`
|
|
|
|
|
case $FILESYS in
|
|
|
|
|
xfs)
|
|
|
|
|
$DEBUG mkfs.xfs -f $PARTITION
|
|
|
|
|
;;
|
|
|
|
|
reiserfs)
|
|
|
|
|
yes|mkreiserfs $PARTITION
|
|
|
|
|
;;
|
|
|
|
|
ext3fs)
|
|
|
|
|
$DEBUG mkfs.ext3 $PARTITION
|
|
|
|
|
;;
|
|
|
|
|
swapfs)
|
|
|
|
|
$DEBUG mkswap $PARTITION
|
|
|
|
|
if $DIALOGPRG --title "Viitor Setup" \
|
|
|
|
|
--yesno "Should i activate this swappartition now ?" 0 0; then
|
|
|
|
|
swapon $PARTITION
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
exec 3>&-
|
|
|
|
|
rm /tmp/format$$.tmp
|
|
|
|
|
;;
|
|
|
|
|
Mount)
|
|
|
|
|
FSPART=`FindMountablePart`
|
|
|
|
|
if [ ! $? == "0" ];then
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
if [ ! "$FSPART" ]; then
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
echo "Selected Mountpoint Entrys: $FSPART"
|
|
|
|
|
;;
|
|
|
|
|
Exit)
|
|
|
|
|
break
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
}
|