Sophie

Sophie

distrib > Mandriva > cs4.0 > x86_64 > by-pkgid > d414f358ff269fcff05510aff05f64d1 > scriptlet

grub-0.97-13mlcs4.x86_64.rpm

PREUN

/bin/sh
if [ "$1" = "0" ]; then if [[ -f /usr/share/info/grub.info.bz2 ]];then /sbin/install-info /usr/share/info/grub.info.bz2 --dir=/usr/share/info/dir --remove ;fi; fi 
if [ "$1" = "0" ]; then if [[ -f /usr/share/info/multiboot.info.bz2 ]];then /sbin/install-info /usr/share/info/multiboot.info.bz2 --dir=/usr/share/info/dir --remove ;fi; fi 

# What a hack hell... we need this things because of upgrading from
# previous grub versions. The problem is that previous grub packages
# remove the stage files from /boot/grub in some cases, making the
# system unbootable.

POSTIN

/bin/sh
if [ -f /boot/grub/install.sh ]; then
	if [ -x /usr/sbin/detectloader ]; then
		LOADER=$(/usr/sbin/detectloader)
		if [ "$LOADER" = "GRUB" ]; then
			for file in /lib/grub/x86_64-mandriva/*stage*; do
				cp -f $file /boot/grub/ || :
			done
			sh /boot/grub/install.sh > /dev/null
		fi
	fi
elif [ -e /boot/grub/menu.lst -a -e /boot/grub/stage2 ]; then
    # no install.sh, trying to get one

    # look for the device
    for DEVICE in `awk '{print "/dev/" $4}' /proc/partitions`; do
	if [ -b $DEVICE ]; then
	    echo "trying $DEVICE"
	    if /bin/dd if=$DEVICE bs=512 count=1 2>/dev/null | /bin/grep -q GRUB; then
		if [ -z "$BOOT" ]; then
		    BOOT=$DEVICE
		else
		    echo "oops, GRUB found on both $DEVICE and $BOOT"
		fi
	    fi
	fi
    done

    if [ -n "$BOOT" ]; then
	echo "installing grub on $BOOT"
	grub-install $BOOT
    else
	echo "can not find where GRUB is installed"
    fi
fi
if [[ -f /usr/share/info/grub.info.bz2 ]];then /sbin/install-info /usr/share/info/grub.info.bz2 --dir=/usr/share/info/dir;fi 
if [[ -f /usr/share/info/multiboot.info.bz2 ]];then /sbin/install-info /usr/share/info/multiboot.info.bz2 --dir=/usr/share/info/dir;fi

Triggers

grub <= 0.97-1mdk

/bin/sh
mkdir -p /boot/grub/backup_stagefiles
mv /boot/grub/*stage* /boot/grub/backup_stagefiles/ >/dev/null 2>&1 || :

# Replicate post script code here, because the trigger scripts are
# executed only after post script of this new package, and old
# install.sh was used then. So we need to execute again to use the new
# generated install.sh script.
if [ -f /boot/grub/install.sh ]; then
	if [ -x /usr/sbin/detectloader ]; then
		LOADER=$(/usr/sbin/detectloader)
		if [ "$LOADER" = "GRUB" ]; then
			for file in /lib/grub/x86_64-mandriva/*stage*; do
				cp -f $file /boot/grub/ || :
			done
			sh /boot/grub/install.sh > /dev/null
		fi
	fi
fi

grub <= 0.97-1mdk

/bin/sh
if [ -d /boot/grub/backup_stagefiles ]; then
	for file in /boot/grub/backup_stagefiles/*stage*; do
		if [ ! -f "/boot/grub/`basename $file`" ]; then
			mv $file /boot/grub/ || :
		else
			rm -f $file;
		fi
	done
	rmdir /boot/grub/backup_stagefiles > /dev/null || :
fi