1 | # Oracle VM VirtualBox
|
---|
2 | # VirtualBox Linux post-installer common portions
|
---|
3 | #
|
---|
4 |
|
---|
5 | # Copyright (C) 2015 Oracle Corporation
|
---|
6 | #
|
---|
7 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
8 | # available from http://www.virtualbox.org. This file is free software;
|
---|
9 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
10 | # General Public License (GPL) as published by the Free Software
|
---|
11 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
12 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
13 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
14 |
|
---|
15 | # Put bits of the post-installation here which should work the same for all of
|
---|
16 | # the Linux installers. We do not use special helpers (e.g. dh_* on Debian),
|
---|
17 | # but that should not matter, as we know what those helpers actually do, and we
|
---|
18 | # have to work on those systems anyway when installed using the all
|
---|
19 | # distributions installer.
|
---|
20 | #
|
---|
21 | # We assume that all required files are in the same folder as this script
|
---|
22 | # (e.g. /opt/VirtualBox, /usr/lib/VirtualBox, the build output directory).
|
---|
23 |
|
---|
24 | # This is GNU-specific, sorry Solaris. It fails on directories ending in '\n'.
|
---|
25 | MY_PATH="$(dirname $(readlink -f -- "${0}"))"
|
---|
26 | cd "${MY_PATH}"
|
---|
27 | . "./routines.sh"
|
---|
28 |
|
---|
29 | START=true
|
---|
30 | TARGET="${MY_PATH}"
|
---|
31 | while test -n "${1}"; do
|
---|
32 | case "${1}" in
|
---|
33 | --nostart)
|
---|
34 | START=
|
---|
35 | ;;
|
---|
36 | *)
|
---|
37 | echo "Bad argument ${1}" >&2
|
---|
38 | exit 1
|
---|
39 | ;;
|
---|
40 | esac
|
---|
41 | shift
|
---|
42 | done
|
---|
43 |
|
---|
44 | # Remove any traces of DKMS from previous installations.
|
---|
45 | for i in vboxhost vboxdrv vboxnetflt vboxnetadp; do
|
---|
46 | rm -rf "/var/lib/dkms/${i}"*
|
---|
47 | done
|
---|
48 |
|
---|
49 | # Install runlevel scripts and systemd unit files
|
---|
50 | install_init_script "${TARGET}/vboxdrv.sh" vboxdrv
|
---|
51 | install_init_script "${TARGET}/vboxballoonctrl-service.sh" vboxballoonctrl-service
|
---|
52 | install_init_script "${TARGET}/vboxautostart-service.sh" vboxautostart-service
|
---|
53 | install_init_script "${TARGET}/vboxweb-service.sh" vboxweb-service
|
---|
54 |
|
---|
55 | delrunlevel vboxdrv
|
---|
56 | addrunlevel vboxdrv
|
---|
57 | delrunlevel vboxballoonctrl-service
|
---|
58 | addrunlevel vboxballoonctrl-service
|
---|
59 | delrunlevel vboxautostart-service
|
---|
60 | addrunlevel vboxautostart-service
|
---|
61 | delrunlevel vboxweb-service
|
---|
62 | addrunlevel vboxweb-service
|
---|
63 |
|
---|
64 | ln -sf "${MY_PATH}/postinst-common.sh" /sbin/vboxconfig
|
---|
65 |
|
---|
66 | test -n "${START}" &&
|
---|
67 | {
|
---|
68 | start_init_script vboxdrv
|
---|
69 | start_init_script vboxballoonctrl-service
|
---|
70 | start_init_script vboxautostart-service
|
---|
71 | start_init_script vboxweb-service
|
---|
72 | }
|
---|