desktop/virtualbox/virtualbox.install

73 lines
1.9 KiB
Plaintext
Raw Normal View History

2011-08-18 07:56:18 +08:00
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
2012-09-16 02:18:07 +08:00
/usr/bin/vboxsetup setup
2011-08-18 07:56:18 +08:00
# Show warnings
/bin/cat <<EOF
==> Remember to add allowed users to the vboxusers group:
==> # gpasswd -a USERNAME vboxusers
==>
2012-09-16 02:18:07 +08:00
==> To load virtualbox modules automatically you can add vboxdrv to a file /etc/modules-load.d/vbox.conf
==> To start virtualbox web service automatically you can add vboxweb to this file, too
2011-08-18 07:56:18 +08:00
==>
2012-09-16 02:18:07 +08:00
==> To fix missing usb devices, you can call 'vboxsetup fixusb' or reboot your computer
2011-08-18 07:56:18 +08:00
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
2012-09-16 02:18:07 +08:00
_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
2011-08-18 07:56:18 +08:00
# Remove modules
2012-09-16 02:18:07 +08:00
/usr/bin/vboxsetup remove
2011-08-18 07:56:18 +08:00
}
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
}