Sophie

Sophie

distrib > Scientific%20Linux > 5x > i386 > by-pkgid > 55f0e2c0fe3c4d6385bf80bc46d1ccc2 > scriptlet

dkms-2.2.0.3-1.el5.noarch.rpm

PREUN

/bin/sh
# remove on uninstall
[ $1 -lt 1 ] && /sbin/chkconfig dkms_autoinstaller off ||:

POSTIN

/bin/sh
[ -e /sbin/dkms ] && mv -f /sbin/dkms /sbin/dkms.old 2>/dev/null
# enable on initial install
[ $1 -lt 2 ] && /sbin/chkconfig dkms_autoinstaller on ||:

Triggers

dkms < 1.90.00-1

/bin/sh
for dir in `find /var/dkms -type d -maxdepth 1 -mindepth 1`; do
	mv -f $dir /var/lib/dkms
done
[ -e /etc/dkms_framework.conf ] && ! [ -e /etc/dkms/framework.conf ] && mkdir /etc/dkms && cp -a /etc/dkms_framework.conf /etc/dkms/framework.conf
arch_used=""
[ `uname -m` == "x86_64" ] && [ `cat /proc/cpuinfo | grep -c "Intel"` -gt 0 ] && arch_used="ia32e" || arch_used=`uname -m`
echo ""
echo "ALERT! ALERT! ALERT!"
echo ""
echo "You are using a version of DKMS which does not support multiple system"
echo "architectures.  Your DKMS tree will now be modified to add this support."
echo ""
echo "The upgrade will assume all built modules are for arch: $arch_used"
current_kernel=`uname -r`
dkms_tree="/var/lib/dkms"
source_tree="/usr/src"
tmp_location="/tmp"
dkms_frameworkconf="/etc/dkms/framework.conf"
. $dkms_frameworkconf 2>/dev/null
echo ""
echo "Fixing directories."
for directory in `find $dkms_tree -type d -name "module" -mindepth 3 -maxdepth 4`; do
	dir_to_fix=`echo $directory | sed 's#/module$##'`
	echo "Creating $dir_to_fix/$arch_used..."
	mkdir $dir_to_fix/$arch_used
	mv -f $dir_to_fix/* $dir_to_fix/$arch_used 2>/dev/null
done
echo ""
echo "Fixing symlinks."
for symlink in `find $dkms_tree -type l -name "kernel*" -mindepth 2 -maxdepth 2`; do
	symlink_kernelname=`echo $symlink | sed 's#.*/kernel-##'`
	dir_of_symlink=`echo $symlink | sed 's#/kernel-.*$##'`
	cd $dir_of_symlink
	read_link="$symlink"
	while [ -L "$read_link" ]; do
		read_link=`ls -l $read_link | sed 's/.*-> //'`
	done
	if [ `echo $read_link | sed 's#/# #g' | wc -w | awk {'print $1'}` -lt 3 ]; then
		echo "Updating $symlink..."
		ln -sf $read_link/$arch_used kernel-$symlink_kernelname-$arch_used
		rm -f $symlink
	fi
	cd -
done
echo ""