1 | #!/bin/bash
|
---|
2 | ## @file
|
---|
3 | # Post installation script template for redhat-like distros.
|
---|
4 | #
|
---|
5 | # This script expects to be running chroot'ed into /target.
|
---|
6 | #
|
---|
7 |
|
---|
8 | #
|
---|
9 | # Copyright (C) 2017 Oracle Corporation
|
---|
10 | #
|
---|
11 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | # available from http://www.virtualbox.org. This file is free software;
|
---|
13 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | # General Public License (GPL) as published by the Free Software
|
---|
15 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | #
|
---|
19 |
|
---|
20 | MY_LOGFILE="/var/log/vboxpostinstall.log"
|
---|
21 | MY_EXITCODE=0
|
---|
22 |
|
---|
23 | # Logs execution of a command.
|
---|
24 | log_command()
|
---|
25 | {
|
---|
26 | echo "Executing: $*" >> "${MY_LOGFILE}"
|
---|
27 | "$@" 2>&1 | tee -a "${MY_LOGFILE}"
|
---|
28 | if [ "${PIPESTATUS[0]}" != "0" ]; then
|
---|
29 | echo "exit code: ${PIPESTATUS[0]}"
|
---|
30 | MY_EXITCODE=1;
|
---|
31 | fi
|
---|
32 | }
|
---|
33 |
|
---|
34 |
|
---|
35 | echo "Started: $*" >> "${MY_LOGFILE}"
|
---|
36 | echo "Date: `date -R`" >> "${MY_LOGFILE}"
|
---|
37 |
|
---|
38 | #echo ''
|
---|
39 | #echo 'Installing packages for building kernel modules...'
|
---|
40 | #log_command apt-get -y install build-essential
|
---|
41 | #log_command apt-get -y install linux-headers-$(uname -r)
|
---|
42 | #
|
---|
43 |
|
---|
44 | @@VBOX_COND_IS_INSTALLING_ADDITIONS@@
|
---|
45 | echo ''
|
---|
46 | echo 'Installing VirtualBox Guest Additions...'
|
---|
47 | ## @todo fix this
|
---|
48 | log_command /bin/bash /cdrom/VBoxAdditions/VBoxLinuxAdditions.run
|
---|
49 | log_command usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@"
|
---|
50 | @@VBOX_COND_END@@
|
---|
51 |
|
---|
52 | @@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
|
---|
53 | echo ''
|
---|
54 | echo 'Installing Test Execution Service...'
|
---|
55 | ## @todo fix this
|
---|
56 | @@VBOX_COND_END@@
|
---|
57 |
|
---|
58 | echo "Final exit code: ${MY_EXITCODE}" >> "${MY_LOGFILE}"
|
---|
59 | exit ${MY_EXITCODE}
|
---|
60 |
|
---|