Slashdot Mirror


Automagical Kernel Update Utils?

Eric^2 asks: "I'm fairly new to the linux OS but I managed to get my Gateway Solo 9100 running Mandrake. After seeing how often the kernel gets updated, I was wondering if there are any GUI tools available to automatically download, compile, and update the linux kernel. I know this sounds a lot like Microsoft Windows Update (which is terribly slow and fails about half the time), but it would be really nice to tell my laptop "go get this kernel and install it tonight at 11:30 and if anything fails, go back to my current kernel" and be done with it instead of having to download a patch or full version, backup, compile, and so on. There's just too much for a novice like myself to *$@% up. Suggestions? " Something like this will be necessary if Linux is to successfully move to the desktop. The masses must have an easy way to update there systems for things like bug fixes or new features. Remember: Joe User doesn't necessarily know how to compile, even if it is as simple as "configure; make; make install" (and to be honest, it isn't 100% there yet).

1 of 11 comments (clear)

  1. Re:RPM / Shell Script by lazlo · · Score: 2

    OK, here are some thoughts:

    make oldconfig does ask questions, however it should be pretty easy to write a small expect script to run make oldconfig for you, and answer yes to everything. I'm not suggesting that this will make a more stable kernel, but it will make one. Chances are you could even have the script call up the help on each option, and have that as output from the program, which would in turn get mailed back to you by cron. In the morning check and see if the answers made sense, if they did reboot, if they didn't recopy .config, make oldconfig again, and answer the questions the way you think they should be answered.

    Now, as for the script itself... I have a few (lame) suggestions:

    #!/bin/sh
    cd ~/

    # replace this with the correct URL
    wget http://www.XX.kernel.org/pub/linux/kernel/v2.2/lin ux-2.2.12.tar.bz2

    #I don't know about wget. It would be nice to be able to have it first look for
    #LATEST-IS-* and then get linux-(whatever).tar.bz2
    #or even better, have your script add one to uname -r and try
    #to get that file. If it doesn't exist, exit.

    # bzcat linux-2.2.12.tar.bz2 | tar xv
    # rm -f linux-2.2.12.tar.bz2
    # cd ~/linux
    #I would suggest as an alternative keeping /usr/src/linux as a link to /usr/src/linux-{ver}

    rm /usr/src/linux
    mkdir /usr/src/linux-`uname -r {+1}` #this doesn't work, I just forgot how to add.
    ln -s /usr/src/linux-`uname -r {+1}` /usr/src/linux
    rm oldlinux
    ln -s /usr/src/linux-`uname -r` /usr/src/oldlinux
    bzcat linux-{version}.tar.bz2 | tar x

    # will this work?
    # not quite
    # cp /usr/src/linux/.config .
    cp /usr/src/oldlinux/.config /usr/src/linux
    /usr/local/bin/some-expect-script-that-calls-mak e-oldconfig

    make dep
    make bzImage
    make modules
    make modules_install
    # and then
    cp /boot/vmlinux.new /boot/vmlinux.old
    cp /usr/src/linux/arch/i386/boot/compressed/vmlinux /boot/vmlinux.new
    lilo



    Then you have a lilo.conf that looks like this:



    # LILO configuration file
    # generated by 'liloconfig'
    #
    # Start LILO global section
    boot = /dev/sda
    append = "ether=0,0,eth1"
    #compact # faster, but won't work on all systems.
    delay = 50
    vga = normal # force sane state
    # ramdisk = 0 # paranoia setting
    # Linux bootable partition config begins
    image = /vmlinuz.new
    root = /dev/sda1
    label = lin
    read-only # Non-UMSDOS filesystems should be mounted read-only for checking
    # Linux bootable partition config ends
    # Linux bootable partition config begins
    image = /vmlinuz.old
    root = /dev/sda1
    label = backup
    read-only # Non-UMSDOS filesystems should be mounted read-only for checking
    # Linux bootable partition config ends
    # Linux bootable partition config begins
    image = /vmlinuz.reallystable
    root = /dev/sda1
    label = original
    read-only # Non-UMSDOS filesystems should be mounted read-only for checking
    # Linux bootable partition config ends
    # End LILO global section
    horizon:~#

    have cron run this every night, and every once in a while you'll wake up and find e-mail telling you that you've got a new kernel. If everything looks OK, just reboot and it's active.

    --
    Pound! Bang! Bin! Bash! is this a shell script or a Batman comic?