Commit fd7fe4f8 authored by Seblu's avatar Seblu
Browse files

add virtualbox_bin package

add patch to kernel


git-svn-id: https://seblu.net/s/archpkg@31 02741741-5192-46b8-8916-7152b19231d9
parent 42f96305
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
--- a/drivers/acpi/battery.c	2010-12-16 02:24:48.000000000 +0100
+++ b/drivers/acpi/battery.c	2010-12-19 14:19:32.754717869 +0100
@@ -186,14 +186,15 @@
 	int ret = 0;
 	struct acpi_battery *battery = to_acpi_battery(psy);
 
-	if (acpi_battery_update(battery))
-		return -ENODEV;
-
 	if (acpi_battery_present(battery)) {
-		/* run battery update only if it is present */
-		acpi_battery_get_state(battery);
+	
+    	/* run battery update only if it is present */
+	    if (acpi_battery_update(battery))
+		    return -ENODEV;
+
 	} else if (psp != POWER_SUPPLY_PROP_PRESENT)
 		return -ENODEV;
+
 	switch (psp) {
 	case POWER_SUPPLY_PROP_STATUS:
 		if (battery->state & 0x01)
+3 −0
Original line number Diff line number Diff line
KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"
SUBSYSTEM=="usb_device", GROUP="vboxusers", MODE="0664"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vboxusers", MODE="0664"
+108 −0
Original line number Diff line number Diff line
# Maintainer: 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>

pkgname=virtualbox_bin
pkgver=4.0.0
_build=69151
pkgrel=1
pkgdesc='Oracle VirtualBox Binary Edition'
arch=('i686' 'x86_64')
url='http://virtualbox.org'
license=('GPL2')
depends=('libidl2' 'libxcursor' 'libxinerama' 'libxslt' 'curl' 'gcc' 'make' 'kernel26-headers' 'python2')
optdepends=('virtualbox-ext-oracle: for Oracle extensions'
            'qt: for GUI support'
            'sdl: for VBoxSDL and GUI support'
            'mesa: for OpenGL support'
            'libgl: for shared OpenGL support'
            'libxt: for shared clipboard support'
            'alsa-lib: for ALSA support'
            'pulseaudio: for PulseAudio support')
provides=("virtualbox=${pkgver}")
conflicts=('virtualbox' 'virtualbox-modules')
backup=('etc/vbox/vbox.cfg')
install='virtualbox.install'
_arch='x86'
[ "${CARCH}" = 'x86_64' ] && _arch='amd64'
source=("VirtualBox-${pkgver}-${_build}-Linux_${_arch}.run::http://download.virtualbox.org/virtualbox/${pkgver}/VirtualBox-${pkgver}-${_build}-Linux_${_arch}.run"
        '10-vboxdrv.rules'
        'vboxdrv')
md5sums=('b69839d355c5c532988380f81e7c51a4'
         '98859bfca9ef2ebf2ea43eb9123316fc'
         '8b3b5fb34d5e8594ee873d7947f3d09b')
[ "${CARCH}" = 'x86_64' ] && md5sums[0]='7a82f89abea6757231c02b42b5db90a3'

build() {
  # 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}/opt/VirtualBox"
  cd "${pkgdir}/opt/VirtualBox"
  tar -xjf "${srcdir}/VirtualBox.tar.bz2"

  install -d "${pkgdir}/usr/"{bin,share/applications,share/pixmaps}

  # 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}
  for _lib in VBox{VMM,REM,RT,DDU,XPCOM}.so; do
    ln -sf "/opt/VirtualBox/${_lib}" "components/${_lib}"
  done
  chmod go-w .

  # VBoxNetAdpCtl needs to be suid root in any case
  chmod 4511 VBoxNetAdpCtl

  # 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

  # Patch "vboxshell.py" to use Python 2.x instead of Python 3
  sed -i 's#/usr/bin/python#\02#' "${pkgdir}/opt/VirtualBox/vboxshell.py"

  # Install the SDK
  cd "${pkgdir}/opt/VirtualBox/sdk/installer"
  VBOX_INSTALL_PATH="/opt/VirtualBox" python2 vboxapisetup.py install --root "${pkgdir}"
  rm -Rf build
  cd "${pkgdir}/opt/VirtualBox"

  # Install rc.d script for module compilation
  install -Dm0755 "${srcdir}/vboxdrv" "${pkgdir}/etc/rc.d/vboxdrv"

  # Replace init script stuff
  sed -i -e 's,sudo /etc/init.d/vboxdrv setup,/etc/rc.d/vboxdrv setup,g' \
    "${pkgdir}/opt/VirtualBox/VBox.sh"
  sed -i -e 's,sudo /etc/init.d/vboxdrv restart,modprobe vboxdrv,g' \
    "${pkgdir}/opt/VirtualBox/VBox.sh"

  # Install udev rules
  install -Dm0644 "${srcdir}/10-vboxdrv.rules" "${pkgdir}/lib/udev/rules.d/10-vboxdrv.rules"

  # Symlink the launchers
  for _bin in VirtualBox VBox{Headless,Manage,SDL,SVC,Tunctl,NetAdpCtl} rdesktop-vrdp; do
    ln -s "/opt/VirtualBox/${_bin}" "${pkgdir}/usr/bin/${_bin}"
  done

  # Symlink the desktop icon and ".desktop" files
  ln -s /opt/VirtualBox/VBox.png "${pkgdir}/usr/share/pixmaps/VBox.png"
  ln -s /opt/VirtualBox/virtualbox.desktop "${pkgdir}/usr/share/applications/VirtualBox.desktop"

  # Symlink the license
  install -d "${pkgdir}/usr/share/licenses/${pkgname}"
  ln -s /opt/VirtualBox/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/PUEL"

  # Setup configuration
  install -d "${pkgdir}/etc/vbox"
  echo 'INSTALL_DIR="/opt/VirtualBox"' > "${pkgdir}/etc/vbox/vbox.cfg"
}

virtualbox_bin/vboxdrv

0 → 100644
+80 −0
Original line number Diff line number Diff line
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/vbox/vbox.cfg

MODLIST=()
LOG="/var/log/vbox-install.log"

if [ -n "$INSTALL_DIR" ]; then
  VBOXMANAGE="$INSTALL_DIR/VBoxManage"
  BUILDVBOXDRV="$INSTALL_DIR/src/vboxhost/vboxdrv/build_in_tmp"
  BUILDVBOXNETFLT="$INSTALL_DIR/src/vboxhost/vboxnetflt/build_in_tmp"
  BUILDVBOXNETADP="$INSTALL_DIR/src/vboxhost/vboxnetadp/build_in_tmp"
else
  echo "missing vbox.cfg"
  exit 0
fi

case "$1" in
  setup)
    stat_busy "Unloading VirtualBox kernel modules"
    for module in vbox{netflt,netadp,drv}; do
      if grep -q "^${module}" /proc/modules; then
        MODLIST+=($module)
        modprobe -r $module
      fi
    done
    stat_done
    for p in /lib/modules/*; do
      if [ ! -d "$p/kernel" ]; then
        if [ -e "$p/misc/vboxdrv.ko" ]; then
          stat_busy "Removing old VirtualBox kernel modules from $p"
          rm -f "$p/misc/vbox"{drv,netadp,netflt}.ko 2>/dev/null
          rmdir -p --ignore-fail-on-non-empty "$p/misc/" 2>/dev/null
          stat_done
        fi
      fi
    done
    if find /lib/modules/`uname -r` -name "vboxnetadp\.*" 2>/dev/null|grep -q vboxnetadp; then
      stat_busy "Removing old VirtualBox netadp kernel module"
      find /lib/modules/`uname -r` -name "vboxnetadp\.*" 2>/dev/null|xargs rm -f 2>/dev/null
      stat_done
    fi
    if find /lib/modules/`uname -r` -name "vboxnetflt\.*" 2>/dev/null|grep -q vboxnetflt; then
      stat_busy "Removing old VirtualBox netflt kernel module"
      find /lib/modules/`uname -r` -name "vboxnetflt\.*" 2>/dev/null|xargs rm -f 2>/dev/null
      stat_done
    fi
    if find /lib/modules/`uname -r` -name "vboxdrv\.*" 2>/dev/null|grep -q vboxdrv; then
      stat_busy "Removing old VirtualBox kernel module"
      find /lib/modules/`uname -r` -name "vboxdrv\.*" 2>/dev/null|xargs rm -f 2>/dev/null
      stat_done
    fi
    stat_busy "Recompiling VirtualBox kernel modules"
    if ! $BUILDVBOXDRV \
      --save-module-symvers /tmp/vboxdrv-Module.symvers \
      --no-print-directory install > $LOG 2>&1; then
      echo  "Look at $LOG to find out what went wrong"
    fi
    if ! $BUILDVBOXNETFLT \
      --use-module-symvers /tmp/vboxdrv-Module.symvers \
      --no-print-directory install >> $LOG 2>&1; then
      echo "Look at $LOG to find out what went wrong"
    fi
    if ! $BUILDVBOXNETADP \
      --use-module-symvers /tmp/vboxdrv-Module.symvers \
      --no-print-directory install >> $LOG 2>&1; then
      echo "Look at $LOG to find out what went wrong"
    fi
    stat_done
    stat_busy "Reloading VirtualBox kernel modules"
    for module in "${MODLIST[@]}"; do
      modprobe $module
    done
    stat_done
    ;;
  *)
    echo "usage: $0 {setup}"
esac
+118 −0
Original line number Diff line number Diff line
# $1: The new package version
post_install() {
  # Build new module
  /etc/rc.d/vboxdrv setup

  # Add vboxusers group, GID 108 is reserved (http://wiki.archlinux.org/index.php/UID_and_GID_list),
  # but in some systems it may be being used - please replace if needed.
  groupadd -f -g 108 vboxusers

  # Create the directory below if it doesn't exist
  mkdir -p "/var/run/VirtualBox"

  # Load new udev rule for module vboxdrv
  udevadm control --reload-rules

  # Show the license
  echo >&2
  echo '==> You must agree to the following license in order to use this program:' >&2
  echo '------------------------------------------------------------------------' >&2
  echo >&2
  cat "/opt/VirtualBox/LICENSE" >&2
  echo >&2
  echo '------------------------------------------------------------------------' >&2

  /bin/cat <<EOF

==> Add your user to the vboxusers group:
==> # gpasswd -a USERNAME vboxusers
==>
==> You must load vboxdrv module before starting VirtualBox:
==> # modprobe vboxdrv
==>
==> You must load vboxnetflt for Host Interface Networking:
==> # modprobe vboxnetflt
==>
==> You must load vboxnetadp for Host-Only networking:
==> # modprobe vboxnetadp
==>
==> To load it automatically, add vboxdrv module to the "MODULES" array
==> "/etc/rc.conf".
==>
==> Run \`/etc/rc.d/vboxdrv setup\` as root every time your kernel is
==> upgraded, to compile the module for the new kernel version.
==>
==> If USB does not work for you out-of-the-box, add the following line
==> to "/etc/fstab":
==> "none /proc/bus/usb usbfs auto,busgid=108,busmode=0775,devgid=108,devmode=0664 0 0"

EOF
}

# $1: The new package version
# $2: The old package version
post_upgrade() {
  _NEWVERSION=`echo $1 | cut -f-1 -d '-'`
  _OLDVERSION=`echo $2 | cut -f-1 -d '-'`

  # Remove any stuff (e.g. module compilation files) from an old installation - old versions used
  # to use these directories.
  if [ "$_NEWVERSION" != "$_OLDVERSION" ]; then
    rm -Rf "/opt/VirtualBox-${_OLDVERSION}" &> /dev/null
  fi
  if [ "$1" != "$2" ]; then
    rm -Rf "/opt/virtualbox" &> /dev/null
  fi
  
  # Build new module
  /etc/rc.d/vboxdrv setup

  # Create the directory below if it doesn't exist
  mkdir -p "/var/run/VirtualBox"

  /bin/cat <<EOF

==> You must load vboxdrv module before starting VirtualBox:
==> # modprobe vboxdrv
==>
==> You must load vboxnetflt for Host Interface Networking:
==> # modprobe vboxnetflt
==>
==> You must load vboxnetadp for Host-Only networking:
==> # modprobe vboxnetadp
==>
==> To load it automatically, add vboxdrv module to the "MODULES" array
==> "/etc/rc.conf".
==>
==> Run \`/etc/rc.d/vboxdrv setup\` as root every time your kernel is
==> upgraded, to compile the module for the new kernel version.
==>
==> If USB does not work for you out-of-the-box, add the following line
==> to "/etc/fstab":
==> "none /proc/bus/usb usbfs auto,busgid=108,busmode=0775,devgid=108,devmode=0664 0 0"

EOF

  if [ "`vercmp $_OLDVERSION 3.2.2`" -lt 0 ]; then
    /bin/cat <<EOF
==> IMPORTANT: This package now uses \`/etc/rc.d/vboxdrv setup\` instead
==>            of the old "vbox_build_module" script.

EOF
  fi
}

# $1: The old package version
pre_remove() {
  # Unload modules (if any)
  for _mod in vbox{drv,netadp,netflt}; do
    modprobe -r $_mod &> /dev/null
  done

  # Remove the module files
  rm -f "/lib/modules/`uname -r`/misc/"{vboxdrv,vboxnetadp,vboxnetflt}.ko

  # Remove any stuff remaining from the module compilation
  rm -Rf "/opt/VirtualBox"
}