Find the answer to your Linux question:
Results 1 to 2 of 2
Hey Peeps, Im new here to the world of linux and bash scripts in general, Now iv made a script to install device drivers not currently supported by ubuntu feisty ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    1

    Need help tiyding up my script(Bad Spelling i know)

    Hey Peeps, Im new here to the world of linux and bash scripts in general,
    Now iv made a script to install device drivers not currently supported by ubuntu feisty and i need some help in making my script tidy and perhaps sum helpfull tips on how to make it better. If you do have n e tips, could you explain to me what they do. Heres is the script, And thanx again

    #!/bin/bash
    {
    clear
    cd $HOME/tmp
    echo -n "Downloading and Installing Support Files"
    echo ""
    sleep 3
    wget -q http://piratesoft.co.uk/ubuntuplus/oem/scripts/tux.ans
    apt-get -qq install -y --force-yes ncftp
    wget -q http://piratesoft.co.uk/ubuntuplus/o...rams/sendEmail
    wget -q http://piratesoft.co.uk/ubuntuplus/oem/programs/1
    wget -q http://piratesoft.co.uk/ubuntuplus/oem/programs/2
    sudo chmod 777 sendEmail 1 2
    lspci > pci
    lsusb > usb
    users > users
    printf "Port 25 Used USER = " > 25
    printf "AOL Detected Using Port 587 USER = " > 587
    clear
    echo -n "Installation Complete, Loading Main Menu"
    sleep 3
    }

    function rm_support_files
    {
    echo -n "Removing Support Files"
    rm -r $HOME/tmp
    apt-get -qq autoremove -y
    clear
    exit
    }

    function press_enter
    {
    echo ""
    echo -n "Press Enter To Continue"
    read
    clear
    }
    function lexmark
    {
    echo "Prepairing drivers and installing. Please wait..."
    wget -q http://piratesoft.co.uk/ubuntuplus/o...s-2.0-1.tar.gz
    tar -xvzf lexz25z35-cups-2.0-1.tar.gz
    tail -n +143 lexmarkz35-CUPS-2.0-1.gz.sh > install.tar.gz
    tar -xvzf install.tar.gz
    alien -t lexmarkz35-CUPS-2.0-1.i386.rpm
    alien -t z35llpddk-2.0-2.i386.rpm
    tar xvzf lexmarkz35-CUPS-2.0.tgz -C /
    tar xvzf z35llpddk-2.0.tgz -C /
    ldconfig
    cd /usr/share/cups/model
    gunzip Lexmark-Z35-lxz35cj-cups.ppd.gz
    /etc/rc2.d/S19cupsys restart
    cd $HOME/tmp
    clear
    echo "Done! Now set up your printer using your"
    echo "favorite printer setup program."; press_enter
    }
    function sendftp
    {
    if
    cat 25 users 1 pci 2 usb | ./sendEmail -f customer@home.com -xu my@emailaddress.co.uk -xp my password -t destination@email.co.uk -s mail@server:25 -u "PCI and USB List"
    then
    clear
    echo "File Sent Suceesfully"
    echo ""; press_enter
    else
    cat 587 users 1 pci 2 usb | ./sendEmail -f customer@home.com -xu my@emailaddress.co.uk -xp my password -t destination@email.co.uk -s mail@server:587 -u "PCI and USB List"
    clear
    echo "File Sent Suceesfully"
    echo ""; press_enter
    fi
    }
    function install
    {
    #Network Cards
    if lsusb | grep -q "1385:4251";
    then
    clear
    echo "Installing Netgear USB Driver"
    sleep 4
    netgear > installed
    cd /usr/oemfiles/
    sudo tar xvf netgear1.tar.gz
    sudo ndiswrapper -i netwg11t.inf
    sudo depmod -a
    sudo modprobe ndiswrapper
    cd $HOME/tmp
    else
    echo "";
    fi

    if lspci | grep -q "Atheros Communications, Inc. Unknown device 001c";
    then
    clear
    echo "Installing Atheros Communications Driver"
    sleep 4
    cd /usr/oemfiles/
    sudo wget http://piratesoft.co.uk/ubuntuplus/o...ireless.tar.gz
    sudo tar xvf wireless.tar.gz
    sudo cp blacklist /etc/modprobe.d/
    sudo cp *.conf /opt/wicd/data/
    sudo cp modules /etc/
    sudo ndiswrapper -i net5211.inf
    sudo depmod -a
    sudo modprobe ndiswrapper
    cd $HOME/tmp
    else
    echo "";
    fi

    #Videos Cards
    if lspci | grep -q "945GM/GMS/940GML";
    then
    clear
    echo "Installing 945GM/GMS/940GML Display Drivers"
    sleep 4
    sudo apt-get -y install 915resolution
    else
    echo
    fi

    if lspci | grep -q "nVidia Corporation C51 PCI Express Bridge";
    then
    clear
    echo "Installing Nvidia C51 PCI Express Bridge Driver"
    sleep 4
    sudo wget http://piratesoft.co.uk/ubuntuplus/oem/driver/nv.run
    sudo sh nv.run --no-x-check -X -a --no-questions --silent
    sudo rm nv.run
    else
    echo "";
    fi

    if lspci | grep -q "VGA compatible controller: nVidia Corporation Unknown device";
    then
    clear
    echo "Installing Nvidia 8xxxGT,GS,GTX Display Driver"
    sleep 4
    sudo wget http://piratesoft.co.uk/ubuntuplus/oem/driver/nv.run
    sudo apt-get remove --purge -y build-essential gcc module-assistant nvidia-kernel-common
    sudo apt-get install -y module-assistant
    sudo apt-get install -y gcc
    sudo apt-get install -y nvidia-kernel-common
    sudo m-a update
    sudo m-a prepare
    m-a auto-install nvidia
    sudo sh nv.run --no-x-check -X -a --no-questions --silent
    sudo rm nv.run
    else
    echo "";
    fi

    #Modems
    if lsusb | grep -q "06b9:4061";
    then
    clear
    echo "Installing BT SpeedTouch330 USB Modem Driver"
    sleep 4
    cd /usr/oemfiles/
    sudo tar xvf speedtch330.tar.gz
    cd speedtch330
    sudo sh speed330.sh
    cd $HOME/tmp
    else
    clear
    echo "";
    fi

    if lsusb | grep -q "1385:4251";
    then
    echo "Netgear USB Driver Installed Suceesfully"
    sleep 3
    fi

    if lspci | grep -q "Atheros Communications, Inc. Unknown device 001c";
    then
    echo "Atheros Communications Driver Installed suceesfully"
    sleep 3
    fi

    if lspci | grep -q "945GM/GMS/940GML";
    then
    echo "945GM/GMS/940GML Display Drivers Installed Suceesfully"
    sleep 3
    fi

    if lspci | grep -q "nVidia Corporation C51 PCI Express Bridge";
    then
    echo "Nvidia C51 PCI Express Bridge Drivers Installed Suceesfully"
    sleep 3
    fi

    if lspci | grep -q "VGA compatible controller: nVidia Corporation Unknown device";
    then
    echo "Nvidia 8xxxGT,GS,GTX Display Driver Install Suceesfully"
    sleep 3
    fi

    if lsusb | grep -q "06b9:4061";
    then
    echo "BT SpeedTouch330 USB Modem Driver Installed Suceesfully"
    sleep 3
    fi
    echo ""; press_enter
    }

    selection=
    until [ "$selection" = "q" ]; do
    clear
    cat tux.ans #Displays a menu in the form of a text file
    echo -n "Enter Selection:- "
    read selection
    echo ""
    case $selection in
    1 ) clear ; install ;;
    2 ) clear ; sendftp ;;
    3 ) clear ; lexmark ;;
    q ) rm_support_files ;;
    * ) echo "Please enter 1, 2, 3, or q to quit"; press_enter
    esac
    done

  2. #2
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    No one's going to read that whole thing, especially because it's not in CODE tags, which express indentation and whatnot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...