#!/bin/bash ## src2pkg script for: kernel-modules ## Auto-generated by src2pkg-1.9.6 ## src2pkg Copyright 2005-2008 Gilbert Ashley # MNAME for standard kernel-modules is simply 'modules # MNAME gets appended to the name of the package (like 'kernel-$MNAME ') # in order to avoid that installpkg or upgradepkg overwrite your existing kernel(s), # you should give this kernel-modules build a unique MNAME like 'my_modules' MNAME='modules-mine' # edit to change this to the correct kernel version SOURCE_NAME='linux-2.6.23.tar.bz2' BUILD='1' # make sure you have a slack-desc file in the current directory, with the # proper name for the package on each line like this: # kernel-$MNAME : # otherwise a default one will be created for the package # you shouldn't need to change anything below ALT_NAME and ALT_VERSION # reset the default package name(which would be 'linux' in this case) ALT_NAME="kernel-$MNAME" # reset the default VERSION (needed if using kernel version patches) # ALT_VERSION=2.6.23.6 # Get the functions and configs . /usr/libexec/src2pkg/FUNCTIONS ; # do_all_processes can substitute these 16 steps: pre_process find_source make_dirs unpack_source fix_source_perms #configure_source #compile_source #fake_install if [[ -r $CWD/config-$MNAME-$VERSION ]] ; then cp $CWD/config-$MNAME-$VERSION $SRC_DIR/.config elif [[ -r $CWD/config-$MNAME ]] ; then cp $CWD/config-$MNAME $SRC_DIR/.config elif [[ -r $CWD/config ]] ; then cp $CWD/config $SRC_DIR/.config elif [[ -r $CWD/config* ]] ; then cp $CWD/config* $SRC_DIR/.config else echo "" echo $RED"Error!"$NORMAL" No kernel configuration file found!" echo "To build the kernel-modules, place a copy of your" echo "kernel-modules configuration file in the current directory" echo "and name it config-$MNAME-$VERSION, config-$MNAME or 'config'." echo "Exiting..." exit 0 fi cd $SRC_DIR && make oldconfig && make modules STATUS=$? # this method has the advantage of not needing to be root to # install the modules and to create the *.map files if [[ $STATUS = 0 ]] ; then mkdir -p $PKG_DIR/lib/modules/$VERSION cd $SRC_DIR export INSTALL_MOD_PATH=$PKG_DIR make _modinst_ if [[ -x /sbin/depmod ]] ; then /sbin/depmod -b $PKG_DIR $VERSION fi else echo "Kernel-modules failed to compile cleanly! Exiting..." exit 0 fi # Remove erroneous links(build & source) in /lib/modules rm -f $PKG_DIR/lib/modules/$VERSION/source $PKG_DIR/lib/modules/$VERSION/build mkdir -p $PKG_DIR/install if ! [[ -e $CWD/slack-desc ]] ; then cat > $PKG_DIR/install/slack-desc < $PKG_DIR/etc/rc.d/rc.modules-${VERSION}.new chmod 755 $PKG_DIR/etc/rc.d/rc.modules-${VERSION}.new # Write out the doinst.sh: cat << EOF > $CWD/doinst.prepend config() { NEW="\$1" OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)" # If there's no config file by that name, mv it over: if [ ! -r \$OLD ]; then mv \$NEW \$OLD elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy rm \$NEW fi # Otherwise, we leave the .new copy for the admin to consider... } config etc/rc.d/rc.modules-${VERSION}.new # If rc.modules is a real file, back it up: if [ -r etc/rc.d/rc.modules -a ! -L etc/rc.d/rc.modules ]; then cp -a etc/rc.d/rc.modules etc/rc.d/rc.modules.bak fi # A good idea whenever kernel modules are added or changed: if [ -x sbin/depmod ]; then chroot . /sbin/depmod -a ${VERSION} 1> /dev/null 2> /dev/null fi EOF # end code by PatV fix_pkg_perms strip_bins create_docs compress_man_pages make_description make_doinst make_package post_process # src2pkg - Copyright 2005-2008 Gilbert Ashley ## See the documentation for more help and examples. Below are some of # the most common Extras and Options for easy cut-and-paste use. # EXTRA_CONFIGS='' PRE_FIX='' DOCLIST='' # MAKE_COMMAND='' INSTALL_LINE='' # SHELL_INSTALL='YES' CORRECT_PERMS='NO' # When editing src2pkg scripts to add custom code, use these variables # to refer to the current directory, the sources or the package tree: # $CWD (current directory), $SRC_DIR (sources), $PKG_DIR (package tree)