All pastes #1651428 Raw Edit

linux kernel updater

public shellscript v1 · immutable
#1651428 ·published 2009-11-01 11:57 UTC
rendered paste body
v-fox@dfx-laptop (15:00:55) [ ~ ] % cat /usr/local/sbin/update-kernel #!/bin/sh                                                             # Linux kernel functionlinux_kernel() {       OLD_KNAME=$(uname -r)  OLD_KPATH=linux-${OLD_KNAME/-*/}if [ -d $OLD_KPATH/patches ] || [ -f $OLD_KPATH/*.patch ]; then        echo "custom kernel"                                   else                                                                   echo "uncustomised"                                            VANILLA=1                                              fi                                                             if [ -L /usr/src/linux ]; then        file /usr/src/linux           cd /usr/src/linux       else                                echo "Kernel is not in place."        exit                          fi                                    # are we new here ?if [ -x *linux ]; then        echo "appearently kernel is present: exiting..."        exit                                             else                                                           echo "no builded kernel visible: configuring..."fi                                                      # are we patching maniac ?echo "Patches:"           if [ -z $VANILLA ]; then          echo "Not patching" else                              if [ -d $OLD_KPATH/patches ]; then                $PATCH_PATH=patches               elif [ -f $OLD_KPATH/*.patch ]; then                $PATCH_PATH=.                       fi                                          [ -d patches ] || mkdir patches        cp ../$OLD_KPATH/$PATCH_PATH/*.patch -t ./patches        for i in ./patches/*.patch;do                cat "$i"|patch -p1 || exit        done                              fi                                        # basic configuration[ -f .config ] && \          echo "Config exists: cleaning..." && \        make distclean                        # 3 ways to get decent config without sweatzcat /proc/config.gz > .config || \        cp /boot/config-$OLD_KNAME > .config || \cp ../$OLD_KPATH/.config ./# detailed configuration ?case "$1" in        help)                   echo "gui|X|qt for QT-based X configurator"                                echo "console|curses|menu for ncurses menu-based configurator"                                echo "else for default values in new settings";;        gui|X|qt)               QTDIR="/usr/qt/3" make xconfig || exit;;        console|curses|menu)    make menuconfig || exit;;        *)                      echo "Proceeding without manual configuration...";;esacmake || exitmake firmware_install modules_install install || exit}# kernel selectorcase "$(uname)" in         Linux  ) echo "Yeap ! Going further..."                  linux_kernel $1 ;;         *      ) echo "No :( Going down."                  exit ;;esac