mkspec patch

From: Bastien Nocera
Date: Fri Nov 12 2004 - 05:41:05 EST


Hello,

As I was testing new kernels on some RH/FC machines, I realised that
there was quite a bit of work needed to update the grub.conf/lilo.conf
and the initrd. This patch fixes that, and also makes "make rpm" work on
x86_64 machines.

Please CC: me on the answer as I'm not on the list.

---
Bastien Nocera <hadess@xxxxxxxxxx>
Her vocabulary was as bad as, like, whatever.

--- /usr/src/linux-2.4.21-22.EL/scripts/mkspec 2002-08-03 01:39:46.000000000 +0100
+++ mkspec 2004-10-26 10:38:01.000000000 +0100
@@ -11,6 +11,10 @@
# That's the voodoo to see if it's a x86.
ISX86=`arch | grep -ie i.86`
if [ ! -z $ISX86 ]; then
+ ARCH=i386
+ PC=1
+elif [ `arch` = x86_64 ] ; then
+ ARCH=x86_64
PC=1
else
PC=0
@@ -22,6 +26,28 @@

PROVIDES="$PROVIDES kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"

+# The scriptlets for RHEL and Fedora Core
+scriplets()
+{
+if [ ! -f /etc/redhat-release -a ! -f /etc/fedora-release ] ; then
+ return
+fi
+
+echo "%post"
+echo "cd /boot"
+echo "[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade"
+echo "[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth"
+echo "[ -x /sbin/new-kernel-pkg ] && /sbin/new-kernel-pkg --mkinitrd --depmod --install $VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
+echo
+echo "%pre"
+echo "/sbin/modprobe loop 2> /dev/null > /dev/null || :"
+echo
+echo "%preun"
+echo "/sbin/modprobe loop 2> /dev/null > /dev/null || :"
+echo "[ -x /sbin/new-kernel-pkg ] && /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove $VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
+echo
+}
+
echo "Name: kernel"
echo "Summary: The Linux Kernel"
echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//g"
@@ -58,7 +84,7 @@
echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make modules_install'
# And that's the second
if [ $PC = 1 ]; then
- echo 'cp arch/i386/boot/bzImage $RPM_BUILD_ROOT'"/boot/vmlinuz-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
+ echo "cp arch/$ARCH/boot/bzImage $RPM_BUILD_ROOT/boot/vmlinuz-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
else
echo 'cp vmlinux $RPM_BUILD_ROOT'"/boot/vmlinux-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
fi
@@ -69,9 +95,11 @@
echo "%clean"
echo '#echo -rf $RPM_BUILD_ROOT'
echo ""
+scriplets
echo "%files"
echo '%defattr (-, root, root)'
echo "%dir /lib/modules"
echo "/lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
echo "/boot/*"
echo ""
+


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/