From 210ff878ca11e5c0f8e7e4e13831fb849a217867 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Sun, 18 Jan 2009 18:39:05 -0600 Subject: Rework grub installation to allow for XFS. Sometimes it works, sometimes it doesn't. -also updated for ext4 --- abs/core-testing/LinHES-config/PKGBUILD | 2 +- .../LinHES-config/install_functions.sh | 133 +++++++++++++++++---- 2 files changed, 111 insertions(+), 24 deletions(-) diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD index d5aba1a..b873d5e 100755 --- a/abs/core-testing/LinHES-config/PKGBUILD +++ b/abs/core-testing/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=1.0 -pkgrel=202 +pkgrel=211 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev ) pkgdesc="Install and configure your system" depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils nmbscan ) diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh index 79fee1d..0ca5af3 100755 --- a/abs/core-testing/LinHES-config/install_functions.sh +++ b/abs/core-testing/LinHES-config/install_functions.sh @@ -47,15 +47,15 @@ function setupremote { cp -f lircrc* $BASE/etc/lircrc 2> /dev/null [ -e /etc/lircrc ] && chmod 755 /etc/lircrc update_db_settings HostRemoteType "$Remotetype" - #special case for special remote - echo "Starting with support for $Remotetype" - if [ x$Remotetype = "xdvico" ] - then - /usr/sbin/lircd -d /dev/usb/hiddev0 - else - /usr/sbin/lircd -d /dev/lirc0 - fi - [ -e /root/.mythtv ] || mkdir /root/.mythtv 2>/dev/null + #special case for special remote + echo "Starting with support for $Remotetype" + if [ x$Remotetype = "xdvico" ] + then + /usr/sbin/lircd -d /dev/usb/hiddev0 + else + /usr/sbin/lircd -d /dev/lirc0 + fi + [ -e /root/.mythtv ] || mkdir /root/.mythtv 2>/dev/null ln -s /etc/lircrc /root/.mythtv/lircrc 2>/dev/null else echo "Couldn't open directory $TEMPLATES/remotes/$Remotetype" @@ -223,21 +223,21 @@ DATA=$2 SWAP=$3 if [ ! x$SWAP = xNO ] - then - SWAPLINE=",$SWAP,S" + then + SWAPLINE=",$SWAP,S" MKSWAPCMD="mkswap /dev/${disk}2" - else - SWAPLINE=",0,0" + else + SWAPLINE=",0,0" MKSWAPCMD="" - fi + fi if [ x$DATA = xALL ] then - DATALINE=",,," - EXTRALINE="" + DATALINE=",,," + EXTRALINE="" else - DATALINE=",$DATA,," - EXTRALINE=",0,," + DATALINE=",$DATA,," + EXTRALINE=",0,," fi sfdisk /dev/$disk -uM << EOF ,$1,,* @@ -263,7 +263,10 @@ case $1 in ext3) FSCMDC="mkfs.ext3" ;; jfs) FSCMDC="mkfs.jfs -q " - ;; + ;; + ext4) FSCMDC="mkfs.ext4" + ;; ;; + *) FSCMDC="echo $1" ;; @@ -384,15 +387,97 @@ function find_uuid() { } +get_grub_map() { + rm /tmp/dev.map + /sbin/grub --no-floppy --device-map /tmp/dev.map < /dev/null 2>&1 + echo "freezing xfs fs" + /usr/sbin/xfs_freeze -f /$mountpoint + if [ $? = 0 ] + then + sleep 40 + echo "unfreezing xfs" + /usr/sbin/xfs_freeze -u /$mountpoint + fi + fi + #$DESTDIR/sbin/grub-install --recheck --root-directory=$DESTDIR $bootdev >/tmp/grub.log 2>&1 + echo grub-install --recheck --root-directory=/$mountpoint $bootdev + grub-install --recheck --root-directory=/$mountpoint $bootdev + # unfreeze xfs filesystems + + + if grep "Error [0-9]*: " /tmp/grub.log >/dev/null; then + echo "Error installing GRUB. " + return 1 + fi + echo "GRUB was successfully installed." +} + + + + case $1 in partition_it ) - #drive ROOT DATA(ALL) SWAP(NO) + #drive ROOT DATA(ALL) SWAP(NO) for i in `mount | grep $disk | awk ' { print $1 } '` do umount $i done - swap=`cat /etc/fstab |grep $disk|grep swap|awk ' { print $1 } '` - swapoff $swap + swap=`cat /etc/fstab |grep $disk|grep swap|awk ' { print $1 } '` + swapoff $swap partition_it $3 $4 $5 exit 0 @@ -484,8 +569,10 @@ case $1 in ;; grub_it ) - grub-install --recheck --no-floppy --root-directory=/$mountpoint "(hd0)" + + #grub-install --recheck --no-floppy --root-directory=/$mountpoint "(hd0)" #fixing grub/menu.1st + dogrub ${disk} FOUNDUUID="" find_uuid ${disk}1 ROOTUUID=$FOUNDUUID -- cgit v0.12