#vim: set syn=sh: #Maintainer: JRD pkgname=fake-uname pkgver=0.1 pkgrel=1cp arch=noarch sourcetemplate=http://enialis.net/~jrd/salix/$pkgname/$pkgver-$pkrel/ docs=("readme" "install" "copying" "changelog" "authors" "news" "todo") options=('noextract' 'nostrip') slackdesc=\ ( #|-----handy-ruler------------------------------------------------------| "$pkgname (hack to fake the kernel version)" "This could be usefull to build a driver or anything relative to the" "kernel, where the currently running kernel is not of the same version" "you build the driver to." "Of course the kernel headers (or sources) for the fakly kernel should" "be present in order for this to work." "Just run 'fake-uname-activate kernel_ver' to use it." ) build() { cd $startdir/pkg mkdir sbin cd sbin cat <<'EOF' > fake-uname #!/bin/sh export FAKEVER=2.6.31 if [ "$1" = "-r" ]; then echo $FAKEVER elif [ "$1" = "-a" ]; then /bin/uname -a | sed "s/2\.6[0-9.]*\(-[^ ]*\)\?/$FAKEVER/" else /bin/uname $1 fi EOF cat <<'EOF' > fake-uname-activate #!/bin/sh if [ "$1" = "" ]; then echo 'fake-uname-activate FAKE_KERNEL_VERSION' exit 1 else FAKEVER=$1 if [ ! -h /sbin/uname ]; then sed -i -e "s/\(export FAKEVER=\).*/\1$FAKEVER/" /sbin/fake-uname (cd /sbin && ln -s fake-uname uname) echo 'please relaunch this shell to take effect' else echo 'fake-uname already active' exit 1 fi fi EOF cat <<'EOF' > fake-uname-disactivate #!/bin/sh if [ -h /sbin/uname ]; then rm -f /sbin/uname echo 'please relaunch this shell to take effect' else echo 'fake-uname not active' exit 1 fi EOF chmod u+x fake-uname fake-uname-activate fake-uname-disactivate }