summaryrefslogtreecommitdiffstats
path: root/system/virtualbox-addons/rc.vboxadd.diff
diff options
context:
space:
mode:
Diffstat (limited to 'system/virtualbox-addons/rc.vboxadd.diff')
-rw-r--r--system/virtualbox-addons/rc.vboxadd.diff303
1 files changed, 136 insertions, 167 deletions
diff --git a/system/virtualbox-addons/rc.vboxadd.diff b/system/virtualbox-addons/rc.vboxadd.diff
index f0b3acddd0..bb5fdde0fe 100644
--- a/system/virtualbox-addons/rc.vboxadd.diff
+++ b/system/virtualbox-addons/rc.vboxadd.diff
@@ -1,6 +1,7 @@
---- vboxadd.sh.orig 2016-11-23 16:24:46.000000000 +0100
-+++ vboxadd.sh 2016-12-27 16:06:46.413895799 +0100
-@@ -154,42 +154,9 @@
+diff -ur VirtualBox-5.2.4.orig/src/VBox/Additions/linux/installer/vboxadd.sh VirtualBox-5.2.4/src/VBox/Additions/linux/installer/vboxadd.sh
+--- VirtualBox-5.2.4.orig/src/VBox/Additions/linux/installer/vboxadd.sh 2017-12-19 10:22:03.000000000 +0100
++++ VirtualBox-5.2.4/src/VBox/Additions/linux/installer/vboxadd.sh 2018-01-07 17:23:23.225998245 +0100
+@@ -130,18 +130,9 @@
dev=/dev/vboxguest
userdev=/dev/vboxuser
@@ -8,165 +9,127 @@
owner=vboxadd
group=1
--test_for_gcc_and_make()
--{
-- which make > /dev/null 2>&1 || printf "\nThe make utility was not found. If the following module compilation fails then\nthis could be the reason and you should try installing it.\n"
-- which gcc > /dev/null 2>&1 || printf "\nThe gcc utility was not found. If the following module compilation fails then\nthis could be the reason and you should try installing it.\n"
--}
--
--test_sane_kernel_dir()
--{
-- KERN_VER=`uname -r`
-- KERN_DIR="/lib/modules/$KERN_VER/build"
-- if [ -d "$KERN_DIR" ]; then
-- KERN_REL=`make -sC $KERN_DIR --no-print-directory kernelrelease 2>/dev/null || true`
-- if [ -z "$KERN_REL" -o "x$KERN_REL" = "x$KERN_VER" ]; then
-- return 0
-- fi
-- fi
-- printf "\nThe headers for the current running kernel were not found. If the following\nmodule compilation fails then this could be the reason.\n"
-- if [ "$system" = "redhat" ]; then
-- if echo "$KERN_VER" | grep -q "uek"; then
-- printf "The missing package can be probably installed with\nyum install kernel-uek-devel-$KERN_VER\n"
-- else
-- printf "The missing package can be probably installed with\nyum install kernel-devel-$KERN_VER\n"
-- fi
-- elif [ "$system" = "suse" ]; then
-- KERN_VER_SUSE=`echo "$KERN_VER" | sed 's/.*-\([^-]*\)/\1/g'`
-- KERN_VER_BASE=`echo "$KERN_VER" | sed 's/\(.*\)-[^-]*/\1/g'`
-- printf "The missing package can be probably installed with\nzypper install kernel-$KERN_VER_SUSE-devel-$KERN_VER_BASE\n"
-- elif [ "$system" = "debian" ]; then
-- printf "The missing package can be probably installed with\napt-get install linux-headers-$KERN_VER\n"
-- fi
--}
+-if test -r $config; then
+- . $config
+-else
+- fail "Configuration file $config not found"
+-fi
+-test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" ||
+- fail "Configuration file $config not complete"
-
running_vboxguest()
{
lsmod | grep -q "vboxguest[^_-]"
-@@ -261,13 +228,6 @@
- start()
- {
- begin "Starting the VirtualBox Guest Additions ";
-- if test -r $config; then
-- . $config
-- else
-- fail "Configuration file $config not found"
+@@ -252,28 +243,6 @@
+ }
+ fi # INSTALL_NO_MODULE_BUILDS
+
+- # Put the X.Org driver in place. This is harmless if it is not needed.
+- "${INSTALL_DIR}/init/vboxadd-x11" setup 2>> "${LOG}"
+- # Install the guest OpenGL drivers. For now we don't support
+- # multi-architecture installations
+- rm -f /etc/ld.so.conf.d/00vboxvideo.conf
+- rm -Rf /var/lib/VBoxGuestAdditions/lib
+- if /usr/bin/VBoxClient --check3d 2>/dev/null; then
+- mkdir -p /var/lib/VBoxGuestAdditions/lib
+- ln -sf "${INSTALL_DIR}/lib/VBoxOGL.so" /var/lib/VBoxGuestAdditions/lib/libGL.so.1
+- # SELinux for the OpenGL libraries, so that gdm can load them during the
+- # acceleration support check. This prevents an "Oh no, something has gone
+- # wrong!" error when starting EL7 guests.
+- if test -e /etc/selinux/config; then
+- if command -v semanage > /dev/null; then
+- semanage fcontext -a -t lib_t "/var/lib/VBoxGuestAdditions/lib/libGL.so.1"
+- fi
+- chcon -h -t lib_t "/var/lib/VBoxGuestAdditions/lib/libGL.so.1"
+- fi
+- echo "/var/lib/VBoxGuestAdditions/lib" > /etc/ld.so.conf.d/00vboxvideo.conf
- fi
-- test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" ||
-- fail "Configuration file $config not complete"
- uname -r | grep -q -E '^2\.6|^3|^4' 2>/dev/null &&
- ps -A -o comm | grep -q '/*udevd$' 2>/dev/null ||
- no_udev=1
-@@ -378,218 +338,16 @@
+- ldconfig
+-
+ # Mount all shared folders from /etc/fstab. Normally this is done by some
+ # other startup script but this requires the vboxdrv kernel module loaded.
+ # This isn't necessary anymore as the vboxsf module is autoloaded.
+@@ -303,195 +272,16 @@
return 0
}
--## Update the initramfs. Debian and Ubuntu put the graphics driver in, and
--# need the touch(1) command below. Everyone else that I checked just need
--# the right module alias file from depmod(1) and only use the initramfs to
--# load the root filesystem, not the boot splash. update-initramfs works
--# for the first two and dracut for every one else I checked. We are only
--# interested in distributions recent enough to use the KMS vboxvideo driver.
--## @param $1 kernel version to update for.
--update_module_dependencies()
--{
-- depmod "${1}"
-- rm -f "/lib/modules/${1}/initrd/vboxvideo"
-- test -d "/lib/modules/${1}/initrd" &&
-- test -f "/lib/modules/${1}/misc/vboxvideo.ko" &&
-- touch "/lib/modules/${1}/initrd/vboxvideo"
-- test -n "${QUICKSETUP}" && return
-- if type dracut >/dev/null 2>&1; then
-- dracut -f "/boot/initramfs-${1}.img" "${1}"
-- elif type update-initramfs >/dev/null 2>&1; then
-- update-initramfs -u -k "${1}"
-- fi
--}
--
-# Remove any existing VirtualBox guest kernel modules from the disk, but not
-# from the kernel as they may still be in use
-cleanup_modules()
-{
-- if [ -n "$(which dkms 2>/dev/null)" ]; then
-- begin "Removing existing VirtualBox DKMS kernel modules"
-- $DODKMS uninstall $OLDMODULES > $LOG
-- succ_msg
-- fi
-- begin "Removing existing VirtualBox non-DKMS kernel modules"
-- for i in $OLDMODULES; do
-- find /lib/modules -name $i\* | xargs rm 2>/dev/null
+- log "Removing existing VirtualBox kernel modules."
+- for i in ${OLDMODULES}; do
+- # We no longer support DKMS, remove any leftovers.
+- rm -rf "/var/lib/dkms/${i}"*
+- # And remove old modules.
+- rm -f /lib/modules/*/misc/"${i}"*
- done
-- succ_msg
+- # Remove leftover module folders.
+- for i in /lib/modules/*/misc; do
+- test -d "${i}" && rmdir -p "${i}" 2>/dev/null
+- done
+- rm -f /etc/depmod.d/vboxvideo-upstream.conf
-}
-
-# Build and install the VirtualBox guest kernel modules
-setup_modules()
-{
- # don't stop the old modules here -- they might be in use
-- cleanup_modules
-- begin "Building the VirtualBox Guest Additions kernel modules"
--
-- # Short cut out if a dkms build succeeds
-- if [ -n "$(which dkms 2>/dev/null)" ] &&
-- $DODKMS install vboxguest $INSTALL_VER >> $LOG 2>&1; then
-- succ_msg
-- return 0
-- fi
--
-- test_for_gcc_and_make
-- test_sane_kernel_dir
+- test -z "${QUICKSETUP}" && cleanup_modules
+- # This does not work for 2.4 series kernels. How sad.
+- test -n "${QUICKSETUP}" && test -f "${MODULE_DIR}/vboxguest.ko" && return 0
+- info "Building the VirtualBox Guest Additions kernel modules."
-
-- echo
-- begin "Building the main Guest Additions module"
+- # We are allowed to do ">> $LOG" after we have called "log()" once.
+- log "Building the main Guest Additions module."
- if ! $BUILDINTMP \
- --save-module-symvers /tmp/vboxguest-Module.symvers \
- --module-source $MODULE_SRC/vboxguest \
- --no-print-directory install >> $LOG 2>&1; then
-- show_error "Look at $LOG to find out what went wrong"
-- return 1
+- # If check_module_dependencies.sh fails it prints a message itself.
+- "${INSTALL_DIR}"/other/check_module_dependencies.sh 2>&1 &&
+- info "Look at $LOG to find out what went wrong"
+- return 0
- fi
-- succ_msg
-- begin "Building the shared folder support module"
+- log "Building the shared folder support module"
- if ! $BUILDINTMP \
- --use-module-symvers /tmp/vboxguest-Module.symvers \
- --module-source $MODULE_SRC/vboxsf \
- --no-print-directory install >> $LOG 2>&1; then
-- show_error "Look at $LOG to find out what went wrong"
-- return 1
+- info "Look at $LOG to find out what went wrong"
+- return 0
- fi
-- succ_msg
-- begin "Building the graphics driver module"
+- log "Building the graphics driver module"
- if ! $BUILDINTMP \
- --use-module-symvers /tmp/vboxguest-Module.symvers \
- --module-source $MODULE_SRC/vboxvideo \
- --no-print-directory install >> $LOG 2>&1; then
-- show_error "Look at $LOG to find out what went wrong"
+- info "Look at $LOG to find out what went wrong"
- fi
-- succ_msg
-- update_module_dependencies "${KERN_VER}"
+- [ -d /etc/depmod.d ] || mkdir /etc/depmod.d
+- echo "override vboxguest * misc" > /etc/depmod.d/vboxvideo-upstream.conf
+- echo "override vboxsf * misc" >> /etc/depmod.d/vboxvideo-upstream.conf
+- echo "override vboxvideo * misc" >> /etc/depmod.d/vboxvideo-upstream.conf
+- depmod
- return 0
-}
-
--# Do non-kernel bits needed for the kernel modules to work properly (user
--# creation, udev, mount helper...)
--extra_setup()
+-create_vbox_user()
-{
-- begin "Doing non-kernel setup of the Guest Additions"
-- echo "Creating user for the Guest Additions." >> $LOG
+- log "Creating user for the Guest Additions."
- # This is the LSB version of useradd and should work on recent
- # distributions
- useradd -d /var/run/vboxadd -g 1 -r -s /bin/false vboxadd >/dev/null 2>&1
- # And for the others, we choose a UID ourselves
- useradd -d /var/run/vboxadd -g 1 -u 501 -o -s /bin/false vboxadd >/dev/null 2>&1
-
-- # Add a group "vboxsf" for Shared Folders access
-- # All users which want to access the auto-mounted Shared Folders have to
-- # be added to this group.
-- groupadd -r -f vboxsf >/dev/null 2>&1
+-}
-
+-create_udev_rule()
+-{
- # Create udev description file
- if [ -d /etc/udev/rules.d ]; then
-- echo "Creating udev rule for the Guest Additions kernel module." >> $LOG
+- log "Creating udev rule for the Guest Additions kernel module."
- udev_call=""
- udev_app=`which udevadm 2> /dev/null`
- if [ $? -eq 0 ]; then
@@ -189,91 +152,97 @@
- echo "KERNEL=${udev_fix}\"vboxguest\", NAME=\"vboxguest\", OWNER=\"vboxadd\", MODE=\"0660\"" > /etc/udev/rules.d/60-vboxadd.rules
- echo "KERNEL=${udev_fix}\"vboxuser\", NAME=\"vboxuser\", OWNER=\"vboxadd\", MODE=\"0666\"" >> /etc/udev/rules.d/60-vboxadd.rules
- fi
+-}
+-
+-create_module_rebuild_script()
+-{
+- # And a post-installation script for rebuilding modules when a new kernel
+- # is installed.
+- mkdir -p /etc/kernel/postinst.d /etc/kernel/prerm.d
+- cat << EOF > /etc/kernel/postinst.d/vboxadd
+-#!/bin/sh
+-test -d "/lib/modules/\${1}/build" || exit 0
+-KERN_VER="\${1}" /sbin/rcvboxadd quicksetup
+-exit 0
+-EOF
+- cat << EOF > /etc/kernel/prerm.d/vboxadd
+-#!/bin/sh
+-for i in ${OLDMODULES}; do rm -f /lib/modules/"\${1}"/misc/"\${i}".ko; done
+-rmdir -p /lib/modules/"\$1"/misc 2>/dev/null
+-exit 0
+-EOF
+- chmod 0755 /etc/kernel/postinst.d/vboxadd /etc/kernel/prerm.d/vboxadd
+-}
+-
+-shared_folder_setup()
+-{
+- # Add a group "vboxsf" for Shared Folders access
+- # All users which want to access the auto-mounted Shared Folders have to
+- # be added to this group.
+- groupadd -r -f vboxsf >/dev/null 2>&1
-
-- # Put mount.vboxsf in the right place
-- ln -sf "$lib_path/$PACKAGE/mount.vboxsf" /sbin
-- # And an rc file to re-build the kernel modules and re-set-up the X server.
-- ln -sf "$lib_path/$PACKAGE/vboxadd" /sbin/rcvboxadd
-- ln -sf "$lib_path/$PACKAGE/vboxadd-x11" /sbin/rcvboxadd-x11
+- # Put the mount.vboxsf mount helper in the right place.
+- ## @todo It would be nicer if the kernel module just parsed parameters
+- # itself instead of needing a separate binary to do that.
+- ln -sf "${INSTALL_DIR}/other/mount.vboxsf" /sbin
- # SELinux security context for the mount helper.
- if test -e /etc/selinux/config; then
- # This is correct. semanage maps this to the real path, and it aborts
- # with an error, telling you what you should have typed, if you specify
-- # the real path. The "chcon" is there as a back-up in case this is
-- # different on old guests.
-- semanage fcontext -a -t mount_exec_t "/usr/lib/$PACKAGE/mount.vboxsf"
-- chcon -t mount_exec_t "$lib_path/$PACKAGE/mount.vboxsf"
+- # the real path. The "chcon" is there as a back-up for old guests.
+- command -v semanage > /dev/null &&
+- semanage fcontext -a -t mount_exec_t "${INSTALL_DIR}/other/mount.vboxsf"
+- chcon -t mount_exec_t "${INSTALL_DIR}/other/mount.vboxsf"
- fi
-- succ_msg
-}
-
# setup_script
setup()
{
-- if test -r $config; then
-- . $config
-- else
-- fail "Configuration file $config not found"
-- fi
-- test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" ||
-- fail "Configuration file $config not complete"
- export BUILD_TYPE
- export USERNAME
-
-- rm -f $LOG
- MODULE_SRC="$INSTALL_DIR/src/vboxguest-$INSTALL_VER"
- BUILDINTMP="$MODULE_SRC/build_in_tmp"
-- DODKMS="$MODULE_SRC/do_dkms"
- chcon -t bin_t "$BUILDINTMP" > /dev/null 2>&1
-- chcon -t bin_t "$DODKMS" > /dev/null 2>&1
-
-- setup_modules
-- mod_succ="$?"
-- extra_setup
-- if [ "$mod_succ" -eq "0" ]; then
-- if running_vboxguest || running_vboxadd; then
-- printf "You should restart your guest to make sure the new modules are actually used\n\n"
-- else
-- start
-- fi
+- test -z "${INSTALL_NO_MODULE_BUILDS}" && setup_modules
+- create_vbox_user
+- create_udev_rule
+- test -z "${INSTALL_NO_MODULE_BUILDS}" && create_module_rebuild_script
+- test -n "${QUICKSETUP}" && return 0
+- shared_folder_setup
+- if running_vboxguest || running_vboxadd; then
+- info "Running kernel modules will not be replaced until the system is restarted"
- fi
+- return 0
+ echo "Not implemented! Please use the virtualbox-kernel-addons.SlackBuild available at SlackBuilds.org instead."
}
# cleanup_script
cleanup()
{
-- if test -r $config; then
-- . $config
-- test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" ||
-- fail "Configuration file $config not complete"
-- DODKMS="$INSTALL_DIR/src/vboxguest-$INSTALL_VER/do_dkms"
-- elif test -x ./do_dkms; then # Executing as part of the installer...
-- DODKMS=./do_dkms
-- else
-- fail "Configuration file $config not found"
+- if test -z "${INSTALL_NO_MODULE_BUILDS}"; then
+- # Delete old versions of VBox modules.
+- cleanup_modules
+- depmod
+-
+- # Remove old module sources
+- for i in $OLDMODULES; do
+- rm -rf /usr/src/$i-*
+- done
- fi
-
-- # Delete old versions of VBox modules.
-- cleanup_modules
-- for i in /lib/modules/*; do
-- update_module_dependencies "${i#/lib/modules/}"
-- done
--
-- # Remove old module sources
-- for i in $OLDMODULES; do
-- rm -rf /usr/src/$i-*
-- done
--
- # Clean-up X11-related bits
-- /sbin/rcvboxadd-x11 cleanup
+- "${INSTALL_DIR}/init/vboxadd-x11" cleanup 2>> "${LOG}"
-
- # Remove other files
- rm /sbin/mount.vboxsf 2>/dev/null
-- rm /sbin/rcvboxadd 2>/dev/null
-- rm /sbin/rcvboxadd-x11 2>/dev/null
+- if test -z "${INSTALL_NO_MODULE_BUILDS}"; then
+- rm -f /etc/kernel/postinst.d/vboxadd /etc/kernel/prerm.d/vboxadd
+- rmdir -p /etc/kernel/postinst.d /etc/kernel/prerm.d 2>/dev/null
+- fi
- rm /etc/udev/rules.d/60-vboxadd.rules 2>/dev/null
-- rm -f /lib/modules/*/initrd/vboxvideo
+ echo "Not implemented! Please use removepkg or pkgtool to remove virtualbox-addons and/or virtualbox-kernel-addons instead."
}