virtualbox: added vboxusb service to generate usb devices

This commit is contained in:
Michael 2012-10-24 09:52:31 +00:00
parent 4982cfda8a
commit da22b99526
4 changed files with 63 additions and 16 deletions

View File

@ -14,14 +14,14 @@ pkgbase=virtualbox
pkgname=('virtualbox' 'virtualbox-ext-oracle' 'virtualbox-guest-additions')
pkgver=4.2.2
_build=81494
pkgrel=2
pkgrel=3
arch=('i686' 'x86_64')
url='http://virtualbox.org/'
license=('GPL2' 'custom:PUEL')
options=('!strip')
_sarch='x86'
[ "${CARCH}" = 'x86_64' ] && _sarch='amd64'
makedepends=('libidl2' 'libxcursor' 'libxinerama' 'libxslt' 'curl' 'linux-headers' 'python2' 'make' 'gcc')
source=("VirtualBox-${pkgver}-${_build}-Linux_${_sarch}.run::http://download.virtualbox.org/virtualbox/${pkgver}/VirtualBox-${pkgver}-${_build}-Linux_${_sarch}.run"
"http://download.virtualbox.org/virtualbox/${pkgver}/Oracle_VM_VirtualBox_Extension_Pack-${pkgver}-${_build}.vbox-extpack"
"http://download.virtualbox.org/virtualbox/${pkgver}/VBoxGuestAdditions_${pkgver}.iso"
@ -29,6 +29,7 @@ source=("VirtualBox-${pkgver}-${_build}-Linux_${_sarch}.run::http://download.vir
'vboxdrv.conf'
'vboxweb.conf'
'vboxweb.service'
'vboxusb.service'
'virtualbox.conf'
'vboxsetup.sh'
'PUEL'
@ -40,6 +41,7 @@ sha256sums=('a4d1d1f3047fb3e242338dbaa59d781b189d58021a04d29aac0a3f8ab7b54733'
'71740893a5f226f9d9fcc607ab9d39b7de816b2759625b34da19162bc7e579ff'
'12dbba3b59991f2b68cddeeeda20236aeff63e11b7e2d1b08d9d6a82225f6651'
'e6e875ef186578b53106d7f6af48e426cdaf1b4e86834f01696b8ef1c685787f'
'251750f41d334ef9871194b3407c2ee2c0330eac92849c6b5d30c46e5c72b765'
'9b3c4dc5385fb3b4aeb841043384879c5c7ee926f5343d6a4177e913604f869d'
'28833ef89fed96aa2cdb071c98687e8aa88e3c4c249b261f9b905e6621fa0e23'
'50658c653cde4dc43ba73a64c72761d2e996fd8e360fc682aa2844e1ad5b045f'
@ -101,7 +103,8 @@ package_virtualbox() {
# Install vboxweb initscript
install -D -m 0644 "${srcdir}/vboxweb.conf" "${pkgdir}/etc/conf.d/vboxweb"
install -D -m 0755 "${srcdir}/vboxweb.service" "${pkgdir}/usr/lib/systemd/system/vboxweb.service"
install -D -m 0644 "${srcdir}/vboxweb.service" "${pkgdir}/usr/lib/systemd/system/vboxweb.service"
install -D -m 0644 "${srcdir}/vboxusb.service" "${pkgdir}/usr/lib/systemd/system/vboxusb.service"
# Install udev rules
install -D -m 0644 "${srcdir}/10-vboxdrv.rules" "${pkgdir}/lib/udev/rules.d/10-vboxdrv.rules"

View File

@ -0,0 +1,11 @@
[Unit]
Description=Creates the required USB nodes for VirtualBox
Wants=local-fs.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/vboxsetup fixusb
[Install]
WantedBy=multi-user.target

View File

@ -1,21 +1,23 @@
created_rclocal=0
# arg 1: the new package version
post_install() {
vbox_create_workaround
created=0
# workaround: create /etc/rc.local, if not exists
if [ ! -e /etc/rc.local ]; then
touch /etc/rc.local
created=1
fi
# Run the VBoxLinuxAdditions Skript
/usr/share/virtualbox/guest-additions/VBoxLinuxAdditions.run
# If created, remove /etc/rc.local
if [ ${created} -eq 1 ]; then
rm -f /etc/rc.local
fi
# Remove rc.vbox* files
rm -f /etc/rc.d/rc.vbox*
vbox_remove_workaround
# Show information
/bin/cat <<EOF
==> To start virtualbox guest service automatically, enable and
==> start the service through systemctl:
==> sudo systemctl enable vboxservice.service
==> sudo systemctl start vboxservice.service
EOF
}
# arg 1: the new package version
@ -24,6 +26,33 @@ post_upgrade() {
post_install "$1"
}
# arg 1: the old package version
post_remove() {
# ${1%-*} : version without pkgrel (4.2.2)
vbox_create_workaround
/opt/VBoxGuestAdditions-${1%-*}/uninstall.sh
vbox_remove_workaround
groupdel vboxsf >/dev/null 2>&1 || true
}
# Create rc.local file as workaround
vbox_create_workaround() {
# workaround: create /etc/rc.local, if not exists
if [ ! -e /etc/rc.local ]; then
touch /etc/rc.local
created_rclocal=1
fi
}
# Remove rc.local, if we created this file
vbox_remove_workaround() {
# If created_rclocal, remove /etc/rc.local
if [ ${created_rclocal} -eq 1 ]; then
rm -f /etc/rc.local
fi
# Remove rc.vbox* files
rm -f /etc/rc.d/rc.vbox*
}

View File

@ -13,7 +13,10 @@ post_install() {
# Build new module
/usr/bin/vboxsetup setup
# (Re-)Create USB nodes
/usr/bin/vboxsetup fixusb
# Show warnings
/bin/cat <<EOF
@ -21,6 +24,7 @@ post_install() {
==> # gpasswd -a USERNAME vboxusers
==>
==> To start virtualbox web service automatically you need to enable and start the service through systemctl
==> To create missing USB devices, you can enable vboxusb.service by running 'systemctl enable vboxusb.service'
==> To fix missing usb devices, you can call 'vboxsetup fixusb' or reboot your computer
==>
EOF