updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / virtualbox-bin / install
blob29f08e0e9223852f202cf49a0d04feee48471258
1 #!/bin/bash
3 update_databases() {
4 # Update mime database
5 [[ -x /usr/bin/update-mime-database ]] &&
6 /usr/bin/update-mime-database /usr/share/mime &>/dev/null
8 # Update xdg icon database
9 [[ -x /usr/bin/xdg-icon-resource ]] &&
10 /usr/bin/xdg-icon-resource forceupdate --theme hicolor &>/dev/null
12 # Update desktop database
13 [[ -x /usr/bin/update-desktop-database ]] &&
14 /usr/bin/update-desktop-database -q &>/dev/null
17 post_install() {
18 # Add vboxusers group, GID 108 is reserved (http://wiki.archlinux.org/index.php/UID_and_GID_list),
19 getent group vboxusers &> /dev/null || groupadd -f -g 108 vboxusers
21 # Load new udev rule for module vboxdrv
22 udevadm control --reload-rules
24 # Update databases
25 update_databases
27 # Build new module
28 #/etc/rc.d/vboxdrv setup
30 # Show warnings
31 /bin/cat <<EOF
33 ==> Remember to add allowed users to the vboxusers group:
34 ==> # gpasswd -a USERNAME vboxusers
35 ==>
36 ==> To load virtualbox modules automatically you can add vboxdrv in your DAEMONS
37 ==> To start virtualbox web service automatically you can add vboxweb in your DAEMONS
38 ==>
39 ==> To fix missing usb devices, you can call rc.d fixusb vboxdrv or reboot your computer
40 EOF
43 pre_upgrade() {
44 pre_remove
46 # Remove any stuff remaining from the module compilation
47 rm -Rf "/opt/VirtualBox"
50 post_upgrade() {
51 post_install
54 pre_remove() {
55 # Stop running services
56 [[ -x /etc/rc.d/vboxdrv ]] && /etc/rc.d/vboxdrv stop
57 [[ -x /etc/rc.d/vboxweb ]] && /etc/rc.d/vboxweb stop
59 # Remove modules
60 [[ -x /etc/rc.d/vboxdrv ]] && /etc/rc.d/vboxdrv remove
63 post_remove() {
64 # Remove any stuff remaining from the module compilation
65 rm -Rf "/opt/VirtualBox"
67 # Remove any run files
68 rm -Rf "/var/run/VirtualBox"
70 # Update databases
71 update_databases
73 # remove vboxusers group
74 groupdel vboxusers &>/dev/null || true
77 # vim:set ts=2 sw=2 ft=sh et: