forked from pool/virtualbox
- 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. - 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. OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=331
This commit is contained in:
parent
31890f8f57
commit
17a3ba2102
@ -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()
|
||||
|
47
vboxconfig.sh
Normal file
47
vboxconfig.sh
Normal file
@ -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
|
||||
|
51
vboxguestconfig.sh
Normal file
51
vboxguestconfig.sh
Normal file
@ -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
|
||||
|
@ -1,3 +1,28 @@
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
@ -102,6 +104,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 +125,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 +297,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 +305,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 +334,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
|
||||
@ -352,7 +380,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 <<EOF
|
||||
#!/bin/bash
|
||||
while [ "\$#" != "0" ]; do
|
||||
@ -369,7 +397,7 @@ echo "SED = $RPM_BUILD_DIR/VirtualBox-%{version}/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 +432,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 +508,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 +600,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 +619,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 +628,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 +643,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 +720,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 +740,19 @@ 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
|
||||
# There is a major hack here. The extpack option for VBoxManage is supposed to accept the sha256sum hash
|
||||
# of the license file using the --accept-license option. This does not work. To get around the issue, a
|
||||
# file (yes) containing a single "Y" is created and that is piped to the standard input of VBoxManage.
|
||||
# With this hack, VBoxManage silently accepts the GPL V2 license. The new file is then deleted.
|
||||
echo "Y" > yes
|
||||
VBoxManage extpack install --replace "/usr/share/virtualbox/extensions/VNC-%{version}.vbox-extpack" > /dev/null < yes
|
||||
rm yes
|
||||
|
||||
#######################################################
|
||||
# scriptlets preun
|
||||
#######################################################
|
||||
@ -771,7 +814,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 +867,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 +907,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 +944,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 +962,10 @@ 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
|
||||
%{_datadir}/licenses/LICENSE.vnc
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user