diff options
Diffstat (limited to 'source/installer/sources/initrd/usr/lib/setup/SeTkernel')
-rwxr-xr-x | source/installer/sources/initrd/usr/lib/setup/SeTkernel | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTkernel b/source/installer/sources/initrd/usr/lib/setup/SeTkernel new file mode 100755 index 00000000..6aa3091b --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTkernel @@ -0,0 +1,102 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +T_PX="`cat $TMP/SeTT_PX`" + +# First, determine our slackware kernel name: +for ELEMENT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do + if $(cat /proc/cmdline | cut -f $ELEMENT -d ' ' | grep -q SLACK_KERNEL) ; then + SLACK_KERNEL=$(cat /proc/cmdline | cut -f $ELEMENT -d ' ' | cut -f 2 -d =) + fi +done +unset ELEMENT + +# Next, find the kernel's release version: +VERSION=$(uname -r | tr - _) + +# If someone tries to install kernels from a CD that doesn't contain any, +# we'll give them one chance to find a disc that does. +swapdisks() { + if [ -r ${T_PX}/var/log/setup/tmp/SeTCDdev ]; then + CDDEVICE=$(cat ${T_PX}/var/log/setup/tmp/SeTCDdev) + elif [ -r /tmp/SeTCDdev ]; then + CDDEVICE=$(cat /tmp/SeTCDdev) + else + return 1 + fi + umount $CDDEVICE 1> /dev/null 2> /dev/null + eject -s $CDDEVICE + dialog --title "REINSERT KERNEL DISC" --msgbox \ +"Please reinsert the Slackware disc containing the collection \ +of Linux kernels. Usually this is disc number one (the disc \ +that you boot from). Once you've inserted the disc, hit ENTER \ +to continue." \ +8 61 + mount $CDDEVICE /var/log/mount 1> /dev/null 2> /dev/null + if [ ! $? = 0 ]; then + sleep 1 + mount $CDDEVICE /var/log/mount 1> /dev/null 2> /dev/null + if [ ! $? = 0 ]; then + sleep 11 + mount $CDDEVICE /var/log/mount 1> /dev/null 2> /dev/null + fi + fi +} + +( cd boot + if [ "$SLACK_KERNEL" = "generic.s" ]; then + if [ -r vmlinuz-generic-$VERSION ]; then + ln -sf vmlinuz-generic-$VERSION vmlinuz + ln -sf config-generic-$VERSION config + ln -sf System.map-huge-$VERSION System.map + fi + elif [ "$SLACK_KERNEL" = "huge.s" ]; then + if [ -r vmlinuz-huge-$VERSION ]; then + ln -sf vmlinuz-huge-$VERSION vmlinuz + ln -sf config-huge-$VERSION config + ln -sf System.map-huge-$VERSION System.map + fi + elif [ "$SLACK_KERNEL" = "hugesmp.s" ]; then + if [ -r vmlinuz-huge-smp-$VERSION ]; then + ln -sf vmlinuz-huge-smp-$VERSION vmlinuz + ln -sf config-huge-smp-$VERSION config + ln -sf System.map-huge-smp-$VERSION System.map + fi + elif [ "$SLACK_KERNEL" = "gensmp.s" ]; then + if [ -r vmlinuz-generic-smp-$VERSION ]; then + ln -sf vmlinuz-generic-smp-$VERSION vmlinuz + ln -sf config-generic-smp-$VERSION config + ln -sf System.map-generic-smp-$VERSION System.map + fi + elif [ "$SLACK_KERNEL" = "speakup.s" ]; then + # This assumes symlinks /nfs and /cdrom both pointing to /var/log/mount: + if $(mount | grep -q "type nfs") ; then + PLINK=nfs + else + PLINK=cdrom + fi + if [ $PLINK = cdrom -a ! -d /$PLINK/kernels ]; then + swapdisks + fi + if [ ! -d /$PLINK/kernels ]; then + dialog --title "ERROR ATTEMPTING TO INSTALL KERNEL" --msgbox "Sorry, but the directory /$PLINK/kernels \ +was not found. You may need to install the requested kernel $SLACK_KERNEL manually \ +and then install LILO \ +before your system will be able to boot correctly." \ +0 0 + else + rm -f $T_PX/boot/vmlinuz $T_PX/boot/config $T_PX/boot/System.map + cp -a /$PLINK/kernels/$SLACK_KERNEL/bzImage $T_PX/boot/vmlinuz-$SLACK_KERNEL-$VERSION + cp -a /$PLINK/kernels/$SLACK_KERNEL/config $T_PX/boot/config-$SLACK_KERNEL-$VERSION + cp -a /$PLINK/kernels/$SLACK_KERNEL/System.map.gz $T_PX/boot + ( cd $T_PX/boot + gzip -d System.map.gz + mv System.map System.map-$SLACK_KERNEL-$VERSION + ln -sf vmlinuz-$SLACK_KERNEL-$VERSION vmlinuz + ln -sf config-$SLACK_KERNEL-$VERSION config + ln -sf System.map-$SLACK_KERNEL-$VERSION System.map + ) + fi + fi +) + +# and after all that hard work |