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 mime database [[ -x =update-mime-database ]] && update-mime-database /usr/share/mime &>/dev/null # Update desktop database [[ -x =update-desktop-database ]] && update-desktop-database -q &>/dev/null # Build new module /usr/bin/vboxsetup setup # (Re-)Create USB nodes /usr/bin/vboxsetup fixusb # Show warnings /bin/cat < Remember to add allowed users to the vboxusers group: ==> # 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 } pre_upgrade() { pre_remove # Remove any stuff remaining from the module compilation rm -Rf "/opt/VirtualBox" } post_upgrade() { post_install } pre_remove() { # Stop running services _service="vboxweb.service" systemctl is-active ${_service} &>/dev/null if [[ "$?" -eq 0 ]]; then systemctl stop ${_service} fi systemctl is-enabled ${_service} &>/dev/null if [[ "$?" -eq 0 ]]; then systemctl disable ${_service} fi # Remove modules if [[ -f /usr/bin/vboxsetup ]]; then /usr/bin/vboxsetup remove else echo -e "\n==> Modules could not be deleted. Please check manually.\n" fi } post_remove() { # Remove any stuff remaining from the module compilation rm -Rf "/opt/VirtualBox" # Remove any run files rm -Rf "/var/run/VirtualBox" # Update mime database [[ -x =update-mime-database ]] && update-mime-database /usr/share/mime &>/dev/null # Update desktop database [[ -x =update-desktop-database ]] && update-desktop-database -q &>/dev/null # remove vboxusers group groupdel vboxusers &>/dev/null || true } # vim:set ts=2 sw=2 ft=sh et: