diff options
-rw-r--r-- | .SRCINFO | 43 | ||||
-rw-r--r-- | 10-vboxdrv.rules | 5 | ||||
-rw-r--r-- | PKGBUILD | 173 | ||||
-rw-r--r-- | VBoxFixUSB | 16 | ||||
-rw-r--r-- | install | 87 | ||||
-rw-r--r-- | vboxweb.conf | 11 | ||||
-rw-r--r-- | vboxweb.rc | 86 |
7 files changed, 421 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..70c2b7a4677b --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,43 @@ +pkgbase = virtualbox-bin + pkgdesc = Oracle VM VirtualBox Binary Edition + pkgver = 5.0.2 + pkgrel = 1 + url = http://virtualbox.org/ + install = install + arch = i686 + arch = x86_64 + license = GPL2 + depends = dkms + depends = fontconfig + depends = gcc + depends = libgl + depends = libidl2 + depends = libxcursor + depends = libxinerama + depends = libxmu + depends = linux-headers + depends = python2 + depends = sdl + optdepends = virtualbox-ext-oracle: for Oracle extensions + provides = virtualbox=5.0.2 + conflicts = virtualbox + conflicts = virtualbox-ose + conflicts = virtualbox-modules + replaces = virtualbox_bin + replaces = virtualbox-sun + options = !strip + backup = etc/vbox/vbox.cfg + backup = etc/conf.d/vboxweb + source = VirtualBox-5.0.2-102096-Linux_amd64.run::http://download.virtualbox.org/virtualbox/5.0.2/VirtualBox-5.0.2-102096-Linux_amd64.run + source = VBoxFixUSB + source = 10-vboxdrv.rules + source = vboxweb.rc + source = vboxweb.conf + md5sums = a32555a8d8af6e3b562adb6b259fb4ee + md5sums = 2d04c2e2d8c71558c910a51ec773731a + md5sums = fe60f9510502bea67383d9198ae8c13c + md5sums = c159d683ba1947290fc2ad2c64194150 + md5sums = 3ac185709bfe688bb753c46e170d0546 + +pkgname = virtualbox-bin + diff --git a/10-vboxdrv.rules b/10-vboxdrv.rules new file mode 100644 index 000000000000..12b7ab57afc6 --- /dev/null +++ b/10-vboxdrv.rules @@ -0,0 +1,5 @@ +KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600" +SUBSYSTEM=="usb_device", ACTION=="add", RUN="VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}" +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN="VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}" +SUBSYSTEM=="usb_device", ACTION=="remove", RUN="VBoxCreateUSBNode.sh --remove $major $minor" +SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN="VBoxCreateUSBNode.sh --remove $major $minor" diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..00f179863e50 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,173 @@ +# Maintainer: M0Rf30 +# Contributor: Sébastien Luttringer <seblu@aur.archlinux.org> +# Contributor: Lukas Fleischer <archlinux at cryptocrack dot de> +# Contributor: thotypous <matiasΘarchlinux-br·org> +# Contributor: xduugu <xduuguΘgmx·com> +# Contributor: Peter 'piie' Feuerer <peterΘpiie·net> +# Contributor: Sascha Pfau <MrPeacockΘgmail·com> +# Contributor: iggy <iggy.mfΘgmail·com> +# Contributor: Rainmaker <rainmaker52@gmail.com> + +pkgname=virtualbox-bin +pkgver=5.0.2 +_build=102096 +pkgrel=1 +pkgdesc='Oracle VM VirtualBox Binary Edition (Oracle branded non-OSE version)' +arch=('i686' 'x86_64') +url='http://virtualbox.org/' +license=('GPL2') +options=('!strip') +depends=( + 'dkms' + 'fontconfig' + 'gcc' + 'libgl' + 'libidl2' + 'libxcursor' + 'libxinerama' + 'libxmu' + 'linux-headers' + 'python2' + 'sdl' +) +optdepends=('virtualbox-ext-oracle: for Oracle extensions') +provides=("virtualbox=${pkgver}") +conflicts=('virtualbox' 'virtualbox-ose' 'virtualbox-modules') +replaces=('virtualbox_bin' 'virtualbox-sun') +backup=('etc/vbox/vbox.cfg' 'etc/conf.d/vboxweb') +install='install' +_arch='amd64' +[[ "${CARCH}" = i686 ]] && _arch='x86' +source=( + "VirtualBox-${pkgver}-${_build}-Linux_${_arch}.run::http://download.virtualbox.org/virtualbox/${pkgver}/VirtualBox-${pkgver}-${_build}-Linux_${_arch}.run" + 'VBoxFixUSB' + '10-vboxdrv.rules' + 'vboxweb.rc' + 'vboxweb.conf' +) + + +md5sums=('a32555a8d8af6e3b562adb6b259fb4ee' + '2d04c2e2d8c71558c910a51ec773731a' + 'fe60f9510502bea67383d9198ae8c13c' + 'c159d683ba1947290fc2ad2c64194150' + '3ac185709bfe688bb753c46e170d0546') + +_installdir='/opt/VirtualBox' + +package() { + # Check and unpack the run package via sh(1) + sh "VirtualBox-$pkgver-$_build-Linux_$_arch.run" --check + echo yes | sh "VirtualBox-$pkgver-$_build-Linux_$_arch.run" --target "$srcdir" \ + --nox11 --noexec &> /dev/null + + # Unpack bundled files + install -d "$pkgdir/$_installdir" + cd "$pkgdir/$_installdir" + tar -xjf "$srcdir/VirtualBox.tar.bz2" + + # Hardened build: Mark binaries suid root, create symlinks for working around + # unsupported $ORIGIN/.. in VBoxC.so and make sure the + # directory is only writable by the user (paranoid). + chmod 4511 VirtualBox VBox{SDL,Headless,NetDHCP,NetAdpCtl} + for _lib in VBox{VMM,REM,RT,DDU,XPCOM}.so; do + ln -sf "$_installdir/$_lib" "components/$_lib" + done + chmod go-w . + + # Replace VirtualBox built-in Qt by system Qt libraries (disabled as of + # 2010-03-26, 3.1.6-1) + #for _lib in libQt{Core,Gui,Network,OpenGL}; do + # rm "${_lib}VBox.so.4" + # ln -s "/usr/lib/${_lib}.so.4" "${_lib}VBox.so.4" + #done + + # Install the SDK + pushd 'sdk/installer' + VBOX_INSTALL_PATH="${_installdir}" python2 vboxapisetup.py install --root "${pkgdir}" + rm -r -f build + popd + + # Install udev rules + install -D -m 0644 "$srcdir/10-vboxdrv.rules" "$pkgdir/usr/lib/udev/rules.d/10-vboxdrv.rules" + # we need to move and not symlink VBoxCreateUSBNode.sh in /usr/lib/udev to avoid udevd + # to look /opt when /opt is not mounted. This can be done until VBoxCreateUSBNode.sh doesn't + # need more stuff from /opt + mv VBoxCreateUSBNode.sh "$pkgdir/usr/lib/udev/" + + # Install Fixusb script + install -D -m 0755 "$srcdir/VBoxFixUSB" VBoxFixUSB + + # Patch "vboxshell.py" to use Python 2.x instead of Python 3 + sed -i 's#/usr/bin/python#\02#' vboxshell.py + + # Update Arch initscripts way of life in VBox.sh + sed -i -e 's,sudo /etc/init.d/vboxdrv setup,/etc/rc.d/dkms start,g' \ + "$pkgdir/$_installdir/VBox.sh" + sed -i -e 's,sudo /etc/init.d/vboxdrv restart,/etc/rc.d/dkms start,g' \ + "$pkgdir/$_installdir/VBox.sh" + + # Install vboxweb initscript + install -D -m 0755 "$srcdir/vboxweb.rc" "$pkgdir/etc/rc.d/vboxweb" + install -D -m 0644 "$srcdir/vboxweb.conf" "$pkgdir/etc/conf.d/vboxweb" + + # Symlink the launchers. Second link can fail if fs is not case sensitive. + install -d -m 0755 "$pkgdir/usr/bin" + for _bin in VirtualBox VBox{Headless,Manage,SDL,SVC,Tunctl,NetAdpCtl,FixUSB} rdesktop-vrdp; do + ln -s "$_installdir/$_bin" "$pkgdir/usr/bin/$_bin" + ln -s "$_installdir/$_bin" "$pkgdir/usr/bin/${_bin,,}" &>/dev/null || : + done + + # Symlink the desktop icon and ".desktop" files + install -d -m 0755 "$pkgdir/usr/"{share/applications,share/pixmaps} + ln -s "$_installdir/VBox.png" "$pkgdir/usr/share/pixmaps/VBox.png" + ln -s "$_installdir/icons/128x128/virtualbox.png" "$pkgdir/usr/share/pixmaps/virtualbox.png" + ln -s "$_installdir/virtualbox.desktop" "$pkgdir/usr/share/applications/virtualbox.desktop" + + # Symlink mime info + install -d -m 0755 "$pkgdir/usr/share/mime/packages" + ln -s "$_installdir/virtualbox.xml" "$pkgdir/usr/share/mime/packages/virtualbox.xml" + + # Symlink doc + install -d -m 0755 "$pkgdir/usr/share/doc/$pkgname" + ln -s "$_installdir/VirtualBox.chm" "$pkgdir/usr/share/doc/$pkgname/virtualbox.chm" + + # Symlink module sources in /usr/src + install -d -m 0755 "$pkgdir/usr/src" + ln -s "$_installdir/src/vboxhost" "$pkgdir/usr/src/vboxhost-$pkgver" + + # Symlink icons + pushd icons + for _dir in *; do + cd "$_dir" + install -d -m 0755 "$pkgdir/usr/share/icons/hicolor/$_dir/"{apps,mimetypes} + for _icon in *; do + if [[ "$_icon" = 'virtualbox.png' ]]; then + ln -s "$_installdir/icons/$_dir/$_icon" "$pkgdir/usr/share/icons/hicolor/$_dir/apps/$_icon" + else + ln -s "$_installdir/icons/$_dir/$_icon" "$pkgdir/usr/share/icons/hicolor/$_dir/mimetypes/$_icon" + fi + done + cd - >/dev/null + done + popd + + # Write the configuration file + install -D -m 0644 /dev/null "$pkgdir/etc/vbox/vbox.cfg" + cat > "$pkgdir/etc/vbox/vbox.cfg" <<EOF +# VirtualBox installation directory" +INSTALL_DIR='$_installdir' + +# VirtualBox version +INSTALL_VER='$pkgver' +INSTALL_REV='$_build' +EOF + + # Register into DKMS + install -dm 755 "$pkgdir/var/lib/dkms/vboxhost/$pkgver" + ln -s '/opt/VirtualBox/src/vboxhost' "$pkgdir/var/lib/dkms/vboxhost/$pkgver/source" + +} + +# vim:set ts=2 sw=2 ft=sh et: + diff --git a/VBoxFixUSB b/VBoxFixUSB new file mode 100644 index 000000000000..f4c1ebe6f015 --- /dev/null +++ b/VBoxFixUSB @@ -0,0 +1,16 @@ +#!/bin/bash +# 2012: Seblu was here + +. /etc/vbox/vbox.cfg + +# Build our device tree +for i in /sys/bus/usb/devices/*; do + if test -r "$i/dev"; then + dev="`cat "$i/dev" 2> /dev/null`" + major="`expr "$dev" : '\(.*\):' 2> /dev/null`" + minor="`expr "$dev" : '.*:\(.*\)' 2> /dev/null`" + class="`cat $i/bDeviceClass 2> /dev/null`" + sh "$INSTALL_DIR/VBoxCreateUSBNode.sh" "$major" "$minor" "$class" 2>/dev/null + fi +done +# vim:set ts=2 sw=2 ft=sh et: diff --git a/install b/install new file mode 100644 index 000000000000..480a3fbabd2d --- /dev/null +++ b/install @@ -0,0 +1,87 @@ +#!/bin/bash + +update_databases() { + # Update mime database + type -P update-mime-database &>/dev/null && + update-mime-database /usr/share/mime &>/dev/null + + # Update xdg icon database + type -P xdg-icon-resource &>/dev/null && + xdg-icon-resource forceupdate --theme hicolor &>/dev/null + + # Update desktop database + type -P update-desktop-database &>/dev/null && + update-desktop-database -q &>/dev/null +} + +# arg 1: the new package version +post_install() { + # Add vboxusers group, GID 108 is reserved (http://wiki.archlinux.org/index.php/UID_and_GID_list), + getent group vboxusers &> /dev/null || groupadd -f -g 108 vboxusers + + # Load new udev rule for module vboxdrv + udevadm control --reload-rules + + # Update databases + update_databases + + # Show warnings + cat <<EOF + +==> Remember to add allowed users to the vboxusers group: +==> # gpasswd -a USERNAME vboxusers +== +==> To compile/load virtualbox modules automatically at startup you can add dkms in your DAEMONS +== +==> To build and install your modules run dkms autoinstall +EOF +} + +# arg 1: the new package version +# arg 2: the old package version +pre_upgrade() { + # should be $2... pacman is bugged FS#29371. + pre_remove "$2" + + # Remove any stuff remaining from the module compilation + rm -Rf "/opt/VirtualBox" +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install "$1" + (($(vercmp $2 '4.1.14-2') < 0 )) && cat <<EOF || true + +==> **Warning** +==> This version drop vboxdrv initscript. +==> Please change to dkms instead of vboxdrv in DAEMONS in rc.conf. +==> +EOF +} + +# arg 1: the old package version +pre_remove() { + # Stop running services + #[[ -x /etc/rc.d/vboxweb ]] && /etc/rc.d/vboxweb stop >/dev/null + + # Remove modules + [[ -n $1 ]] && dkms remove vboxhost/${1%-*} --all >/dev/null || true +} + +# arg 1: the old package version +post_remove() { + # Remove any stuff remaining from the module compilation + rm -Rf "/opt/VirtualBox" + + # Remove any run files + rm -Rf "/var/run/VirtualBox" + + # Update databases + update_databases + + # remove vboxusers group + groupdel vboxusers &>/dev/null || true +} + +# vim:set ts=2 sw=2 ft=sh et: diff --git a/vboxweb.conf b/vboxweb.conf new file mode 100644 index 000000000000..49d82d828ead --- /dev/null +++ b/vboxweb.conf @@ -0,0 +1,11 @@ +# WebService Mandatory Variables +#VBOXWEB_USER= + +# WebService Variables +#VBOXWEB_LOGFILE= +#$VBOXWEB_HOST= +#$VBOXWEB_PORT= +#$VBOXWEB_TIMEOUT= +#$VBOXWEB_CHECK_INTERVAL= +#$VBOXWEB_THREADS= +#$VBOXWEB_KEEPALIVE= diff --git a/vboxweb.rc b/vboxweb.rc new file mode 100644 index 000000000000..97273e3c7391 --- /dev/null +++ b/vboxweb.rc @@ -0,0 +1,86 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/vbox/vbox.cfg +. /etc/conf.d/vboxweb + +BINARY="$INSTALL_DIR/vboxwebsrv" + +start() { + stat_busy "Starting VirtualBox Web Service"; + if ! pidof -o %PPID $BINARY >/dev/null; then + [[ "$VBOXWEB_USER" ]] || stat_die + lsmod | grep -q "vboxdrv[^_-]" || stat_die + PARAMS="--background" + [[ "$VBOXWEB_HOST" ]] && PARAMS+=" -H $VBOXWEB_HOST" + [[ "$VBOXWEB_PORT" ]] && PARAMS+=" -p $VBOXWEB_PORT" + [[ "$VBOXWEB_TIMEOUT" ]] && PARAMS+=" -t $VBOXWEB_TIMEOUT" + [[ "$VBOXWEB_CHECK_INTERVAL" ]] && PARAMS+=" -i $VBOXWEB_CHECK_INTERVAL" + [[ "$VBOXWEB_THREADS" ]] && PARAMS+=" -T $VBOXWEB_THREADS" + [[ "$VBOXWEB_KEEPALIVE" ]] && PARAMS+=" -k $VBOXWEB_KEEPALIVE" + [[ "$VBOXWEB_LOGFILE" ]] && PARAMS+=" -F $VBOXWEB_LOGFILE" + # prevent inheriting this setting to VBoxSVC + unset VBOX_RELEASE_LOG_DEST + su - $VBOXWEB_USER -c "$BINARY $PARAMS" &>/dev/null + # ugly: wait until the final process has forked + sleep .2 + if pidof -o %PPID $BINARY >/dev/null; then + add_daemon vboxweb + stat_done + else + stat_die + fi + else + stat_die + fi +} + +stop() { + stat_busy "Stopping VirtualBox Web Service" + PID=$(pidof -o %PPID $BINARY) + [[ $PID ]] && kill $PID &>/dev/null + if ! pidof -o %PPID $BINARY >/dev/null; then + rm_daemon vboxweb + stat_done + else + stat_die + fi +} + +restart() { + stop && start +} + +status() { + stat_busy "Checking for VirtualBox Web Service" + if pidof -o %PPID $BINARY >/dev/null; then + stat_done + else + stat_fail + false + fi +} + +case "$1" in +start) + start + ;; +stop) + stop + ;; +restart) + restart + ;; +force-reload) + restart + ;; +status) + status + ;; +*) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 +esac + +# vim:set ts=2 sw=2 ft=sh et: |