updated on Wed Jan 11 16:09:51 UTC 2012
[aur-mirror.git] / virtualbox_bin-3 / virtualbox.install
blobde9dcb6b2a702454be2b8b6ba4676059f121a30a
1 # $1: The new package version
2 post_install() {
3   # Build new module
4   /etc/rc.d/vboxdrv setup
6   # Add vboxusers group, GID 108 is reserved (http://wiki.archlinux.org/index.php/UID_and_GID_list),
7   # but in some systems it may be being used - please replace if needed.
8   groupadd -f -g 108 vboxusers
10   # Create the directory below if it doesn't exist
11   mkdir -p "/var/run/VirtualBox"
13   # Load new udev rule for module vboxdrv
14   udevadm control --reload-rules
16   # Show the license
17   echo >&2
18   echo '==> You must agree to the following license in order to use this program:' >&2
19   echo '------------------------------------------------------------------------' >&2
20   echo >&2
21   cat "/opt/VirtualBox/LICENSE" >&2
22   echo >&2
23   echo '------------------------------------------------------------------------' >&2
25   /bin/cat <<EOF
27 ==> Add your user to the vboxusers group:
28 ==> # gpasswd -a USERNAME vboxusers
29 ==>
30 ==> You must load vboxdrv module before starting VirtualBox:
31 ==> # modprobe vboxdrv
32 ==>
33 ==> You must load vboxnetflt for Host Interface Networking:
34 ==> # modprobe vboxnetflt
35 ==>
36 ==> You must load vboxnetadp for Host-Only networking:
37 ==> # modprobe vboxnetadp
38 ==>
39 ==> To load it automatically, add vboxdrv module to the "MODULES" array
40 ==> "/etc/rc.conf".
41 ==>
42 ==> Run \`/etc/rc.d/vboxdrv setup\` as root every time your kernel is
43 ==> upgraded, to compile the module for the new kernel version.
44 ==>
45 ==> If USB does not work for you out-of-the-box, add the following line
46 ==> to "/etc/fstab":
47 ==> "none /proc/bus/usb usbfs auto,busgid=108,busmode=0775,devgid=108,devmode=0664 0 0"
49 EOF
52 # $1: The new package version
53 # $2: The old package version
54 post_upgrade() {
55   _NEWVERSION=`echo $1 | cut -f-1 -d '-'`
56   _OLDVERSION=`echo $2 | cut -f-1 -d '-'`
58   # Remove any stuff (e.g. module compilation files) from an old installation - old versions used
59   # to use these directories.
60   if [ "$_NEWVERSION" != "$_OLDVERSION" ]; then
61     rm -Rf "/opt/VirtualBox-${_OLDVERSION}" &> /dev/null
62   fi
63   if [ "$1" != "$2" ]; then
64     rm -Rf "/opt/virtualbox" &> /dev/null
65   fi
66   
67   # Build new module
68   /etc/rc.d/vboxdrv setup
70   # Create the directory below if it doesn't exist
71   mkdir -p "/var/run/VirtualBox"
73   /bin/cat <<EOF
75 ==> You must load vboxdrv module before starting VirtualBox:
76 ==> # modprobe vboxdrv
77 ==>
78 ==> You must load vboxnetflt for Host Interface Networking:
79 ==> # modprobe vboxnetflt
80 ==>
81 ==> You must load vboxnetadp for Host-Only networking:
82 ==> # modprobe vboxnetadp
83 ==>
84 ==> To load it automatically, add vboxdrv module to the "MODULES" array
85 ==> "/etc/rc.conf".
86 ==>
87 ==> Run \`/etc/rc.d/vboxdrv setup\` as root every time your kernel is
88 ==> upgraded, to compile the module for the new kernel version.
89 ==>
90 ==> If USB does not work for you out-of-the-box, add the following line
91 ==> to "/etc/fstab":
92 ==> "none /proc/bus/usb usbfs auto,busgid=108,busmode=0775,devgid=108,devmode=0664 0 0"
94 EOF
96   if [ "`vercmp $_OLDVERSION 3.2.2`" -lt 0 ]; then
97     /bin/cat <<EOF
98 ==> IMPORTANT: This package now uses \`/etc/rc.d/vboxdrv setup\` instead
99 ==>            of the old "vbox_build_module" script.
102   fi
105 # $1: The old package version
106 pre_remove() {
107   # Unload modules (if any)
108   for _mod in vbox{drv,netadp,netflt}; do
109     modprobe -r $_mod &> /dev/null
110   done
112   # Remove the module files
113   rm -f "/lib/modules/`uname -r`/misc/"{vboxdrv,vboxnetadp,vboxnetflt}.ko
115   # Remove any stuff remaining from the module compilation
116   rm -Rf "/opt/VirtualBox"