VirtualBox

source: vbox/trunk/src/VBox/Installer/freebsd/postinstall.sh@ 96686

Last change on this file since 96686 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1#!/bin/sh
2## @file
3#
4# VirtualBox postinstall script for FreeBSD.
5#
6
7#
8# Copyright (C) 2007-2022 Oracle and/or its affiliates.
9#
10# This file is part of VirtualBox base platform packages, as
11# available from https://www.virtualbox.org.
12#
13# This program is free software; you can redistribute it and/or
14# modify it under the terms of the GNU General Public License
15# as published by the Free Software Foundation, in version 3 of the
16# License.
17#
18# This program is distributed in the hope that it will be useful, but
19# WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21# General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, see <https://www.gnu.org/licenses>.
25#
26# SPDX-License-Identifier: GPL-3.0-only
27#
28
29PATH_TMP="/tmp"
30PATH_TMP_MODS="$PATH_TMP/vbox_mods"
31PATH_INST="/usr/local/lib/virtualbox"
32PATH_KERN_SRC="/usr/src/sys"
33FILE_VBOXDRV="$PATH_INST/vboxdrv.tar.gz"
34
35
36if [ ! -f $PATH_KERN_SRC/Makefile ]; then
37 echo "Kernel sources are not installed. Please install them and reinstall VirtualBox"
38 exit 1
39fi
40
41echo "Compiling kernel modules, please wait..."
42
43# Create temporary directory
44mkdir -p $PATH_TMP_MODS
45
46# Unpack archive
47tar -C $PATH_TMP_MODS -xf $FILE_VBOXDRV
48
49# Compile
50cd $PATH_TMP_MODS
51make
52
53# Check if we succeeded
54if [ $? != 0 ]; then
55 echo "Compiling kernel modules failed."
56 cd ..
57 rm -rf $PATH_TMP_MODS
58 exit 1
59fi
60
61# Copy the modules to /boot/kernel
62echo "Installing kernel modules to /boot/kernel, please wait..."
63cp $PATH_TMP_MODS/vboxdrv.ko /boot/kernel
64cp $PATH_TMP_MODS/vboxnetflt.ko /boot/kernel
65cp $PATH_TMP_MODS/vboxnetadp.ko /boot/kernel
66kldxref -R /boot
67
68# Load them now, unloading old modules
69make load
70
71if [ $? != 0 ]; then
72 echo "Loading kernel modules failed"
73 cd ..
74 rm -rf $PATH_TMP_MODS
75 exit 1
76fi
77
78echo "Kernel modules successfully installed."
79echo "To load them on every boot put them into /boot/loader.conf"
80
81# Cleanup
82cd ..
83rm -rf $PATH_TMP_MODS
84
85exit 0
86
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette