mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
'moved in latest changes'
This commit is contained in:
parent
c9266cc5f6
commit
67991b55ea
2 changed files with 126 additions and 73 deletions
|
@ -12,7 +12,7 @@ e2fsprogs findutils gawk grep iputils jfsutils less lvm2 mdadm module-init-tools
|
||||||
ncurses net-tools gnu-netcat ntfsprogs pcmciautils procps psmisc reiserfsprogs sed snarf \
|
ncurses net-tools gnu-netcat ntfsprogs pcmciautils procps psmisc reiserfsprogs sed snarf \
|
||||||
syslog-ng sysvinit tar util-linux-ng which wireless_tools xfsprogs dnsutils hdparm memtest86+ \
|
syslog-ng sysvinit tar util-linux-ng which wireless_tools xfsprogs dnsutils hdparm memtest86+ \
|
||||||
grub inetutils openssh hwdetect portmap shadow bridge-utils ifenslave cpufrequtils links tcp_wrappers \
|
grub inetutils openssh hwdetect portmap shadow bridge-utils ifenslave cpufrequtils links tcp_wrappers \
|
||||||
dosfstools udev initscripts filesystem kernel26 glibc kernel-headers xinetd links pacman pacman-mirrorlist screen kbd pam \
|
dosfstools udev initscripts filesystem kernel26 kernel26-firmware glibc kernel-headers xinetd links pacman pacman-mirrorlist screen kbd pam \
|
||||||
dhcpcd bzip2 gcc-libs openssl zlib libelf gpm sysfsutils libgcrypt libgpg-error popt kexec-tools ppp libpcap \
|
dhcpcd bzip2 gcc-libs openssl zlib libelf gpm sysfsutils libgcrypt libgpg-error popt kexec-tools ppp libpcap \
|
||||||
rp-pppoe lilo grub iptables capi4k-utils ntfs-3g isdn4k-utils pciutils usbutils vpnc openvpn b43-fwcutter \
|
rp-pppoe lilo grub iptables capi4k-utils ntfs-3g isdn4k-utils pciutils usbutils vpnc openvpn b43-fwcutter \
|
||||||
wpa_supplicant gzip rsync libarchive libdownload device-mapper cracklib nfs-utils nfsidmap readline acl attr \
|
wpa_supplicant gzip rsync libarchive libdownload device-mapper cracklib nfs-utils nfsidmap readline acl attr \
|
||||||
|
|
|
@ -79,6 +79,20 @@ chroot_umount()
|
||||||
umount $DESTDIR/dev
|
umount $DESTDIR/dev
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# getuuid()
|
||||||
|
# converts /dev/[hs]d?[0-9] devices to UUIDs
|
||||||
|
#
|
||||||
|
# parameters: device file
|
||||||
|
# outputs: UUID on success
|
||||||
|
# nothing on failure
|
||||||
|
# returns: nothing
|
||||||
|
getuuid()
|
||||||
|
{
|
||||||
|
if [ "${1%%/[hs]d?[0-9]}" != "${1}" -o "${1%%/md[0-9]}" != "${1}" ]; then
|
||||||
|
echo "$(blkid -s UUID -o value ${1})"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Check media on install packages
|
# Check media on install packages
|
||||||
check_media() {
|
check_media() {
|
||||||
! [ "$(cat /proc/mounts | grep /dev/$dev)" ] && mount /dev/$dev $media > /dev/null 2>&1
|
! [ "$(cat /proc/mounts | grep /dev/$dev)" ] && mount /dev/$dev $media > /dev/null 2>&1
|
||||||
|
@ -139,7 +153,7 @@ finddisks() {
|
||||||
# ide devices
|
# ide devices
|
||||||
for dev in $(ls $block | egrep '^hd'); do
|
for dev in $(ls $block | egrep '^hd'); do
|
||||||
if [ "$(cat $block/$dev/device/media)" = "disk" ]; then
|
if [ "$(cat $block/$dev/device/media)" = "disk" ]; then
|
||||||
if ! [ "$(cat /proc/mdstat | grep $dev)" ]; then
|
if ! [ "$(cat /proc/mdstat | grep "$dev\[")" ]; then
|
||||||
echo "/dev/$dev"
|
echo "/dev/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
fi
|
fi
|
||||||
|
@ -148,7 +162,49 @@ finddisks() {
|
||||||
#scsi/sata devices
|
#scsi/sata devices
|
||||||
for dev in $(ls $block | egrep '^sd'); do
|
for dev in $(ls $block | egrep '^sd'); do
|
||||||
if ! [ "$(cat $block/$dev/device/type)" = "5" ]; then
|
if ! [ "$(cat $block/$dev/device/type)" = "5" ]; then
|
||||||
if ! [ "$(cat /proc/mdstat | grep $dev)" ]; then
|
if ! [ "$(cat /proc/mdstat | grep "$dev\[")" ]; then
|
||||||
|
echo "/dev/$dev"
|
||||||
|
[ "$1" ] && echo $1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# cciss controllers
|
||||||
|
if [ -d /dev/cciss ] ; then
|
||||||
|
for dev in $(ls /dev/cciss | egrep -v 'p'); do
|
||||||
|
echo "/dev/cciss/$dev"
|
||||||
|
[ "$1" ] && echo $1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
# Smart 2 controllers
|
||||||
|
if [ -d /dev/ida ] ; then
|
||||||
|
for dev in $(ls /dev/ida | egrep -v 'p'); do
|
||||||
|
echo "/dev/ida/$dev"
|
||||||
|
[ "$1" ] && echo $1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
# partitionable raid
|
||||||
|
for dev in $(cat /proc/mdstat | grep ^md_d[0-9] | sed 's#:.*##g'); do
|
||||||
|
echo "/dev/$dev"
|
||||||
|
[ "$1" ] && echo $1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# don't check on raid devices!
|
||||||
|
findbootloaderdisks() {
|
||||||
|
block=/sys/block
|
||||||
|
# ide devices
|
||||||
|
for dev in $(ls $block | egrep '^hd'); do
|
||||||
|
if [ "$(cat $block/$dev/device/media)" = "disk" ]; then
|
||||||
|
if ! [ "$(cat /proc/mdstat | grep "$dev\[")" ]; then
|
||||||
|
echo "/dev/$dev"
|
||||||
|
[ "$1" ] && echo $1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
#scsi/sata devices
|
||||||
|
for dev in $(ls $block | egrep '^sd'); do
|
||||||
|
if ! [ "$(cat $block/$dev/device/type)" = "5" ]; then
|
||||||
|
if ! [ "$(cat /proc/mdstat | grep "$dev\[")" ]; then
|
||||||
echo "/dev/$dev"
|
echo "/dev/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
fi
|
fi
|
||||||
|
@ -170,26 +226,12 @@ finddisks() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# getuuid()
|
|
||||||
# converts /dev/[hs]d?[0-9] devices to UUIDs
|
|
||||||
#
|
|
||||||
# parameters: device file
|
|
||||||
# outputs: UUID on success
|
|
||||||
# nothing on failure
|
|
||||||
# returns: nothing
|
|
||||||
getuuid()
|
|
||||||
{
|
|
||||||
if [ "${1%%/[hs]d?[0-9]}" != "${1}" -o "${1%%/md[0-9]}" != "${1}" ]; then
|
|
||||||
echo "$(blkid -s UUID -o value ${1})"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
findpartitions() {
|
findpartitions() {
|
||||||
block=/sys/block
|
block=/sys/block
|
||||||
for devpath in $(finddisks); do
|
for devpath in $(finddisks); do
|
||||||
disk=$(echo $devpath | sed 's|.*/||')
|
disk=$(echo $devpath | sed 's|.*/||')
|
||||||
for part in $(ls $block/$disk | egrep ^$disk); do
|
for part in $(ls $block/$disk | egrep ^$disk); do
|
||||||
# check if not already assembled to a raid device
|
# check if not already assembled to a none partitionable raid device, includes also partitionable raid partitions
|
||||||
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep $part)" -o "$(fstype 2>/dev/null </dev/$part | grep "lvm2")" -o "$(sfdisk -c /dev/$disk $(echo $part | sed -e "s#$disk##g") 2>/dev/null | grep "5")" ]; then
|
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep $part)" -o "$(fstype 2>/dev/null </dev/$part | grep "lvm2")" -o "$(sfdisk -c /dev/$disk $(echo $part | sed -e "s#$disk##g") 2>/dev/null | grep "5")" ]; then
|
||||||
if [ -d $block/$disk/$part ]; then
|
if [ -d $block/$disk/$part ]; then
|
||||||
echo "/dev/$part"
|
echo "/dev/$part"
|
||||||
|
@ -203,18 +245,11 @@ findpartitions() {
|
||||||
echo "/dev/mapper/$devpath"
|
echo "/dev/mapper/$devpath"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
done
|
done
|
||||||
# include non partitionable raid md devices, exclude partitionable base devices
|
# include none partitionable raid md devices
|
||||||
for devpath in $(ls -d /dev/md* | grep '[0-9]' | grep -v '_d' 2>/dev/null); do
|
for devpath in $(ls -d /dev/md* | grep md[0-9]); do
|
||||||
if cat /proc/mdstat | grep -qw $(echo $devpath | sed -e 's|/dev/||g'); then
|
if [ "$(cat /proc/mdstat | grep -qw $(echo $devpath | sed -e 's|/dev/||g'))" ]; then
|
||||||
echo "$devpath"
|
echo "$devpath"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
fi
|
|
||||||
done
|
|
||||||
# include partitionable raid md devices
|
|
||||||
for devpath in $(ls -d /dev/md* | grep '_d[0-9]p' 2>/dev/null); do
|
|
||||||
if cat /proc/partitions | grep -qw $(echo $devpath | sed -e 's|/dev/||g'); then
|
|
||||||
echo "$devpath"
|
|
||||||
[ "$1" ] && echo $1
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# inlcude cciss controllers
|
# inlcude cciss controllers
|
||||||
|
@ -233,13 +268,14 @@ findpartitions() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# don't list raid devices!
|
||||||
findbootloaderpartitions() {
|
findbootloaderpartitions() {
|
||||||
block=/sys/block
|
block=/sys/block
|
||||||
for devpath in $(finddisks); do
|
for devpath in $(finddisks); do
|
||||||
disk=$(echo $devpath | sed 's|.*/||')
|
disk=$(echo $devpath | sed 's|.*/||')
|
||||||
for part in $(ls $block/$disk | egrep ^$disk); do
|
for part in $(ls $block/$disk | egrep ^$disk); do
|
||||||
# check if not already assembled to a raid device
|
# check if not already assembled to a raid device
|
||||||
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep $part)" -o "$(fstype 2>/dev/null </dev/$part | grep "lvm2")" -o "$(sfdisk -c /dev/$disk $(echo $part | sed -e "s#$disk##g") 2>/dev/null | grep "5")" ]; then
|
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep $part)" -o "$(fstype 2>/dev/null </dev/$part | grep "lvm2")" -o "$(sfdisk -c /dev/$disk $(echo $part | sed -e "s#$disk##g") 2>/dev/null | grep "5")" -o "$(echo $part | grep md_d[0-9])" ]; then
|
||||||
if [ -d $block/$disk/$part ]; then
|
if [ -d $block/$disk/$part ]; then
|
||||||
echo "/dev/$part"
|
echo "/dev/$part"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
|
@ -439,7 +475,11 @@ _getavaildisks()
|
||||||
{
|
{
|
||||||
# NOTE: to test as non-root, stick in a 'sudo' before the hdparm call
|
# NOTE: to test as non-root, stick in a 'sudo' before the hdparm call
|
||||||
for i in $(finddisks); do
|
for i in $(finddisks); do
|
||||||
echo -n "$i: "; hdparm -I $i | grep -F '1000*1000' | sed "s/.*1000:[ \t]*\(.*\)/\1/"; echo "\n"
|
if [ $(echo "$i" | grep 'md_d[0-9]') ]; then
|
||||||
|
echo -n "$i : "; echo $(($(expr 512 '*' $(cat /sys/block/$(basename $i)/size))/1000000)) MB; echo "\n"
|
||||||
|
else
|
||||||
|
echo -n "$i: "; hdparm -I $i | grep -F '1000*1000' | sed "s/.*1000:[ \t]*\(.*\)/\1/"; echo "\n"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +490,9 @@ _getavaildisks()
|
||||||
_getavailpartitions()
|
_getavailpartitions()
|
||||||
{
|
{
|
||||||
for i in $(findpartitions); do
|
for i in $(findpartitions); do
|
||||||
if [ $(echo "$i" | grep 'md') ]; then
|
if [ $(echo "$i" | grep '/md_d[0-9]') ]; then
|
||||||
|
echo -n "$i : "; echo $(($(expr 512 '*' $(cat /sys/block/$(basename $i | sed -e 's#p.*##g')/$(basename $i)/size))/1000000)) MB; echo "\n"
|
||||||
|
elif [ $(echo "$i" | grep 'md') ]; then
|
||||||
echo -n "$i : "; echo $(($(expr 512 '*' $(cat /sys/block/$(basename $i)/size))/1000000)) MB; echo "\n"
|
echo -n "$i : "; echo $(($(expr 512 '*' $(cat /sys/block/$(basename $i)/size))/1000000)) MB; echo "\n"
|
||||||
else
|
else
|
||||||
echo -n "$i: "; echo $(($(expr 512 '*' $(cat /sys/block/$(basename $i | sed -e 's#[0-9].*##g')/$(basename $i)/size))/1000000)) MB; echo "\n"
|
echo -n "$i: "; echo $(($(expr 512 '*' $(cat /sys/block/$(basename $i | sed -e 's#[0-9].*##g')/$(basename $i)/size))/1000000)) MB; echo "\n"
|
||||||
|
@ -468,14 +510,18 @@ _umountall()
|
||||||
umount $(mount | grep "${DESTDIR} " | sed 's|\ .*||g') >/dev/null 2>&1
|
umount $(mount | grep "${DESTDIR} " | sed 's|\ .*||g') >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Disable all software raid devices
|
# Disable all none partitionable software raid devices
|
||||||
_stopmd()
|
_stopmd()
|
||||||
{
|
{
|
||||||
if [ "$(cat /proc/mdstat | grep ^md)" ]; then
|
if [ "$(cat /proc/mdstat | grep ^md)" ]; then
|
||||||
DIALOG --infobox "Disabling all software raid devices..." 0 0
|
DISABLEMD=""
|
||||||
for i in $(cat /proc/mdstat | grep ^md | sed -e 's# :.*##g'); do
|
DIALOG --yesno "Setup detected already running raid devices, do you want to disable them before partitioning?" 0 0 && DISABLEMD="1"
|
||||||
mdadm --manage --stop /dev/$i
|
if [ "$DISABLEMD" = "1" ]; then
|
||||||
done
|
DIALOG --infobox "Disabling all software raid devices..." 0 0
|
||||||
|
for i in $(cat /proc/mdstat | grep ^md | sed -e 's# :.*##g'); do
|
||||||
|
mdadm --manage --stop /dev/$i
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +578,7 @@ storage is duplication." 0 0
|
||||||
# enter raid device name
|
# enter raid device name
|
||||||
RAIDDEVICE=""
|
RAIDDEVICE=""
|
||||||
while [ "${RAIDDEVICE}" = "" ]; do
|
while [ "${RAIDDEVICE}" = "" ]; do
|
||||||
DIALOG --inputbox "Enter the node name for the raiddevice, eg. for none partitionable raiddevice:\n/dev/md0\n/dev/md1\n\n\neg. for partitionable raiddevice:\n/dev/md_d0\n/dev/md_d1" 15 65 "/dev/md0" 2>$ANSWER || return 1
|
DIALOG --inputbox "Enter the node name for the raiddevice, eg. for none partitionable raiddevice:\n/dev/md[number]\n/dev/md0\n/dev/md1\n\n\neg. for partitionable raiddevice:\n/dev/md_d[number]\n/dev/md_d0\n/dev/md_d1" 15 65 "/dev/md0" 2>$ANSWER || return 1
|
||||||
RAIDDEVICE=$(cat $ANSWER)
|
RAIDDEVICE=$(cat $ANSWER)
|
||||||
if [ "$(cat /proc/mdstat | grep "^$(echo $RAIDDEVICE | sed -e 's#/dev/##g')")" ]; then
|
if [ "$(cat /proc/mdstat | grep "^$(echo $RAIDDEVICE | sed -e 's#/dev/##g')")" ]; then
|
||||||
DIALOG --msgbox "ERROR: You have defined 2 identical node names! Please enter another name." 8 65
|
DIALOG --msgbox "ERROR: You have defined 2 identical node names! Please enter another name." 8 65
|
||||||
|
@ -550,30 +596,37 @@ storage is duplication." 0 0
|
||||||
DIALOG --menu "Select the parity layout you want to use (default is left-symmetric)" 21 50 13 $PARITYLEVELS 2>$ANSWER || return 1
|
DIALOG --menu "Select the parity layout you want to use (default is left-symmetric)" 21 50 13 $PARITYLEVELS 2>$ANSWER || return 1
|
||||||
PARTIY=$(cat $ANSWER)
|
PARTIY=$(cat $ANSWER)
|
||||||
fi
|
fi
|
||||||
# show available devices with sizes
|
# show all devices with sizes
|
||||||
if [ "$(echo $RAIDDEVICE | grep _d)" ]; then
|
DIALOG --msgbox "DISKS:\n$(_getavaildisks)\n\nPARTITIONS:\n$(_getavailpartitions)\n\nDevices that are not shown in next dialog, are already in use!" 0 0
|
||||||
DIALOG --msgbox "Available disks:\n\n$(_getavaildisks)\n" 0 0
|
PARTS=$(finddisks _)
|
||||||
PARTS=$(finddisks _)
|
PARTS="$PARTS $(findpartitions _)"
|
||||||
else
|
#hell yeah, this is complicated! kill devices already in use.
|
||||||
DIALOG --msgbox "Available partitions:\n\n$(_getavailpartitions)\n" 0 0
|
ALREADYINUSE=$(cat /proc/mdstat | grep ^md | sed -e 's# :.*linear##g' -e 's# :.*raid[0-9][0-9]##g' -e 's# :.*raid[0-9]##g' -e 's#\[[0-9]\]##g')
|
||||||
PARTS=$(findpartitions _)
|
for i in $ALREADYINUSE; do
|
||||||
fi
|
PARTS=$(echo $PARTS | sed -e "s#/dev/$i\ _##g" -e "s#/dev/$i\p[0-9]\ _##g")
|
||||||
|
k=$(echo /dev/$i | sed -e 's#[0-9]##g')
|
||||||
|
if ! [ $(echo $k | grep ^md) ]; then
|
||||||
|
PARTS=$(echo $PARTS | sed -e "s#$k\ _##g")
|
||||||
|
fi
|
||||||
|
done
|
||||||
# break if all devices are in use
|
# break if all devices are in use
|
||||||
if [ "$PARTS" = "" ]; then
|
if [ "$PARTS" = "" ]; then
|
||||||
DIALOG --msgbox "All devices in use. No more devices left for new creation." 0 0
|
DIALOG --msgbox "All devices in use. No more devices left for new creation." 0 0
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
# select the first device to use, no missing option available!
|
# select the first device to use, no missing option available!
|
||||||
DIALOG --menu "Select the first device" 21 50 13 $PARTS 2>$ANSWER || return 1
|
RAIDNUMBER=1
|
||||||
|
DIALOG --menu "Select device $RAIDNUMBER" 21 50 13 $PARTS 2>$ANSWER || return 1
|
||||||
PART=$(cat $ANSWER)
|
PART=$(cat $ANSWER)
|
||||||
echo "$PART" >>/tmp/.raid
|
echo "$PART" >>/tmp/.raid
|
||||||
while [ "$PART" != "DONE" ]; do
|
while [ "$PART" != "DONE" ]; do
|
||||||
|
RAIDNUMBER=$(($RAIDNUMBER + 1))
|
||||||
# clean loop from used partition and options
|
# clean loop from used partition and options
|
||||||
PARTS="$(echo $PARTS | sed -e "s#${PART}\ _##g" -e 's#MISSING\ _##g' -e 's#SPARE\ _##g')"
|
PARTS="$(echo $PARTS | sed -e "s#${PART}\ _##g" -e "s#${PART}[0-9]\ _##g" -e "s#$(echo ${PART} | sed -e 's#[0-9]##g')\ _##g" -e 's#MISSING\ _##g' -e 's#SPARE\ _##g')"
|
||||||
# raid0 doesn't support missing devices
|
# raid0 doesn't support missing devices
|
||||||
! [ "$LEVEL" = "raid0" -o "$LEVEL" = "linear" ] && MDEXTRA="MISSING _"
|
! [ "$LEVEL" = "raid0" -o "$LEVEL" = "linear" ] && MDEXTRA="MISSING _"
|
||||||
# add more devices
|
# add more devices
|
||||||
DIALOG --menu "Select additional device" 21 50 13 $PARTS $MDEXTRA DONE _ 2>$ANSWER || return 1
|
DIALOG --menu "Select additional device $RAIDNUMBER" 21 50 13 $PARTS $MDEXTRA DONE _ 2>$ANSWER || return 1
|
||||||
PART=$(cat $ANSWER)
|
PART=$(cat $ANSWER)
|
||||||
SPARE=""
|
SPARE=""
|
||||||
! [ "$LEVEL" = "raid0" -o "$LEVEL" = "linear" ] && DIALOG --yesno --defaultno "Would you like to use $PART as spare device?" 0 0 && SPARE="1"
|
! [ "$LEVEL" = "raid0" -o "$LEVEL" = "linear" ] && DIALOG --yesno --defaultno "Would you like to use $PART as spare device?" 0 0 && SPARE="1"
|
||||||
|
@ -602,7 +655,7 @@ storage is duplication." 0 0
|
||||||
SPARE_DEVICES="$(cat /tmp/.raid-spare | wc -l)"
|
SPARE_DEVICES="$(cat /tmp/.raid-spare | wc -l)"
|
||||||
# generate options for mdadm
|
# generate options for mdadm
|
||||||
RAIDOPTIONS="--force --run --level=$LEVEL"
|
RAIDOPTIONS="--force --run --level=$LEVEL"
|
||||||
[ "$(echo $RAIDDEVICE | grep _d)" ] && RAIDOPTIONS="$RAIDOPTIONS -a mdp"
|
[ "$(echo $RAIDDEVICE | grep /md_d[0-9])" ] && RAIDOPTIONS="$RAIDOPTIONS -a mdp"
|
||||||
! [ "$RAID_DEVICES" = "0" ] && RAIDOPTIONS="$RAIDOPTIONS --raid-devices=$RAID_DEVICES"
|
! [ "$RAID_DEVICES" = "0" ] && RAIDOPTIONS="$RAIDOPTIONS --raid-devices=$RAID_DEVICES"
|
||||||
! [ "$SPARE_DEVICES" = "0" ] && RAIDOPTIONS="$RAIDOPTIONS --spare-devices=$SPARE_DEVICES"
|
! [ "$SPARE_DEVICES" = "0" ] && RAIDOPTIONS="$RAIDOPTIONS --spare-devices=$SPARE_DEVICES"
|
||||||
! [ "$PARITY" = "" ] && RAIDOPTIONS="$RAIDOPTIONS --layout=$PARITY"
|
! [ "$PARITY" = "" ] && RAIDOPTIONS="$RAIDOPTIONS --layout=$PARITY"
|
||||||
|
@ -612,12 +665,12 @@ storage is duplication." 0 0
|
||||||
DIALOG --msgbox "Error creating $RAIDDEVICE (see $LOG for details)." 0 0
|
DIALOG --msgbox "Error creating $RAIDDEVICE (see $LOG for details)." 0 0
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ "$(echo $RAIDDEVICE | grep _d)" ]; then
|
if [ "$(echo $RAIDDEVICE | grep /md_d[0-9])" ]; then
|
||||||
DIALOG --msgbox "Now you'll be put into the cfdisk program where you can partition your raiddevice to your needs." 18 70
|
DIALOG --msgbox "Now you'll be put into the cfdisk program where you can partition your raiddevice to your needs." 18 70
|
||||||
cfdisk $RAIDDEVICE
|
cfdisk $RAIDDEVICE
|
||||||
fi
|
fi
|
||||||
# writing raid information to partition table
|
# writing raid information to partition table
|
||||||
if [ "$(echo $RAIDDEVICE | grep _d)" ]; then
|
if [ "$(echo $RAIDDEVICE | grep /md_d[0-9])" ]; then
|
||||||
for i in $(sfdisk -l $RAIDDEVICE | grep ^/dev | grep -v Empty | sed -e 's# .*##g'); do
|
for i in $(sfdisk -l $RAIDDEVICE | grep ^/dev | grep -v Empty | sed -e 's# .*##g'); do
|
||||||
# get device name
|
# get device name
|
||||||
k=$(echo $i | sed -e 's#p[0-9]##g')
|
k=$(echo $i | sed -e 's#p[0-9]##g')
|
||||||
|
@ -655,7 +708,7 @@ _encrypt()
|
||||||
}
|
}
|
||||||
|
|
||||||
autoprepare() {
|
autoprepare() {
|
||||||
# disable all raid devices, else weird things can happen during partitioning!
|
# check on raid devices, else weird things can happen during partitioning!
|
||||||
_stopmd
|
_stopmd
|
||||||
DISCS=$(finddisks)
|
DISCS=$(finddisks)
|
||||||
if [ $(echo $DISCS | wc -w) -gt 1 ]; then
|
if [ $(echo $DISCS | wc -w) -gt 1 ]; then
|
||||||
|
@ -665,6 +718,10 @@ autoprepare() {
|
||||||
else
|
else
|
||||||
DISC=$DISCS
|
DISC=$DISCS
|
||||||
fi
|
fi
|
||||||
|
if [ "$(echo $DISC | grep md_d[0-9])" ]; then
|
||||||
|
DIALOG --msgbox "Error: You cannot use partitionable raid device for autoprepare, please use an other device." 0 0
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
SET_DEFAULTFS=""
|
SET_DEFAULTFS=""
|
||||||
BOOT_PART_SET=""
|
BOOT_PART_SET=""
|
||||||
SWAP_PART_SET=""
|
SWAP_PART_SET=""
|
||||||
|
@ -735,10 +792,6 @@ autoprepare() {
|
||||||
FSSPECS=$(echo $DEFAULTFS | sed -e "s|/:7500:ext3|/:$ROOT_PART_SIZE:$FSTYPE|g" -e "s|/home:\*:ext3|/home:\*:$FSTYPE|g" -e "s|swap:256|swap:$SWAP_PART_SIZE|g" -e "s|/boot:32|/boot:$BOOT_PART_SIZE|g")
|
FSSPECS=$(echo $DEFAULTFS | sed -e "s|/:7500:ext3|/:$ROOT_PART_SIZE:$FSTYPE|g" -e "s|/home:\*:ext3|/home:\*:$FSTYPE|g" -e "s|swap:256|swap:$SWAP_PART_SIZE|g" -e "s|/boot:32|/boot:$BOOT_PART_SIZE|g")
|
||||||
sfdisk_input=""
|
sfdisk_input=""
|
||||||
|
|
||||||
# we assume a /dev/hdX format (or /dev/sdX)
|
|
||||||
dev=$DEVICE
|
|
||||||
PART_ROOT="${DEVICE}3"
|
|
||||||
|
|
||||||
if [ "$S_MKFS" = "1" ]; then
|
if [ "$S_MKFS" = "1" ]; then
|
||||||
DIALOG --msgbox "You have already prepared your filesystems manually" 0 0
|
DIALOG --msgbox "You have already prepared your filesystems manually" 0 0
|
||||||
return 0
|
return 0
|
||||||
|
@ -762,6 +815,10 @@ autoprepare() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dev=$DEVICE
|
||||||
|
# we assume a /dev/hdX format (or /dev/sdX)
|
||||||
|
PART_ROOT="${DEVICE}3"
|
||||||
|
|
||||||
rm -f /tmp/.fstab
|
rm -f /tmp/.fstab
|
||||||
|
|
||||||
# disable swap and all mounted partitions, umount / last!
|
# disable swap and all mounted partitions, umount / last!
|
||||||
|
@ -823,7 +880,7 @@ EOF
|
||||||
mountpoint=$(echo $fsspec | tr -d ' ' | cut -f1 -d:)
|
mountpoint=$(echo $fsspec | tr -d ' ' | cut -f1 -d:)
|
||||||
fstype=$(echo $fsspec | tr -d ' ' | cut -f3 -d:)
|
fstype=$(echo $fsspec | tr -d ' ' | cut -f3 -d:)
|
||||||
if [ $(echo $mountpoint | tr -d ' ' | grep '^/$' | wc -l) -eq 0 ]; then
|
if [ $(echo $mountpoint | tr -d ' ' | grep '^/$' | wc -l) -eq 0 ]; then
|
||||||
_mkfs yes ${DEVICE}${part} "$fstype" "$DESTDIR" "$mountpoint" || return 1
|
_mkfs yes ${DEVICE}p${part} "$fstype" "$DESTDIR" "$mountpoint" || return 1
|
||||||
fi
|
fi
|
||||||
part=$(($part + 1))
|
part=$(($part + 1))
|
||||||
done
|
done
|
||||||
|
@ -839,11 +896,11 @@ partition() {
|
||||||
fi
|
fi
|
||||||
# disable swap and all mounted partitions, umount / last!
|
# disable swap and all mounted partitions, umount / last!
|
||||||
_umountall
|
_umountall
|
||||||
# disable all raid devices, else weird things can happen during partitioning!
|
# check on raid devices, else weird things can happen during partitioning!
|
||||||
_stopmd
|
_stopmd
|
||||||
# Select disk to partition
|
# Select disk to partition
|
||||||
DISCS=$(finddisks _)
|
DISCS=$(finddisks _)
|
||||||
DISCS="$DISCS OTHER - DONE +"
|
DISCS="$DISCS OTHER _ DONE +"
|
||||||
DIALOG --msgbox "Available Disks:\n\n$(_getavaildisks)\n" 0 0
|
DIALOG --msgbox "Available Disks:\n\n$(_getavaildisks)\n" 0 0
|
||||||
DISC=""
|
DISC=""
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -1447,7 +1504,7 @@ ROOTFS="$(blkid -c /dev/null $PART_ROOT -o value -s TYPE)"
|
||||||
}
|
}
|
||||||
|
|
||||||
getraidarrays() {
|
getraidarrays() {
|
||||||
RAIDARRAYS="$(echo -n $(cat /proc/mdstat | grep ^md | sed -e 's#\[[0-9]\]##g' -e 's# :.* raid[0-9]##g' -e 's#md#md=#g' -e 's# #,/dev/#g'))"
|
RAIDARRAYS="$(echo -n $(cat /proc/mdstat | grep ^md | sed -e 's#\[[0-9]\]##g' -e 's# :.* raid[0-9]##g' -e 's#md#md=#g' -e 's# #,/dev/#g' -e 's#_##g'))"
|
||||||
}
|
}
|
||||||
|
|
||||||
dolilo() {
|
dolilo() {
|
||||||
|
@ -1535,13 +1592,13 @@ dogrub() {
|
||||||
if [ "$(echo $bootdev | grep md)" ]; then
|
if [ "$(echo $bootdev | grep md)" ]; then
|
||||||
if ! [ "$(mdadm --detail $bootdev | grep Level | sed -e 's#.*:\ ##g')" = "raid0" -o "$(mdadm --detail $bootdev | grep Level | sed -e 's#.*:\ ##g')" = "linear" ]; then
|
if ! [ "$(mdadm --detail $bootdev | grep Level | sed -e 's#.*:\ ##g')" = "raid0" -o "$(mdadm --detail $bootdev | grep Level | sed -e 's#.*:\ ##g')" = "linear" ]; then
|
||||||
# redundant devices
|
# redundant devices
|
||||||
for i in $(mdadm --detail $_bootdev | grep "\ /dev/" | sed -e 's#.* /#/#g'); do
|
for i in $(mdadm --detail $bootdev | grep "\ /dev/" | sed -e 's#.* /#/#g'); do
|
||||||
_bootdev="$_bootdev $i"
|
_bootdev="$_bootdev $i"
|
||||||
done
|
done
|
||||||
redundant="1"
|
redundant="1"
|
||||||
else
|
else
|
||||||
# in raid0,linear devices are not redundant, only one device needed!
|
# in raid0,linear devices are not redundant, only one device needed!
|
||||||
_bootdev=$(mdadm --detail $_bootdev | grep "\ /dev/" -m 1| sed -e 's#.* /#/#g')
|
_bootdev=$(mdadm --detail $bootdev | grep "\ /dev/" -m 1| sed -e 's#.* /#/#g')
|
||||||
redundant=""
|
redundant=""
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -1618,7 +1675,7 @@ dogrub() {
|
||||||
[ "$EDITOR" ] || geteditor
|
[ "$EDITOR" ] || geteditor
|
||||||
$EDITOR ${DESTDIR}/boot/grub/menu.lst
|
$EDITOR ${DESTDIR}/boot/grub/menu.lst
|
||||||
|
|
||||||
DEVS=$(finddisks _)
|
DEVS="$(findbootloaderdisks _)"
|
||||||
DEVS="$DEVS $(findbootloaderpartitions _)"
|
DEVS="$DEVS $(findbootloaderpartitions _)"
|
||||||
if [ "$DEVS" = "" ]; then
|
if [ "$DEVS" = "" ]; then
|
||||||
DIALOG --msgbox "No hard drives were found" 0 0
|
DIALOG --msgbox "No hard drives were found" 0 0
|
||||||
|
@ -1681,8 +1738,8 @@ EOF
|
||||||
DIALOG --msgbox "GRUB was successfully installed." 0 0
|
DIALOG --msgbox "GRUB was successfully installed." 0 0
|
||||||
S_GRUB=1
|
S_GRUB=1
|
||||||
if [ "$(blkid -c /dev/null | grep TYPE=\"mdraid\")" ]; then
|
if [ "$(blkid -c /dev/null | grep TYPE=\"mdraid\")" ]; then
|
||||||
if ! [ "$redundant" = "1" ]; then
|
if [ "$redundant" = "1" ]; then
|
||||||
DIALOG --defaultno --yesno "Setup detected a redundant software raid partition.\nDo you want to install grub additionally to an other hard disk?" 0 0 && S_GRUB=""
|
DIALOG --defaultno --yesno "Setup detected a redundant software raid device.\nDo you want to install grub additionally to an other hard disk?" 0 0 && S_GRUB=""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -1925,12 +1982,8 @@ auto_hwdetect()
|
||||||
if [ "$(cat /proc/modules | grep nfs)" ]; then
|
if [ "$(cat /proc/modules | grep nfs)" ]; then
|
||||||
DIALOG --defaultno --yesno "Setup detected nfs driver...\nDo you need support for booting from nfs shares?" 0 0 && HWPARAMETER="$HWPARAMETER --nfs"
|
DIALOG --defaultno --yesno "Setup detected nfs driver...\nDo you need support for booting from nfs shares?" 0 0 && HWPARAMETER="$HWPARAMETER --nfs"
|
||||||
fi
|
fi
|
||||||
if [ "$(blkid -c /dev/null | grep TYPE=\"mdraid\")" ]; then
|
[ "$(cat /proc/mdstat | grep ^md[0-9])" ] && HWPARAMETER="$HWPARAMETER --raid"
|
||||||
DIALOG --defaultno --yesno "Do you need support for booting from software raid arrays?" 0 0 && HWPARAMETER="$HWPARAMETER --raid"
|
[ "$(cat /proc/mdstat | grep ^md_d[0-9])" ] && HWPARAMETER="$HWPARAMETER --raid-partitions"
|
||||||
if [ -e $DESTDIR/lib/initcpio/hooks/raid-partitions ]; then
|
|
||||||
DIALOG --defaultno --yesno "Do you need support for booting from software raid mdp/partition arrays?" 0 0 && HWPARAMETER="$HWPARAMETER --raid-partitions"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -e $DESTDIR/lib/initcpio/hooks/dmraid ]; then
|
if [ -e $DESTDIR/lib/initcpio/hooks/dmraid ]; then
|
||||||
for i in $(dmraid -l | sed -e 's/ .*//g'); do
|
for i in $(dmraid -l | sed -e 's/ .*//g'); do
|
||||||
ls /dev/mapper/$i > /dev/null 2>&1 && HWPARAMETER="$HWPARAMETER --dmraid"
|
ls /dev/mapper/$i > /dev/null 2>&1 && HWPARAMETER="$HWPARAMETER --dmraid"
|
||||||
|
|
Loading…
Reference in a new issue