diff --git a/vbox-vboxdrv-init-script.diff b/vbox-vboxdrv-init-script.diff index 40cbf6f..823c54b 100644 --- a/vbox-vboxdrv-init-script.diff +++ b/vbox-vboxdrv-init-script.diff @@ -66,8 +66,8 @@ Index: VirtualBox-5.1.16/src/VBox/Installer/linux/vboxdrv.sh - rm -f /etc/vbox/module_not_compiled - depmod -a - succ_msg "VirtualBox kernel modules built" -+ begin_msg "Recompiling VirtualBox kernel module, NOT. It has been packaged." -+ succ_msg "" ++# Try to build the host kernel modules in case prepackaging has failed ++ /sbin/vboxconfig } dmnstatus() diff --git a/vbox_fix_for_gcc7.patch b/vbox_fix_for_gcc7.patch new file mode 100644 index 0000000..e4cd3ae --- /dev/null +++ b/vbox_fix_for_gcc7.patch @@ -0,0 +1,27 @@ +Index: VirtualBox-5.1.22/configure +=================================================================== +--- VirtualBox-5.1.22.orig/configure ++++ VirtualBox-5.1.22/configure +@@ -447,8 +447,8 @@ check_gcc() + -o \( $cc_maj -eq 4 -a $cc_min -gt 9 \) \ + -o \( $cc_maj -eq 5 -a $cc_min -gt 9 \) \ + -o \( $cc_maj -eq 6 -a $cc_min -gt 9 \) \ +- -o $cc_maj -gt 6 ]; then +- log_failure "gcc version $cc_maj.$cc_min found, expected gcc 4.x, gcc 5.x or gcc 6.x" ++ -o $cc_maj -gt 7 ]; then ++ log_failure "gcc version $cc_maj.$cc_min found, expected gcc 4.x, gcc 5.x, gcc 6.x or gcc7.x" + fail really + else + log_success "found version $cc_ver" +Index: VirtualBox-5.1.22/src/VBox/Devices/PC/ipxe/src/arch/i386/interface/pxe/pxe_preboot.c +=================================================================== +--- VirtualBox-5.1.22.orig/src/VBox/Devices/PC/ipxe/src/arch/i386/interface/pxe/pxe_preboot.c ++++ VirtualBox-5.1.22/src/VBox/Devices/PC/ipxe/src/arch/i386/interface/pxe/pxe_preboot.c +@@ -262,6 +262,7 @@ pxenv_restart_tftp ( struct s_PXENV_TFTP + + /* Restart NBP */ + rmlongjmp ( pxe_restart_nbp, PXENV_RESTART_TFTP ); ++ return 0; + } + + /* PXENV_START_UNDI diff --git a/vboxconfig.sh b/vboxconfig.sh new file mode 100644 index 0000000..595af6f --- /dev/null +++ b/vboxconfig.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Script to build VirtualBox host kernel modules +# Copyright C 2017 by Larry Finger +# +# This script is part of the openSUSE VirtualBox package +# +SOURCE="/usr/src/kernel-modules/virtualbox" +LOGFILE="/var/log/virtualbox.log" +INCLUDE="/lib/modules/`uname -r`/build/include" + +# Force installation of VB host sources. Zypper will install all the prerequisies +echo "Installing all required packages..." +killproc PackageKit +zypper install -y virtualbox-host-source > /dev/null 2>&1 +if [ ! $? ] ; then + echo "Installation of required packages failed." + echo "Use 'sudo zypper install virtualbox-host-source' to see the reason." + exit 1 +fi +# Prerequisites are available, start build +pushd $SOURCE > /dev/null 2>&1 +echo "Building kernel modules..." +make > $LOGFILE 2>&1 +if [ ! $? ] ; then + echo "" + echo "Build of VirtualBox host kernel modules failed." + echo "Look at $LOGFILE to find reasons." + popd > /dev/null 2>&1 + exit 1 +else +echo "Kernel modules built correctly. They will now be installed." +fi +make install >> $LOGFILE 2>&1 +if [ ! $? ] ; then + echo "" + echo "Installation of VirtualBox host kernel modules failed." + echo "Look at $LOGFILE to find reasons." + popd > /dev/null 2>&1 + exit 1 +fi +depmod -a +modprobe -av vboxnetflt vboxnetadp vboxpci +popd > /dev/null 2>&1 +echo "Kernel modules are installed and loaded." +exit 0 + diff --git a/vboxguestconfig.sh b/vboxguestconfig.sh new file mode 100644 index 0000000..9944d62 --- /dev/null +++ b/vboxguestconfig.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Script to build VirtualBox guest kernel modules +# Copyright C 2017 by Larry Finger +# +# This script is part of the openSUSE VirtualBox package +# +SOURCE="/usr/src/kernel-modules/virtualbox" +LOGFILE="/var/log/virtualbox.log" +INCLUDE="/lib/modules/`uname -r`/build/include" + +# Force installation of VB guest sources. Zypper will install all the prerequisies +echo "Installing all required packages..." +killproc PackageKit +zypper install -y virtualbox-guest-source > /dev/null 2>&1 +if [ ! $? ] ; then + echo "Installation of required packages failed." + echo "Use 'sudo zypper install virtualbox-guest-source' to see the reason." + exit 1 +fi +# Prerequisites are available, start build +pushd $SOURCE > /dev/null 2>&1 +echo "Building kernel modules..." +tar jxf guest_src.tar.bz2 > /dev/null 2>&1 +cd additions/src +make > $LOGFILE 2>&1 +if [ ! $? ] ; then + echo "" + echo "Build of VirtualBox guest kernel modules failed." + echo "Look at $LOGFILE to find reasons." + popd > /dev/null 2>&1 + exit 1 +else +echo "Kernel modules built correctly. They will now be installed." +fi +make install >> $LOGFILE 2>&1 +if [ ! $? ] ; then + echo "" + echo "Installation of VirtualBox guest kernel modules failed." + echo "Look at $LOGFILE to find reasons." + popd > /dev/null 2>&1 + exit 1 +fi +depmod -a +modprobe -av vboxguest vboxvideo vboxsf +cd ../.. +rm -rf additions +popd > /dev/null 2>&1 +echo "Kernel modules are installed and loaded." +exit 0 + diff --git a/virtualbox.changes b/virtualbox.changes index 8408077..0a16a39 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,39 @@ +------------------------------------------------------------------- +Sun May 21 13:28:15 UTC 2017 - hpj@urpla.net + +- add %dir /usr/share/licenses to new vnc package + +------------------------------------------------------------------- +Wed May 17 20:33:08 UTC 2017 - Larry.Finger@lwfinger.net + +- Made changes to build with gcc 7.x. This adds new file "vbox_fix_for_gcc7.patch". + Changed the building of VBoxVNC to remove the hack used earlier. + +------------------------------------------------------------------- +Wed May 10 17:39:57 UTC 2017 - Larry.Finger@lwfinger.net + +- Make a number of changes: + * Add VBoxVNC as a proper external pack rather than just make the so available (bnc #1037033). Thanks to Michal Nowak for most of this effort. + One hack was required to work around a bug in "VBoxManage extpack install" whereby the --accept-license option failed to work. + * Improve startup of VirtualBox through use of systemd service files: + a. Beginning with Oracle version 5.0.8, the command used to build the kernel modules outside of the RPM packaging + code changed; however, the openSUSE version did not implement the new method. That new code is now implemented. + b. In Tumbleweed, the SysV init scripts to systemd service files stopped working. Part of the new code also checks + to see if the kernel modules are loaded. If not, new script files are called to include the necessary packages + and build the necessary modules. + c. The hooks are in place to remove the sysv init files and do the complete conversion to systemd. This step will + be done at a later time. + + * New files are "vboxconfig.sh", "vboxguestconfig.sh", "vboxdrv.service", and "vboxadd-service.service". + * New sub-packages virtualbox-guest-source and virtualbox-vnc are produced. + * Some typos in virtualbox.spec are fixed. + +------------------------------------------------------------------- +Thu May 4 17:59:45 UTC 2017 - Larry.Finger@lwfinger.net + +- Add libelf-devel to build. Fixes bnc #1037511. + Modified the startup files to build the kernel modules if they are missing. Files "vboxconfig.sh" and "vboxguestconfig" added. + ------------------------------------------------------------------- Sat Apr 29 17:24:10 UTC 2017 - Larry.Finger@lwfinger.net diff --git a/virtualbox.spec b/virtualbox.spec index 9db4ee5..27a44cd 100644 --- a/virtualbox.spec +++ b/virtualbox.spec @@ -49,6 +49,8 @@ Source12: %{name}-vboxes Source13: %{name}-sysconfig.vbox Source14: vboxdrv.service Source15: vboxadd-service.service +Source16: vboxconfig.sh +Source17: vboxguestconfig.sh Source98: %{name}-rpmlintrc Source99: %{name}-patch-source.sh #rework init scripts to fit suse needs @@ -94,6 +96,8 @@ Patch112: modify_for_4_8_bo_move.patch Patch113: vbox_remove_smp_mflags.patch # Fix change in API for get_user_pages() Patch114: vbox_fix_42.3_api.patch +# Allow use of gcc7 +Patch115: vbox_fix_for_gcc7.patch # Fix for missing include needed for server 1.19 Patch116: Fix_for_server_1.19.patch # @@ -102,6 +106,7 @@ BuildRequires: SDL-devel BuildRequires: acpica BuildRequires: alsa-devel BuildRequires: bin86 +BuildRequires: infinipath-psm BuildRequires: systemd-rpm-macros %if 0%{?suse_version} > 1325 BuildRequires: libboost_headers-devel @@ -122,6 +127,7 @@ BuildRequires: kbuild >= 0.1.9998svn2808 BuildRequires: kernel-syms BuildRequires: libcap-devel BuildRequires: libcurl-devel +BuildRequires: libelf-devel BuildRequires: libidl-devel BuildRequires: libopenssl-devel BuildRequires: libqt5-linguist @@ -293,7 +299,7 @@ Development file for %{name} ########################################### %package host-source -Summary: Source files for %{name} kernel modules +Summary: Source files for %{name} host kernel modules Group: Development/Sources Requires: %{name} = %{version} Requires: gcc @@ -301,9 +307,22 @@ Requires: make BuildArch: noarch %description host-source -Source files for %{name} kernel modules +Source files for %{name} host kernel modules These can be built for custom kernels using cd %{_prefix}/src/kernel-modules/virtualbox ; make ; make install + +%package guest-source +Summary: Source files for %{name} guest kernel modules +Group: Development/Sources +Requires: %{name} = %{version} +Requires: gcc +Requires: make +BuildArch: noarch + +%description guest-source +Source files for %{name} guest kernel modules +These can be built for custom kernels using +cd %{_prefix}/src/kernel-modules/virtualbox/guest ; make ; make install ########################################### %package guest-desktop-icons @@ -317,6 +336,17 @@ BuildArch: noarch This package contains icons for guest desktop files that were created on the desktop. ########################################### +%package vnc +Summary: VNC desktop sharing +Group: System/Emulators/PC +Requires: %{name} = %{version} + +%description vnc +Virtual Network Computing (VNC) is a graphical desktop sharing system that uses the Remote Frame Buffer +protocol (RFB) to remotely control another computer. When this optional feature is desired, it is installed +as an "extpack" for VirtualBox. The implementation is licensed under GPL. +########################################### + %prep %setup -q -n VirtualBox-%{version} %patch1 -p1 @@ -342,6 +372,7 @@ This package contains icons for guest desktop files that were created on the des %if 0%{?sle_version} == 120300 %patch114 -p1 %endif +%patch115 -p1 %patch116 -p1 #copy user manual @@ -352,7 +383,7 @@ cp %{SOURCE10} LocalConfig.kmk ########################## ####workaround kmk_sed --v #instead of kmk_sed use /usr/bin/sed because of bug http://svn.netlabs.org/kbuild/ticket/112, -#but we have to create wrapper which will handle --append and --outpout options which are not provided by /usr/bin/sed +#but we have to create wrapper which will handle --append and --output options which are not provided by /usr/bin/sed cat >> kmk_sed <> LocalConfig.kmk # %build -#ensure we dont ever use them +#ensure we don't ever use them rm -rf src/libs/{libpng-*,libxml2-*,libxslt-*,zlib-*,boost-*} # --disable-kmods don't build Linux kernel modules - but use SUSE specific way see few lines under @@ -404,6 +435,16 @@ echo "build basic parts" TOOL_GCC3_CFLAGS="%{optflags}" TOOL_GCC3_CXXFLAGS="%{optflags}" \ VBOX_GCC_OPT="%{optflags}" +echo "build VNC extension pack" +# tar must use GNU, not POSIX, format here +sed -i 's/tar /tar --format=gnu /' src/VBox/ExtPacks/VNC/Makefile.kmk +kmk -C src/VBox/ExtPacks/VNC packing +pushd out/linux.*/release/packages/ +mkdir -p "%{buildroot}%{_datadir}/virtualbox/extensions/" +install -D -m 644 VNC-*.vbox-extpack "%{buildroot}%{_datadir}/virtualbox/extensions/VNC-%{version}.vbox-extpack" +popd +install -D -m 644 "COPYING" "%{buildroot}%{_datadir}/licenses/LICENSE.vnc" + # # build kernel modules for guest and host (check novel-kmp package as example) # host modules : vboxdrv,vboxnetflt,vboxnetadp,vboxpci @@ -470,8 +511,6 @@ install -d %{buildroot}%{_unitdir}/multi-user.target.wants install -d -m 755 %{buildroot}%{_sysconfdir}/vbox install -d -m 755 %{buildroot}%{_udevrulesdir} install -d -m 755 %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d -install -m 755 out/linux.*/release/bin/ExtensionPacks/VNC/linux.*/VBoxVNC.so %{buildroot}%{_vbox_instdir}/VBoxVNC.so -install -m 755 out/linux.*/release/bin/ExtensionPacks/VNC/linux.*/VBoxVNCMain.so %{buildroot}%{_vbox_instdir}/VBoxVNCMain.so #################################################################################### echo "entering virtualbox-kmp-guest and virtualbox-kmp-host install section" @@ -564,7 +603,9 @@ install -m 644 components/* %{buildroot}%{_vbox_instdir}/components/ # install languages install -m 644 nls/* %{buildroot}%{_datadir}/virtualbox/nls/ # install kmp src -mkdir -p %{buildroot}%{_usrsrc}/kernel-modules +mkdir -p %{buildroot}%{_usrsrc}/kernel-modules/virtualbox +mkdir -p %{buildroot}%{_usrsrc}/kernel-modules/additions +tar jcf %{buildroot}%{_usrsrc}/kernel-modules/additions/guest_src.tar.bz2 additions/src cp -a src %{buildroot}%{_usrsrc}/kernel-modules/virtualbox install -m 644 %{SOURCE11} %{buildroot}%{_udevrulesdir}/60-vboxdrv.rules popd @@ -581,7 +622,6 @@ install -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/default/virtualbox install -m 644 %{SOURCE9} %{buildroot}%{_bindir}/VirtualBox # modify and install the vboxdrv init script -# TODO: some of this stuff breaks the fillup macros below? sed -i "s|%{NOLSB}%|yes|g;s|%{DEBIAN}%||g;s|%{PACKAGE}%|virtualbox|g" \ src/VBox/Installer/linux/vboxdrv.sh install -m 744 src/VBox/Installer/linux/vboxdrv.sh %{buildroot}%{_sysconfdir}/init.d/vboxdrv @@ -591,6 +631,8 @@ install -m 0644 %{SOURCE14} %{buildroot}%{_unitdir}/vboxdrv.service install -m 0644 %{SOURCE14} %{buildroot}%{_unitdir}/multi-user.target.wants/vboxdrv.service install -m 0644 %{SOURCE15} %{buildroot}%{_unitdir}/vboxadd-service.service install -m 0644 %{SOURCE15} %{buildroot}%{_unitdir}/multi-user.target.wants/vboxadd-service.service +install -m 0644 %{SOURCE16} %{buildroot}/sbin/vboxconfig +install -m 0644 %{SOURCE17} %{buildroot}/sbin/vboxguestconfig # Init script to start virtual boxes during boot install -m 755 %{SOURCE12} %{buildroot}%{_sysconfdir}/init.d/vboxes ln -s %{_sysconfdir}/init.d/vboxes %{buildroot}%{_sbindir}/rcvboxes @@ -604,7 +646,7 @@ echo -e "#settings for vboxwebsrn\nVBOXWEB_USER=root" > %{buildroot}%{_sysconfdi # install udev helper script for creating usb devices install -m 0755 -D src/VBox/Installer/linux/VBoxCreateUSBNode.sh %{buildroot}%{_vbox_instdir}/VBoxCreateUSBNode.sh ###################################################### -echo "entrering python-virtualbox install section" +echo "entering python-virtualbox install section" ###################################################### pushd out/linux.*/release/bin/sdk/installer VBOX_INSTALL_PATH=%{_vbox_instdir} python vboxapisetup.py install --prefix=%{_prefix} --root=%{buildroot} --record-rpm=%{_tmppath}/SITE_FILES @@ -681,10 +723,7 @@ getent group vboxsf >/dev/null || groupadd -r vboxsf %post /sbin/ldconfig -#skip the fill up part and enable vboxdrv by default -%fillup_and_insserv -f -y vboxdrv #setup our sysconfig file /etc/sysconfig/vbox -%fillup_only -an vbox %set_permissions %{_vbox_instdir}/VBoxNetDHCP %set_permissions %{_vbox_instdir}/VBoxNetAdpCtl %set_permissions %{_vbox_instdir}/VBoxHeadless @@ -704,12 +743,15 @@ getent group vboxsf >/dev/null || groupadd -r vboxsf %verify_permissions -e %{_vbox_instdir}/VirtualBox %post guest-tools -%fillup_and_insserv -f -y vboxadd -%fillup_and_insserv -f -y vboxadd-service %service_add_post vboxadd-service.service %post websrv -%fillup_and_insserv -f -y vboxweb-service + +%post vnc +EXTPACK="/usr/share/virtualbox/extensions/VNC-%{version}.vbox-extpack" +ACCEPT="$(tar --to-stdout -xf "${EXTPACK}" ./ExtPack-license.txt | sha256sum | head --bytes=64)" +VBoxManage extpack install --replace "${EXTPACK}" --accept-license="${ACCEPT}" > /dev/null + ####################################################### # scriptlets preun ####################################################### @@ -771,7 +813,6 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_vbox_instdir}/VBoxDD2.so %{_vbox_instdir}/VBoxDD.so %{_vbox_instdir}/VBoxDDU.so -%{_vbox_instdir}/VBoxVNC*.so %{_vbox_instdir}/VBoxGuestControlSvc.so %{_vbox_instdir}/VBoxGuestPropSvc.so %{_vbox_instdir}/VBoxHeadless.so @@ -825,6 +866,7 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_var}/adm/fillup-templates/sysconfig.vbox %{_sbindir}/rcvboxes %{_sbindir}/rcvboxdrv +/sbin/vboxconfig %{_vbox_instdir}/VBoxCreateUSBNode.sh #%verify(not mode) %attr(4750,root,vboxusers) %{_vbox_instdir}/VBoxNetNAT %verify(not mode) %attr(4750,root,vboxusers) %{_vbox_instdir}/VBoxNetDHCP @@ -864,6 +906,7 @@ export DISABLE_RESTART_ON_UPDATE=yes %defattr(-, root, root) %{_bindir}/VBoxControl %{_sbindir}/VBoxService +/sbin/vboxguestconfig /sbin/mount.vboxsf %{_udevrulesdir}/60-vboxguest.rules %config %{_sysconfdir}/init.d/vboxadd @@ -900,6 +943,12 @@ export DISABLE_RESTART_ON_UPDATE=yes %dir %{_usrsrc}/kernel-modules %{_usrsrc}/kernel-modules/virtualbox +%files guest-source +%defattr(-,root, root) +%dir %{_usrsrc}/kernel-modules +%dir %{_usrsrc}/kernel-modules/additions +%{_usrsrc}/kernel-modules/additions/guest_src.tar.bz2 + %files websrv %defattr(-,root, root) %{_vbox_instdir}/vboxwebsrv @@ -912,4 +961,11 @@ export DISABLE_RESTART_ON_UPDATE=yes %dir %{_datadir}/pixmaps/virtalbox %{_datadir}/pixmaps/virtalbox/*.png +%files vnc +%defattr(-,root, root) +%dir %{_datadir}/virtualbox/extensions +%{_datadir}/virtualbox/extensions/VNC-%{version}.vbox-extpack +%dir %{_datadir}/licenses +%{_datadir}/licenses/LICENSE.vnc + %changelog