#!/bin/bash CWD=$(pwd) TMP=${TMP:-/tmp/sources} OUT=${OUT:-/tmp/packages} KVERSION=${KVERSION:-2.6.34.7} SUFFIX=libre1 ARCH=${ARCH:-x86} BUILD=${BUILD:-1} PKG=${TMP}/package-kernel-headers rm -rf $PKG mkdir -p $PKG $OUT set -e echo "Building kernel-headers-$KVERSION..." if [[ ! -d /usr/src/linux-${KVERSION} ]]; then if [[ -f ${CWD}/linux-${KVERSION}-$SUFFIX.tar.lz ]]; then mkdir -p /usr/src lzip -cd ${CWD}/linux-${KVERSION}-$SUFFIX.tar.lz | tar -xvf - -C /usr/src/ else echo "${CWD}/linux-${KVERSION}-$SUFFIX.tar.lz: No such file." exit 1; fi fi mkdir -p ${PKG}/usr ( cd /usr/src/linux-${KVERSION} make mrproper make headers_check make INSTALL_HDR_PATH=${PKG}/usr headers_install ) # Purge package: ( cd $PKG find . -type f \( -name '.install*' -o -name '..install.cmd' \) -delete -print ) mkdir -p ${PKG}/description cp ${CWD}/descriptions/headers/* ${PKG}/description/ cd $PKG makepkg -l ${OUT}/kernel-headers-${KVERSION}-${ARCH}-${BUILD}.tlz # Deletes temporary directories: if [[ $1 = -c || $1 = --clean ]]; then rm -rf $PKG fi