#!/bin/bash

# kernel-modules.SlackBuild by Stuart Winter <stuart@armedslack.org>
# Build a Kernel modules package for ARMedslack from a cross compiled
# kernel source (see source/k/riscpc/HOWTO)

VERSION=2.4.26
BUILD=1


S=/scratchbox/users/build/home/build/slackware-current/source/a/kernel-modules
A=/scratchbox/users/build/home/build/armedslack-current/source/a/kernel-modules
P=/scratchbox/users/build/home/build/armedslack-current/slackware/a

cd /tmp/package-kernel
rm -rf install # get rid of k/ bits
mkdir -p install etc/rc.d
install -m755 $S/rc.modules.new etc/rc.d
install -m644 $S/slack-desc install
install -m644 $A/doinst.sh install

# This is usually a symlink to where the kernel was compiled
# (/usr/src) but Slackware does not have this:
rm -f lib/modules/$VERSION*/build

# Get this stuff out of the way:
mkdir /tmp/$$foo
mv boot /tmp/$$foo

chown -R root:root .
rm -f $P/kernel-modules-*
makepkg -l y -c n $P/kernel-modules-$VERSION-arm-$BUILD.tgz 

# Put it back again:
mv /tmp/$$foo/boot .

