#!/bin/bash # # virtualbox-guest-modules.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # virtualbox-guest-modules.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # Copyright 2008-2010 Heinz Wiesinger, Amsterdam, The Netherlands # Copyright 2008 Mauro Giachero # default settings PACKAGE="virtualbox-guest-modules" PACKAGE_EXT="gz" VERSION=${VERSION:=5.0.40} BUILD=${BUILD:=1} KERNEL=${KERNEL:-$(uname -r)} KERNELPATH=${KERNELPATH:-/lib/modules/$KERNEL/build} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi PVERSION=${PVERSION}_$(echo ${KERNEL} | tr '-' '_') SRC=../virtualbox-guest-utils/virtualbox-kernel-${VERSION}.tar.gz if [ ! -f $SRC ]; then echo "Build the virtualbox-guest-utils package first, that will also create" echo "the source for this package." exit 1 fi unpack_source $SRC src # Create directories mkdir -p $PKG/lib/udev/rules.d $PKG/etc/rc.d/{init.d,rc{0,1,3,4,6}.d} # SysV init install -m 755 $CWD/virtualbox.init $PKG/etc/rc.d/init.d/virtualbox cd $PKG/etc/rc.d/rc0.d ln -s ../init.d/virtualbox K95virtualbox cd $PKG/etc/rc.d/rc1.d ln -s ../init.d/virtualbox K95virtualbox cd $PKG/etc/rc.d/rc3.d ln -s ../init.d/virtualbox S05virtualbox cd $PKG/etc/rc.d/rc4.d ln -s ../init.d/virtualbox S05virtualbox cd $PKG/etc/rc.d/rc6.d ln -s ../init.d/virtualbox K95virtualbox cd $TMP/src # Udev rules echo "KERNEL==\"vboxguest\", NAME=\"vboxguest\", OWNER=\"vboxguest\", MODE=\"0660\"" > $PKG/lib/udev/rules.d/60-vboxadd.rules echo "KERNEL==\"vboxuser\", NAME=\"vboxuser\", OWNER=\"vboxguest\", MODE=\"0666\"" >> $PKG/lib/udev/rules.d/60-vboxadd.rules # Build kernel modules mkdir -p $PKG/lib/modules/$KERNEL/misc for i in vboxguest vboxsf vboxvideo; do cd $i-${VERSION} make KERN_DIR=$KERNELPATH || exit 3 install -m 0644 $i.ko $PKG/lib/modules/$KERNEL/misc/ cd - done mkdir -p $PKG/install cat << EOF > $PKG/install/doinst.sh if ! grep ^vboxguest: /etc/group 2>&1 > /dev/null; then groupadd -g 215 vboxguest fi if ! grep ^vboxguest: /etc/passwd 2>&1 > /dev/null; then useradd -u 215 -d /var/run/vboxguest -g 215 -s /bin/sh vboxguest fi chroot . /sbin/depmod -a $KERNEL EOF mkdir -p $DOCS cat $CWD/README.Slackware > $DOCS/README.Slackware fixup_package $PKG # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi