summaryrefslogtreecommitdiffstats
path: root/virtualbox_bin/vbox.install
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-05-24 22:02:28 +0200
committerFlorian Pritz <bluewind@xssn.at>2010-05-24 22:03:10 +0200
commit76b5704f46d3e59e41ed5883d23dd0d4aa818f4c (patch)
treea5adf840adb3093276c1fcf6b27135cecd935462 /virtualbox_bin/vbox.install
parentb37bf77aa7e3354edc3831f7c9038d77da00fec2 (diff)
downloadaur-packages-76b5704f46d3e59e41ed5883d23dd0d4aa818f4c.tar.gz
aur-packages-76b5704f46d3e59e41ed5883d23dd0d4aa818f4c.tar.xz
updates
Signed-off-by: Florian Pritz <bluewind@xssn.at>
Diffstat (limited to 'virtualbox_bin/vbox.install')
-rw-r--r--virtualbox_bin/vbox.install102
1 files changed, 102 insertions, 0 deletions
diff --git a/virtualbox_bin/vbox.install b/virtualbox_bin/vbox.install
new file mode 100644
index 0000000..c4615db
--- /dev/null
+++ b/virtualbox_bin/vbox.install
@@ -0,0 +1,102 @@
+_install_notes() {
+ echo
+ echo '---------------------------------------------------------------------------'
+ echo ' IMPORTANT NOTES:'
+ echo
+ echo '- Run "vbox_build_module" as root every time your kernel is upgraded, to'
+ echo ' compile the module for the new kernel version.'
+ echo '- Add your user to the vboxusers group:'
+ echo ' gpasswd -a USERNAME vboxusers'
+ echo '- Add "vboxdrv" to the MODULES array in your "/etc/rc.conf"'
+ echo '- Add "vboxnetflt" to MODULES if you want Host Interface networking.'
+ echo '- Add "vboxnetadp" to MODULES if you want Host-Only networking.'
+ echo '- If USB does not work for you out-of-the-box, add the following line'
+ echo ' to "/etc/fstab":'
+ echo ' none /proc/bus/usb usbfs auto,busgid=108,busmode=0775,devgid=108,devmode=0664 0 0'
+ echo "---------------------------------------------------------------------------"
+}
+
+# $1: The new package version
+post_install() {
+ # Unload modules (if any).
+ for i in vboxdrv vboxnetadp vboxnetflt; do
+ modprobe -r $i &>/dev/null
+ done
+
+ # Build new module
+ echo "Building VirtualBox modules..."
+ /usr/bin/vbox_build_module &>/dev/null
+
+ # Add vboxusers group
+ #
+ # This GID 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
+ cat /opt/VirtualBox/LICENSE >&2
+ echo >&2
+ echo '---------------------------------------------------------------------------' >&2
+
+ # Load the new module
+ modprobe vboxdrv
+
+ _install_notes
+}
+
+# $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 '-'`
+
+ # Unload modules (if any).
+ for i in vboxdrv vboxnetadp vboxnetflt; do
+ modprobe -r $i &>/dev/null
+ done
+
+ # Remove any stuff (eg. 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
+
+ # Create the directory below if it doesn't exist
+ mkdir -p /var/run/VirtualBox
+
+ # Build new module
+ echo "Building VirtualBox modules..."
+ /usr/bin/vbox_build_module &>/dev/null
+
+ # Load the new module
+ modprobe vboxdrv
+
+ _install_notes
+}
+
+# $1: The old package version
+pre_remove() {
+ # Unload modules (if any).
+ for i in vboxdrv vboxnetadp vboxnetflt; do
+ modprobe -r $i &>/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"
+}
+