Script for fixing wifi and sound after kernel upgrade

Discussion in 'Linux' started by antikristian, Sep 7, 2008.

  1. antikristian

    antikristian

    Joined:
    Aug 15, 2008
    Messages:
    2
    Likes Received:
    0
    I've made a small script I'd like to share. I installed xubuntu on a friends netbook, and made this script to be run manually or through rc.local to compile and install wifi and alsa after an upgrade of the kernel.The script checks to see if the kernel version has changed, so it only compiles files when you have a new version of the kernel running.

    I think it's a nice way to install ubuntu/xubuntu on someones computer without them beeing dependent on you after each security update of the kernel.

    It relies on the fact that you have allready followed the guide on https://help.ubuntu.com/community/AspireOne and have a directory with the source for the wificard. Move this directory to the /usr/src/modules directory or change the maddir variable in the script

    Code:
    #!/bin/bash
    #/usr/local/sbin/wifialsa
    maddir=/usr/src/modules/madwifi-hal-0.10.5.6-r3835-20080801
    madkern=$maddir/madkernel
    touch $madkern
    
    if [ $(uname -r) != $(cat $madkern) ]
    then
    	#wififix
    	cd $maddir
    	make clean
    	make
    	make install
    	uname -r > $madkern
    
    	#alsafix
    	m-a prepare
    	m-a a-i alsa
    	alsa force-unload
    	depmod -ae
    	modprobe snd-hda-intel
    fi
    
    Save this script as /usr/local/sbin/wifialsa and then run
    Code:
    chmod +x /usr/local/sbin/wifialsa
    You can also add the line
    Code:
    /usr/local/sbin/wifialsa
    to the end of /etc/rc.local to run the script at boottime. When placed in rc.local the AAO boots normally and the modules are compiled in the background, so the wifi and sound modules get automagically repaired after a few minutes while you use the computer.
     
    antikristian, Sep 7, 2008
    #1
  2. antikristian

    Obsidian

    Joined:
    Aug 19, 2008
    Messages:
    7
    Likes Received:
    0
    Awesome, I wrote one too, but your script is better!
     
    Obsidian, Sep 8, 2008
    #2
  3. antikristian

    mabo

    Joined:
    Sep 2, 2008
    Messages:
    9
    Likes Received:
    0
    Thanks a lot for this! Will make this script myself after work.

    -Mabs
     
    mabo, Sep 8, 2008
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.