mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
'added raid detection in grub section'
This commit is contained in:
parent
9fdd2e7f93
commit
b09cb4ee9e
1 changed files with 57 additions and 48 deletions
|
@ -728,6 +728,8 @@ getsource() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$MODE" = "ftp" ]; then
|
if [ "$MODE" = "ftp" ]; then
|
||||||
|
#in order to cache packages from media check on it first!
|
||||||
|
get_media
|
||||||
select_mirror
|
select_mirror
|
||||||
NEXTITEM="2"
|
NEXTITEM="2"
|
||||||
fi
|
fi
|
||||||
|
@ -1123,7 +1125,7 @@ donetwork() {
|
||||||
DIALOG --yesno "Do you want to use DHCP?" 0 0
|
DIALOG --yesno "Do you want to use DHCP?" 0 0
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
DIALOG --infobox "Please wait. Polling for DHCP server on $INTERFACE..." 10 65
|
DIALOG --infobox "Please wait. Polling for DHCP server on $INTERFACE..." 10 65
|
||||||
[ -e /var/run/dhcpcd-$INTERFACE.pid ] && kill $(cat /var/run/dhcpcd-$INTERFACE.pid)
|
[ -e /var/run/dhcpcd-$INTERFACE.pid ] && kill $(cat /var/run/dhcpcd-$INTERFACE.pid) && sleep 1
|
||||||
dhcpcd $INTERFACE >$LOG 2>&1
|
dhcpcd $INTERFACE >$LOG 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
DIALOG --msgbox "Failed to run dhcpcd. See $LOG for details." 0 0
|
DIALOG --msgbox "Failed to run dhcpcd. See $LOG for details." 0 0
|
||||||
|
@ -1316,59 +1318,66 @@ dogrub() {
|
||||||
DIALOG --msgbox "No hard drives were found" 0 0
|
DIALOG --msgbox "No hard drives were found" 0 0
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
DIALOG --menu "Select the boot device where the GRUB bootloader will be installed (usually the MBR and not a partition)." 14 55 7 $DEVS 2>$ANSWER || return 1
|
S_GRUB=""
|
||||||
ROOTDEV=$(cat $ANSWER)
|
while [ "$S_GRUB" = "" ]; do
|
||||||
DIALOG --infobox "Installing the GRUB bootloader..." 0 0
|
DIALOG --menu "Select the boot device where the GRUB bootloader will be installed (usually the MBR and not a partition)." 14 55 7 $DEVS 2>$ANSWER || return 1
|
||||||
cp -a $DESTDIR/usr/lib/grub/i386-pc/* $DESTDIR/boot/grub/
|
ROOTDEV=$(cat $ANSWER)
|
||||||
sync
|
DIALOG --infobox "Installing the GRUB bootloader..." 0 0
|
||||||
# freeze xfs filesystems to enable grub installation on xfs filesystems
|
cp -a $DESTDIR/usr/lib/grub/i386-pc/* $DESTDIR/boot/grub/
|
||||||
if [ -x /usr/sbin/xfs_freeze ]; then
|
sync
|
||||||
/usr/sbin/xfs_freeze -f $DESTDIR/boot > /dev/null 2>&1
|
# freeze xfs filesystems to enable grub installation on xfs filesystems
|
||||||
/usr/sbin/xfs_freeze -f $DESTDIR/ > /dev/null 2>&1
|
if [ -x /usr/sbin/xfs_freeze ]; then
|
||||||
fi
|
/usr/sbin/xfs_freeze -f $DESTDIR/boot > /dev/null 2>&1
|
||||||
# look for a separately-mounted /boot partition
|
/usr/sbin/xfs_freeze -f $DESTDIR/ > /dev/null 2>&1
|
||||||
bootpart=$(mount | grep $DESTDIR/boot | cut -d' ' -f 1)
|
|
||||||
if [ "$bootpart" = "" ]; then
|
|
||||||
if [ "$PART_ROOT" = "" ]; then
|
|
||||||
DIALOG --inputbox "Enter the full path to your root device" 8 65 "/dev/sda3" 2>$ANSWER || return 1
|
|
||||||
bootpart=$(cat $ANSWER)
|
|
||||||
else
|
|
||||||
bootpart=$PART_ROOT
|
|
||||||
fi
|
fi
|
||||||
fi
|
# look for a separately-mounted /boot partition
|
||||||
DIALOG --defaultno --yesno "Do you have your system installed on software raid?\nAnswer 'YES' to install grub to another hard disk." 0 0
|
bootpart=$(mount | grep $DESTDIR/boot | cut -d' ' -f 1)
|
||||||
if [ $? -eq 0 ]; then
|
if [ "$bootpart" = "" ]; then
|
||||||
DIALOG --menu "Please select the boot partition device, this cannot be autodetected!\nPlease redo grub installation for all partitions you need it!" 14 55 7 $DEVS 2>$ANSWER || return 1
|
if [ "$PART_ROOT" = "" ]; then
|
||||||
bootpart=$(cat $ANSWER)
|
DIALOG --inputbox "Enter the full path to your root device" 8 65 "/dev/sda3" 2>$ANSWER || return 1
|
||||||
fi
|
bootpart=$(cat $ANSWER)
|
||||||
bootpart=$(mapdev $bootpart)
|
else
|
||||||
bootdev=$(mapdev $ROOTDEV)
|
bootpart=$PART_ROOT
|
||||||
if [ "$bootpart" = "" ]; then
|
fi
|
||||||
DIALOG --msgbox "Error: Missing/Invalid root device: $bootpart" 0 0
|
fi
|
||||||
return 1
|
bootpart=$(mapdev $bootpart)
|
||||||
fi
|
bootdev=$(mapdev $ROOTDEV)
|
||||||
if [ "$bootpart" = "DEVICE NOT FOUND" -o "$bootdev" = "DEVICE NOT FOUND" ]; then
|
if [ "$bootpart" = "" ]; then
|
||||||
DIALOG --msgbox "GRUB root and setup devices could not be auto-located. You will need to manually run the GRUB shell to install a bootloader." 0 0
|
DIALOG --msgbox "Error: Missing/Invalid root device: $bootpart" 0 0
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
$DESTDIR/sbin/grub --no-floppy --batch >/tmp/grub.log 2>&1 <<EOF
|
if [ "$bootpart" = "DEVICE NOT FOUND" -o "$bootdev" = "DEVICE NOT FOUND" ]; then
|
||||||
|
DIALOG --msgbox "GRUB root and setup devices could not be auto-located. You will need to manually run the GRUB shell to install a bootloader." 0 0
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
$DESTDIR/sbin/grub --no-floppy --batch >/tmp/grub.log 2>&1 <<EOF
|
||||||
root $bootpart
|
root $bootpart
|
||||||
setup $bootdev
|
setup $bootdev
|
||||||
quit
|
quit
|
||||||
EOF
|
EOF
|
||||||
cat /tmp/grub.log >$LOG
|
cat /tmp/grub.log >$LOG
|
||||||
# unfreeze xfs filesystems
|
# unfreeze xfs filesystems
|
||||||
if [ -x /usr/sbin/xfs_freeze ]; then
|
if [ -x /usr/sbin/xfs_freeze ]; then
|
||||||
/usr/sbin/xfs_freeze -u $DESTDIR/boot > /dev/null 2>&1
|
/usr/sbin/xfs_freeze -u $DESTDIR/boot > /dev/null 2>&1
|
||||||
/usr/sbin/xfs_freeze -u $DESTDIR/ > /dev/null 2>&1
|
/usr/sbin/xfs_freeze -u $DESTDIR/ > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep "Error [0-9]*: " /tmp/grub.log >/dev/null; then
|
if grep "Error [0-9]*: " /tmp/grub.log >/dev/null; then
|
||||||
DIALOG --msgbox "Error installing GRUB. (see $LOG for output)" 0 0
|
DIALOG --msgbox "Error installing GRUB. (see $LOG for output)" 0 0
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
DIALOG --msgbox "GRUB was successfully installed." 0 0
|
DIALOG --msgbox "GRUB was successfully installed." 0 0
|
||||||
S_GRUB=1
|
if [ "$(blkid -c /dev/null | grep TYPE=\"mdraid\")" ]; then
|
||||||
|
DIALOG --defaultno --yesno "You have your system installed on software raid?\nAnswer 'YES' to install grub to another hard disk." 0 0
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
S_GRUB=""
|
||||||
|
else
|
||||||
|
S_GRUB=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
S_GRUB=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
select_source()
|
select_source()
|
||||||
|
|
Loading…
Reference in a new issue