diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..430d378 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/VirtualBox-5.2.6.tar.bz2 diff --git a/0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch b/0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch new file mode 100644 index 0000000..625d554 --- /dev/null +++ b/0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch @@ -0,0 +1,130 @@ +From 369dd2ee3c82c4417fee04aeec933c74fd198e78 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 23 Jan 2018 15:09:20 +0100 +Subject: [PATCH resend] VBoxServiceAutoMount: Change Linux mount code to use + an options string + +Signed-off-by: Hans de Goede +--- + .../common/VBoxService/VBoxServiceAutoMount.cpp | 62 +++------------------- + 1 file changed, 8 insertions(+), 54 deletions(-) + +diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp +index aa15d8b1..551edd4a 100644 +--- a/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp ++++ b/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -77,6 +78,9 @@ RT_C_DECLS_END + # endif + #endif + ++#ifndef MAX_MNTOPT_STR ++#define MAX_MNTOPT_STR PAGE_SIZE ++#endif + + /********************************************************************************************************************************* + * Global Variables * +@@ -297,13 +301,13 @@ static int vbsvcAutoMountSharedFolder(const char *pszShareName, const char *pszM + rc = vbsvcAutoMountPrepareMountPoint(pszMountPoint, pszShareName, pOpts); + if (!fSkip && RT_SUCCESS(rc)) + { +-#ifdef RT_OS_SOLARIS + char szOptBuf[MAX_MNTOPT_STR] = { '\0', }; ++ RTStrPrintf(szOptBuf, sizeof(szOptBuf), "uid=%d,gid=%d,dmode=%0o,fmode=%0o,dmask=%0o,fmask=%0o", ++ pOpts->uid, pOpts->gid, pOpts->dmode, pOpts->fmode, pOpts->dmask, pOpts->fmask); ++#ifdef RT_OS_SOLARIS + int fFlags = 0; + if (pOpts->ronly) + fFlags |= MS_RDONLY; +- RTStrPrintf(szOptBuf, sizeof(szOptBuf), "uid=%d,gid=%d,dmode=%0o,fmode=%0o,dmask=%0o,fmask=%0o", +- pOpts->uid, pOpts->gid, pOpts->dmode, pOpts->fmode, pOpts->dmask, pOpts->fmask); + int r = mount(pszShareName, + pszMountPoint, + fFlags | MS_OPTIONSTR, +@@ -320,32 +324,11 @@ static int vbsvcAutoMountSharedFolder(const char *pszShareName, const char *pszM + + #elif defined(RT_OS_LINUX) + unsigned long fFlags = MS_NODEV; +- +- /*const char *szOptions = { "rw" }; - ??? */ +- struct vbsf_mount_info_new mntinf; +- +- mntinf.nullchar = '\0'; +- mntinf.signature[0] = VBSF_MOUNT_SIGNATURE_BYTE_0; +- mntinf.signature[1] = VBSF_MOUNT_SIGNATURE_BYTE_1; +- mntinf.signature[2] = VBSF_MOUNT_SIGNATURE_BYTE_2; +- mntinf.length = sizeof(mntinf); +- +- mntinf.uid = pOpts->uid; +- mntinf.gid = pOpts->gid; +- mntinf.ttl = pOpts->ttl; +- mntinf.dmode = pOpts->dmode; +- mntinf.fmode = pOpts->fmode; +- mntinf.dmask = pOpts->dmask; +- mntinf.fmask = pOpts->fmask; +- +- strcpy(mntinf.name, pszShareName); +- strcpy(mntinf.nls_name, "\0"); +- + int r = mount(pszShareName, + pszMountPoint, + "vboxsf", + fFlags, +- &mntinf); ++ szOptBuf); + if (r == 0) + { + VGSvcVerbose(0, "vbsvcAutoMountWorker: Shared folder '%s' was mounted to '%s'\n", pszShareName, pszMountPoint); +@@ -378,34 +361,6 @@ static int vbsvcAutoMountSharedFolder(const char *pszShareName, const char *pszM + } + else /* r == -1, we got some error in errno. */ + { +- if (errno == EPROTO) +- { +- VGSvcVerbose(3, "vbsvcAutoMountWorker: Messed up share name, re-trying ...\n"); +- +- /** @todo r=bird: What on earth is going on here????? Why can't you +- * strcpy(mntinf.name, pszShareName) to fix it again? */ +- +- /* Sometimes the mount utility messes up the share name. Try to +- * un-mangle it again. */ +- char szCWD[RTPATH_MAX]; +- size_t cchCWD; +- if (!getcwd(szCWD, sizeof(szCWD))) +- { +- VGSvcError("vbsvcAutoMountWorker: Failed to get the current working directory\n"); +- szCWD[0] = '\0'; +- } +- cchCWD = strlen(szCWD); +- if (!strncmp(pszMountPoint, szCWD, cchCWD)) +- { +- while (pszMountPoint[cchCWD] == '/') +- ++cchCWD; +- /* We checked before that we have enough space */ +- strcpy(mntinf.name, pszMountPoint + cchCWD); +- } +- r = mount(mntinf.name, pszMountPoint, "vboxsf", fFlags, &mntinf); +- } +- if (r == -1) /* Was there some error from one of the tries above? */ +- { + switch (errno) + { + /* If we get EINVAL here, the system already has mounted the Shared Folder to another +@@ -424,7 +379,6 @@ static int vbsvcAutoMountSharedFolder(const char *pszShareName, const char *pszM + rc = RTErrConvertFromErrno(errno); + break; + } +- } + } + #else + # error "PORTME" +-- +2.14.3 + diff --git a/96-vbox.preset b/96-vbox.preset new file mode 100644 index 0000000..85dde97 --- /dev/null +++ b/96-vbox.preset @@ -0,0 +1,7 @@ +# Also see: +# https://fedoraproject.org/wiki/Starting_services_by_default + +# Installing presets is not the preferred solution but until another one +# presents itself: +# https://bugzilla.rpmfusion.org/show_bug.cgi?id=3713 +enable vboxservice.service diff --git a/README.md b/README.md index be550de..338cbeb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # virtualbox-guest-additions -The virtualbox-guest-additions package \ No newline at end of file +The virtualbox-guest-additions package diff --git a/VBoxOGLRun.sh b/VBoxOGLRun.sh new file mode 100644 index 0000000..aa34308 --- /dev/null +++ b/VBoxOGLRun.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +if VBoxClient --check3d; then + export LD_LIBRARY_PATH=/usr/lib64/VBoxGuestAdditions:/usr/lib/VBoxGuestAdditions +else + echo "Error 3D passthru not enabled in VM settings." 1>&2 + exit 1 +fi + +exec "$@" diff --git a/VirtualBox-5.0.18-xserver_guest.patch b/VirtualBox-5.0.18-xserver_guest.patch new file mode 100644 index 0000000..18178b3 --- /dev/null +++ b/VirtualBox-5.0.18-xserver_guest.patch @@ -0,0 +1,43 @@ +Copyright (c) 2016 Sérgio Basto + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +The MIT License is to allow be in included in VirtualBox source code. + +Using also VBOX_USE_SYSTEM_XORG_HEADERS to build guest additions parts, +just compile with X11 system source and we may remove all bundle X11 source code. + +when we use VBOX_USE_SYSTEM_XORG_HEADERS, we don't need compile the very old +VBoxGuestR3LibXFree86 for use with old servers where the C library is not +available and becasue fail to build when we unbundle all X11 sources, files like +xf86_ansic.h doesn't exist anymore. + +--- ./src/VBox/Additions/common/VBoxGuest/lib/Makefile.kmk.orig 2014-10-11 13:03:35.000000000 +0100 ++++ ./src/VBox/Additions/common/VBoxGuest/lib/Makefile.kmk 2014-10-12 00:11:00.925507543 +0100 +@@ -40,9 +40,11 @@ LIBRARIES += \ + VBoxGuestR3LibShared + ifndef VBOX_ONLY_VALIDATIONKIT + if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd) ++ ifndef VBOX_USE_SYSTEM_XORG_HEADERS + LIBRARIES += \ + VBoxGuestR3LibXFree86 + endif ++ endif + if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris) + LIBRARIES += \ + VBoxGuestR3LibXOrg diff --git a/VirtualBox-5.2.6-xclient.patch b/VirtualBox-5.2.6-xclient.patch new file mode 100644 index 0000000..75eabab --- /dev/null +++ b/VirtualBox-5.2.6-xclient.patch @@ -0,0 +1,20 @@ +diff -up VirtualBox-5.2.6/src/VBox/Additions/x11/Installer/98vboxadd-xclient~ VirtualBox-5.2.6/src/VBox/Additions/x11/Installer/98vboxadd-xclient +--- VirtualBox-5.2.6/src/VBox/Additions/x11/Installer/98vboxadd-xclient~ 2018-01-15 15:49:57.000000000 +0100 ++++ VirtualBox-5.2.6/src/VBox/Additions/x11/Installer/98vboxadd-xclient 2018-02-07 12:13:51.578170786 +0100 +@@ -21,13 +21,9 @@ for i in $HOME/.vboxclient-*.pid; do + test -w $i || rm -f $i + done + +-if ! test -c /dev/vboxguest 2>/dev/null; then +- # Do not start if the kernel module is not present. +- notify-send "VBoxClient: the VirtualBox kernel service is not running. Exiting." +-elif test -z "${SSH_CONNECTION}"; then +- # This script can also be triggered by a connection over SSH, which is not +- # what we had in mind, so we do not start VBoxClient in that case. We do +- # not use "exit" here as this script is "source"d, not executed. ++# Do not start if the kernel module is not present; or if this script is ++# triggered by a connection over SSH. ++if [ -c /dev/vboxguest -a -z "${SSH_CONNECTION}" ]; then + /usr/bin/VBoxClient --clipboard + /usr/bin/VBoxClient --checkhostversion + /usr/bin/VBoxClient --display diff --git a/VirtualBox-60-vboxguest.rules b/VirtualBox-60-vboxguest.rules new file mode 100644 index 0000000..061eec0 --- /dev/null +++ b/VirtualBox-60-vboxguest.rules @@ -0,0 +1,2 @@ +KERNEL=="vboxguest", NAME="vboxguest", OWNER="vboxadd", MODE="0660" +KERNEL=="vboxuser", NAME="vboxuser", OWNER="vboxadd", MODE="0666" diff --git a/sources b/sources new file mode 100644 index 0000000..5b0db2e --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (VirtualBox-5.2.6.tar.bz2) = ed6f801c055e9b8e152118a1ebfecdc15c310fac2b007ea3cd4a404d17cbbbc83782a3baa76b979c72b9399616844291576846d820f8aefb7c4b4ec2eaf36482 diff --git a/vboxservice.service b/vboxservice.service new file mode 100644 index 0000000..a948a35 --- /dev/null +++ b/vboxservice.service @@ -0,0 +1,9 @@ +[Unit] +Description=VirtualBox guest services +ConditionVirtualization=|oracle + +[Service] +ExecStart=/usr/sbin/VBoxService -f + +[Install] +WantedBy=multi-user.target diff --git a/virtualbox-guest-additions.spec b/virtualbox-guest-additions.spec new file mode 100644 index 0000000..01f7c09 --- /dev/null +++ b/virtualbox-guest-additions.spec @@ -0,0 +1,219 @@ +%global __provides_exclude_from %{_libdir}/VBoxGuestAdditions + +Name: virtualbox-guest-additions +Version: 5.2.6 +Release: 4%{?dist} +Summary: VirtualBox Guest Additions +License: GPLv2 or (GPLv2 and CDDL) +URL: http://www.virtualbox.org/wiki/VirtualBox + +Source0: http://download.virtualbox.org/virtualbox/%{version}/VirtualBox-%{version}.tar.bz2 +Source1: vboxservice.service +Source2: 96-vbox.preset +Source3: VirtualBox-60-vboxguest.rules +Source4: VBoxOGLRun.sh + +# Small compile fix +Patch1: VirtualBox-5.0.18-xserver_guest.patch +# Mainline vboxsf uses an option string rather then a custom binary data struct +Patch2: 0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch +# Do not show an error dialog when not running under vbox +Patch3: VirtualBox-5.2.6-xclient.patch + +BuildRequires: kBuild >= 0.1.9998 +BuildRequires: desktop-file-utils +BuildRequires: makeself +BuildRequires: yasm +BuildRequires: boost-devel +BuildRequires: libXcomposite-devel +BuildRequires: libXmu-devel +BuildRequires: libXrandr-devel +BuildRequires: libXt-devel +BuildRequires: mesa-libEGL-devel +BuildRequires: mesa-libGL-devel +BuildRequires: mesa-libGLU-devel +BuildRequires: openssl-devel +BuildRequires: pam-devel +BuildRequires: zlib-devel +# For the OpenGL passthru libs, these are statically linked against libstdc++ +# like mesa itself is to avoid trouble with game-runtimes providing their +# own older libstdc++ (e.g. steam does this) +BuildRequires: libstdc++-static +%{?systemd_requires} +# Obsoletes/provides for upgrade path from the rpmfusion guest-additions pkg +Obsoletes: VirtualBox-guest-additions < %{version}-%{release} +Provides: VirtualBox-guest-additions = %{version}-%{release} +Provides: VirtualBox-kmod-common = %{version}-%{release} +# Virtual Box guests are always x86, no need to build for other archs +ExclusiveArch: i686 x86_64 + +%description +VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for +enterprise as well as home use. This package contains the VirtualBox +Guest Additions which support better integration of VirtualBox guests +with the Host, including file sharing, clipboard sharing and Seamless mode. + + +%package ogl +Summary: GL pass-through support + +%description ogl +The %{name}-ogl package contains an alternate libGL.so.1 +which renders GL by passing all GL commands through to the host. + +To use OpenGL pass-through mode run apps using "VBoxOGLRun foo -opt1 -opt2". + + +%prep +%autosetup -p1 -n VirtualBox-%{version} +# Remove prebuilt binaries +find -name '*.py[co]' -delete +rm -r kBuild/ +rm -r tools/ +# Remove bundle X11 sources and some lib sources +rm -r src/VBox/Additions/x11/x11include/ +rm -r src/VBox/Additions/x11/x11stubs/ +rm include/VBox/HostServices/glext.h +rm include/VBox/HostServices/glxext.h +rm include/VBox/HostServices/wglext.h +rm -r src/libs/libxml2-2.9.*/ +rm -r src/libs/libpng-1.2.*/ +rm -r src/libs/zlib-1.2.8/ +# CRLF->LF +sed -i 's/\r//' COPYING + + +%build +./configure --only-additions --disable-kmods +. ./env.sh +umask 0022 + +# VirtualBox build system installs and builds in the same step, +# not allways looking for the installed files to places they have +# really been installed to. Therefore we do not override any of +# the installation paths, but install the tree with the default +# layout under 'obj' and shuffle files around in %%install. +kmk %{_smp_mflags} \ + KBUILD_VERBOSE=2 \ + PATH_OUT="$PWD/obj" \ + TOOL_YASM_AS=yasm \ + VBOX_WITH_TESTCASES= \ + VBOX_WITH_VALIDATIONKIT= \ + VBOX_USE_SYSTEM_XORG_HEADERS=1 \ + VBOX_USE_SYSTEM_GL_HEADERS=1 \ + SDK_VBOX_LIBPNG_INCS="" \ + SDK_VBOX_LIBXML2_INCS="" \ + SDK_VBOX_OPENSSL_INCS="" \ + SDK_VBOX_OPENSSL_LIBS="$(pkgconf --libs openssl)" \ + SDK_VBOX_ZLIB_INCS= \ + VBOX_NO_LEGACY_XORG_X11=1 \ + VBOX_BUILD_PUBLISHER=_Fedora + + +%install +# The directory layout created below attempts to mimic the one of +# the commercially supported version to minimize confusion +mkdir -p %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_sbindir} +mkdir -p %{buildroot}%{_libdir}/security +mkdir -p %{buildroot}%{_libdir}/VBoxGuestAdditions + +install -m 0755 -t %{buildroot}%{_sbindir} \ + obj/bin/additions/VBoxService +install -m 0755 -t %{buildroot}%{_bindir} \ + obj/bin/additions/VBoxClient \ + obj/bin/additions/VBoxControl + +install -m 0755 -t %{buildroot}%{_libdir}/security \ + obj/bin/additions/pam_vbox.so +install -m 0755 -t %{buildroot}%{_libdir}/VBoxGuestAdditions \ + obj/bin/additions/VBoxOGL*.so +ln -s VBoxOGL.so %{buildroot}%{_libdir}/VBoxGuestAdditions/libGL.so.1 + +install -p -m 0755 -D src/VBox/Additions/x11/Installer/98vboxadd-xclient \ + %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d/98vboxadd-xclient.sh +ln -s ../..%{_sysconfdir}/X11/xinit/xinitrc.d/98vboxadd-xclient.sh \ + %{buildroot}%{_bindir}/VBoxClient-all +desktop-file-install --dir=%{buildroot}%{_sysconfdir}/xdg/autostart/ \ + --remove-key=Encoding src/VBox/Additions/x11/Installer/vboxclient.desktop +desktop-file-validate \ + %{buildroot}%{_sysconfdir}/xdg/autostart/vboxclient.desktop + +install -p -m 0644 -D %{SOURCE1} %{buildroot}%{_unitdir}/vboxservice.service +install -p -m 0644 -D %{SOURCE2} %{buildroot}%{_presetdir}/96-vbox.preset +install -p -m 0644 -D %{SOURCE3} %{buildroot}%{_udevrulesdir}/60-vboxguest.rules +install -p -m 0755 -D %{SOURCE4} %{buildroot}%{_bindir}/VBoxOGLRun + + +%pre +# 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. +getent group vboxsf >/dev/null || groupadd -r vboxsf 2>&1 +getent passwd vboxadd >/dev/null || \ + useradd -r -g 1 -d /var/run/vboxadd -s /sbin/nologin vboxadd 2>&1 + +%post +%systemd_post vboxservice.service + +%preun +%systemd_preun vboxservice.service + +%postun +%systemd_postun_with_restart vboxservice.service + + +%files +%license COPYING* +%{_bindir}/VBoxClient +%{_bindir}/VBoxControl +%{_bindir}/VBoxClient-all +%{_sbindir}/VBoxService +%{_libdir}/security/pam_vbox.so +%{_sysconfdir}/X11/xinit/xinitrc.d/98vboxadd-xclient.sh +%{_sysconfdir}/xdg/autostart/vboxclient.desktop +%{_unitdir}/vboxservice.service +%{_presetdir}/96-vbox.preset +%{_udevrulesdir}/60-vboxguest.rules + +%files ogl +%license COPYING* +%{_bindir}/VBoxOGLRun +%{_libdir}/VBoxGuestAdditions + + +%changelog +* Wed Feb 7 2018 Hans de Goede - 5.2.6-4 +- Do not use pkg-config for includes, as pkg-config prefixes an unwanted -I +- Fix /etc/X11/xinit/xinitrc.d/98vboxadd-xclient.sh to now show an error + notification when not running under vbox, as we will be part of the + Workstation livecd which may run anywhere + +* Mon Jan 29 2018 Hans de Goede - 5.2.6-3 +- Update to 5.2.6 +- Drop VirtualBox-4.3.0-no-bundles.patch, set make variables instead +- Adjust automount vboxservice for mainline vboxsf filesystem driver +- Drop mount.vboxsf, the mainline vboxsf filesystem driver works with the + regular mount binary +- Drop commented out Requires: kernel, this is bad idea (rhbz#1534595) +- Use pkgconfig to get include/libs instead of hardcoding (rhbz#1534595) +- Rename to lowercaps virtualbox-guest-additions, add Obsoletes / Provides + for upgradepath from rpmfusion (rhbz#1534595) +- Add Provides: VirtualBox-kmod-common for rpmfusion upgradepath (rhbz#1534595) +- Latest rpmfusion Release is 2, set our Release field to 3 + +* Sun Nov 26 2017 Hans de Goede - 5.2.2-1 +- Update to 5.2.2 + +* Thu Sep 21 2017 Hans de Goede - 5.2.0-0.1.svn68769 +- Switch to a 5.2 svn snapshot, as 5.2 has a new /dev/vboxguest ioctl API + which the mainline version of the vboxguest drivers implement + +* Mon Aug 28 2017 Hans de Goede - 5.1.26-3 +- Put the libGL.so.1 replacement libs and VBoxOGLRun scripts in an -ogl + subpackage, so that people can install both the i686 and x86_64 versions. +- Filter out libGL.so.1 provides + +* Mon Aug 14 2017 Hans de Goede - 5.1.26-2 +- Initial Fedora package based on the guest-addition parts of the + rpmfusion VirtualBox package