CWD=$(pwd) TMP=${TMP:-/tmp/sources} OUT=${OUT:-/tmp/packages} KVERSION=${KVERSION:-2.6.34.7} EXTRA_VER=${EXTRA_VER:=-smp} ARCH=${ARCH:-i686} BUILD=${BUILD:-1} RC_MODULES=rc.modules-${KVERSION}$EXTRA_VER PKG=${TMP}/package-kernel-modules rm -rf $PKG mkdir -p $PKG $OUT set -e echo "Building kernel-modules-${KVERSION}$EXTRA_VER..." mkdir -p ${PKG}/lib/modules cp -a \ /lib/modules/${KVERSION}$EXTRA_VER \ ${PKG}/lib/modules mkdir -p ${PKG}/etc/rc.d ( cd ${PKG}/etc/rc.d zcat ${CWD}/${RC_MODULES}.gz > $RC_MODULES chown 0:0 $RC_MODULES chmod 755 $RC_MODULES ln -s $RC_MODULES rc.modules ) mkdir -p ${PKG}/sbin cat ${CWD}/modtool > ${PKG}/sbin/modtool chown 0:0 $PKG/sbin/modtool chmod 750 $PKG/sbin/modtool mkdir -p ${PKG}/description cp ${CWD}/descriptions/modules-smp/* ${PKG}/description/ mkdir -p ${PKG}/install cat << EOF > ${PKG}/install/post-install # Update modules: if [ -x sbin/depmod ]; then chroot . /sbin/depmod -a ${KVERSION}$EXTRA_VER 1> /dev/null 2>&1 fi EOF cd $PKG makepkg -l \ ${OUT}/kernel-modules-${KVERSION}$(echo $EXTRA_VER | tr - _)-$ARCH-$BUILD.tlz # Delete temporary directories: if [[ $1 = -c || $1 = --clean ]]; then rm -rf $PKG fi