#!/bin/sh # Set initial variables: CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PKG=$TMP/package-module-init-tools rm -rf $PKG mkdir -p $PKG VERSION=0.9.14 PKGVER=0.9.14 ARCH=i486 BUILD=2 # Build old modutils for 2.4.x. This will eventually go away... VMODUTILS=2.4.25 cd $TMP rm -rf modutils-$VMODUTILS tar xjvf $CWD/modutils-$VMODUTILS.tar.bz2 cd modutils-$VMODUTILS # insmod should use stderr for usage hints, not stdout: zcat $CWD/insmod-hint-use-stderr.diff.gz | patch -p1 --verbose --backup -E --suffix=.orig mkdir -p $PKG/usr/doc/modutils-$VMODUTILS cp -a COPYING CREDITS ChangeLog NEWS README TODO $PKG/usr/doc/modutils-$VMODUTILS cp -a depmod/create_syms $PKG/usr/doc/modutils-$VMODUTILS cp -a insmod/insmod_ksymoops_clean $PKG/usr/doc/modutils-$VMODUTILS # cp -a kerneld/README.* $PKG/usr/doc/modutils-$VMODUTILS chown -R root.root $PKG/usr/doc/modutils-$VMODUTILS CFLAGS="-O2 -march=i486 -mcpu=i686" \ ./configure \ --enable-zlib \ i486-slackware-linux make cd man mkdir -p $PKG/usr/man/man1 cat kernelversion.1 | gzip -9c > $PKG/usr/man/man1/kernelversion.1.gz mkdir -p $PKG/usr/man/man5 cat modules.conf.5 | gzip -9c > $PKG/usr/man/man5/modules.conf.5.gz mkdir -p $PKG/usr/man/man2 for manpage in *.2 ; do cat $manpage | gzip -9c > $PKG/usr/man/man2/$manpage.gz done mkdir -p $PKG/usr/man/man8 for manpage in `ls *.8 | grep -v kerneld` ; do cat $manpage | gzip -9c > $PKG/usr/man/man8/$manpage.gz done # Move some of these manpages to .old: mv $PKG/usr/man/man8/depmod.8.gz $PKG/usr/man/man8/depmod.old.8.gz mv $PKG/usr/man/man8/insmod.8.gz $PKG/usr/man/man8/insmod.old.8.gz mv $PKG/usr/man/man8/lsmod.8.gz $PKG/usr/man/man8/lsmod.old.8.gz mv $PKG/usr/man/man8/modinfo.8.gz $PKG/usr/man/man8/modinfo.old.8.gz mv $PKG/usr/man/man8/modprobe.8.gz $PKG/usr/man/man8/modprobe.old.8.gz mv $PKG/usr/man/man8/rmmod.8.gz $PKG/usr/man/man8/rmmod.old.8.gz cd .. mkdir -p $PKG/sbin cat depmod/depmod > $PKG/sbin/depmod.old cat genksyms/genksyms > $PKG/sbin/genksyms cat insmod/insmod > $PKG/sbin/insmod.old cat insmod/modinfo > $PKG/sbin/modinfo.old cat insmod/kernelversion > $PKG/sbin/kernelversion cat insmod/insmod_ksymoops_clean > $PKG/sbin/insmod_ksymoops_clean chown -R root.bin $PKG/sbin chmod 755 $PKG/sbin/* ( cd $PKG ( cd sbin ; rm -rf ksyms ) ( cd sbin ; ln -sf insmod.old ksyms ) ( cd sbin ; rm -rf lsmod.old ) ( cd sbin ; ln -sf insmod.old lsmod.old ) ( cd sbin ; rm -rf modprobe.old ) ( cd sbin ; ln -sf insmod.old modprobe.old ) ( cd sbin ; rm -rf rmmod.old ) ( cd sbin ; ln -sf insmod.old rmmod.old ) ( cd sbin ; rm -rf kallsyms ) ( cd sbin ; ln -sf insmod.old kallsyms ) ) # Build module-init-tools for 2.6.x+: cd $TMP rm -rf module-init-tools-$VERSION tar xjf $CWD/module-init-tools-$VERSION.tar.bz2 cd module-init-tools-$VERSION find . -perm 664 | xargs chmod 644 chown -R root.root . ./configure \ --prefix=/ \ --enable-zlib \ i486-slackware-linux make cat depmod > $PKG/sbin/depmod cat generate-modprobe.conf > $PKG/sbin/generate-modprobe.conf cat insmod > $PKG/sbin/insmod cat insmod.static > $PKG/sbin/insmod.static cat lsmod > $PKG/sbin/lsmod cat modinfo > $PKG/sbin/modinfo cat modprobe > $PKG/sbin/modprobe cat rmmod > $PKG/sbin/rmmod chmod 755 $PKG/sbin/* mkdir -p $PKG/bin ( cd $PKG/bin ; ln -sf /sbin/lsmod . ) ( cd $PKG/bin ; ln -sf /sbin/lsmod.old . ) chown -R root.bin $PKG/bin $PKG/sbin mkdir -p $PKG/usr/man/man5 for file in *.5 ; do cat $file | gzip -9c > $PKG/usr/man/man5/$file.gz done mkdir -p $PKG/usr/man/man8 for file in *.8 ; do cat $file | gzip -9c > $PKG/usr/man/man8/$file.gz done mkdir -p $PKG/usr/doc/module-init-tools-$VERSION cp -a \ AUTHORS COPYING ChangeLog FAQ INSTALL NEWS README TODO \ $PKG/usr/doc/module-init-tools-$VERSION # Strip things: ( cd $PKG find . | xargs file | grep "ELF 32-bit LSB executable" | grep 80386 | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "ELF 32-bit LSB shared object" | grep 80386 | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) mkdir -p $PKG/etc/cron.hourly zcat $CWD/kmod.gz > $PKG/etc/cron.hourly/kmod chmod 755 $PKG/etc/cron.hourly/kmod touch $PKG/etc/modules.conf.new touch $PKG/etc/modprobe.conf.new mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh # Build the package: cd $PKG makepkg -l y -c n $TMP/module-init-tools-$PKGVER-$ARCH-$BUILD.tgz # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/modutils-$VMODUTILS rm -rf $TMP/module-init-tools-$VERSION rm -rf $PKG fi