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.
|
---|
25 | MY_PATH="$(dirname $(readlink -f -- "${0}"))/"
|
---|
26 | cd "${MY_PATH}"
|
---|
27 | . "./routines.sh"
|
---|
28 |
|
---|
29 | START=
|
---|
30 | TARGET=
|
---|
31 | for i in "$@"
|
---|
32 | do
|
---|
33 | case "${i}" in
|
---|
34 | --start)
|
---|
35 | START=true
|
---|
36 | ;;
|
---|
37 | *)
|
---|
38 | if test -z "${TARGET}" && test -d "${i}"; then
|
---|
39 | TARGET="${i}"
|
---|
40 | else
|
---|
41 | echo "Bad argument ${i}" >&2
|
---|
42 | exit 1
|
---|
43 | fi
|
---|
44 | ;;
|
---|
45 | esac
|
---|
46 | done
|
---|
47 |
|
---|
48 | if test -z "${TARGET}"; then
|
---|
49 | echo "$0: no installation target specified." >&2
|
---|
50 | exit 1
|
---|
51 | fi
|
---|
52 |
|
---|
53 | # Remove any traces of DKMS from previous installations.
|
---|
54 | for i in vboxhost vboxdrv vboxnetflt vboxnetadp; do
|
---|
55 | rm -rf "/var/lib/dkms/${i}"*
|
---|
56 | done
|
---|
57 |
|
---|
58 | # Install runlevel scripts and systemd unit files
|
---|
59 | install_init_script "${TARGET}/vboxdrv.sh" vboxdrv
|
---|
60 | install_init_script "${TARGET}/vboxballoonctrl-service.sh" vboxballoonctrl-service
|
---|
61 | install_init_script "${TARGET}/vboxautostart-service.sh" vboxautostart-service
|
---|
62 | install_init_script "${TARGET}/vboxweb-service.sh" vboxweb-service
|
---|
63 |
|
---|
64 | delrunlevel vboxdrv
|
---|
65 | addrunlevel vboxdrv
|
---|
66 | delrunlevel vboxballoonctrl-service
|
---|
67 | addrunlevel vboxballoonctrl-service
|
---|
68 | delrunlevel vboxautostart-service
|
---|
69 | addrunlevel vboxautostart-service
|
---|
70 | delrunlevel vboxweb-service
|
---|
71 | addrunlevel vboxweb-service
|
---|
72 |
|
---|
73 | test -n "${START}" &&
|
---|
74 | {
|
---|
75 | start_init_script vboxdrv
|
---|
76 | start_init_script vboxballoonctrl-service
|
---|
77 | start_init_script vboxautostart-service
|
---|
78 | start_init_script vboxweb-service
|
---|
79 | }
|
---|