diff options
author | James Meyer <james.meyer@operamail.com> | 2009-01-19 00:39:05 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2009-01-19 00:39:05 (GMT) |
commit | 210ff878ca11e5c0f8e7e4e13831fb849a217867 (patch) | |
tree | 36f494d1b1d64647e2003f5866306da67731bf80 /abs | |
parent | a5a97c119784e655b0177330aa0804596c8f2def (diff) | |
download | linhes_pkgbuild-210ff878ca11e5c0f8e7e4e13831fb849a217867.zip linhes_pkgbuild-210ff878ca11e5c0f8e7e4e13831fb849a217867.tar.gz linhes_pkgbuild-210ff878ca11e5c0f8e7e4e13831fb849a217867.tar.bz2 |
Rework grub installation to allow for XFS.
Sometimes it works, sometimes it doesn't.
-also updated for ext4
Diffstat (limited to 'abs')
-rwxr-xr-x | abs/core-testing/LinHES-config/PKGBUILD | 2 | ||||
-rwxr-xr-x | abs/core-testing/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 <<EOF +quit +EOF +} + +mapdev() { + partition_flag=0 + device_found=0 + devs=$(cat /tmp/dev.map | grep -v fd | sed 's/ *\t/ /' | sed ':a;$!N;$!ba;s/\n/ /g') + linuxdevice=$(echo $1 | cut -b1-8) + if [ "$(echo $1 | egrep '[0-9]$')" ]; then + # /dev/hdXY + pnum=$(echo $1 | cut -b9-) + pnum=$(($pnum-1)) + partition_flag=1 + fi + for dev in $devs + do + if [ "(" = $(echo $dev | cut -b1) ]; then + grubdevice="$dev" + else + if [ "$dev" = "$linuxdevice" ]; then + device_found=1 + break + fi + fi + done + if [ "$device_found" = "1" ]; then + if [ "$partition_flag" = "0" ]; then + echo "$grubdevice" + else + grubdevice_stringlen=${#grubdevice} + grubdevice_stringlen=$(($grubdevice_stringlen - 1)) + grubdevice=$(echo $grubdevice | cut -b1-$grubdevice_stringlen) + echo "$grubdevice,$pnum)" + fi + else + echo "DEVICE NOT FOUND" + fi +} + + +dogrub() { + get_grub_map + sync + ROOTDEV=/dev/$1 + echo $ROOTDEV + + bootdev=$(mapdev $ROOTDEV) + echo $bootdev + cp -a /$mountpoint/usr/lib/grub/i386-pc/* /$mountpoint/boot/grub/ + sync + # freeze xfs filesystems to enable grub installation on xfs filesystems + if [ -x /usr/sbin/xfs_freeze ]; then + #/usr/sbin/xfs_freeze -f /$mountpoint > /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 |