VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/linux/loadall.sh@ 104448

Last change on this file since 104448 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1#!/bin/bash
2## @file
3# For development, builds and loads all the host drivers.
4#
5
6#
7# Copyright (C) 2010-2023 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# The contents of this file may alternatively be used under the terms
26# of the Common Development and Distribution License Version 1.0
27# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28# in the VirtualBox distribution, in which case the provisions of the
29# CDDL are applicable instead of those of the GPL.
30#
31# You may elect to license modified versions of this file under the
32# terms and conditions of either the GPL or the CDDL or both.
33#
34# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35#
36
37TARGET=`readlink -e -- "${0}"` || exit 1 # The GNU-specific way.
38MY_DIR="${TARGET%/[!/]*}"
39MY_GROUPNAME="vboxusers"
40
41#
42# vboxusers membership check.
43#
44if ! (id -Gn | grep -w ${MY_GROUPNAME}); then
45 echo "loadall.sh: you're not a member of vboxusers...";
46 # Create the group.
47 if ! getent group ${MY_GROUPNAME}; then
48 set -e
49 sudo groupadd -r -f ${MY_GROUPNAME}
50 set +e
51 fi
52 # Add ourselves.
53 MY_USER=`id -un`
54 if [ -z "${MY_USER}" ]; then echo "loadall.sh: cannot figure user name"; exit 1; fi
55 sudo usermod -a -G ${MY_GROUPNAME} "${MY_USER}";
56
57 # Require relogon.
58 echo "loadall.sh: You must log on again to load the new group membership."
59 exit 1
60fi
61
62#
63# Normal action.
64#
65if [ ${#} -eq 0 ]; then
66 if [ -f "${MY_DIR}/src/vboxdrv/vboxdrv.ko" ]; then
67 echo "Cleaning build folder."
68 make -C "${MY_DIR}/src" clean > /dev/null
69 fi
70 sudo "${MY_DIR}/vboxdrv.sh" setup
71
72#
73# Unload and clean up when '-u' is given.
74#
75elif [ ${#} -eq 1 -a "x${1}" = x-u ]; then
76 sudo "${MY_DIR}/vboxdrv.sh" cleanup
77
78#
79# Invalid syntax.
80#
81else
82 echo "Usage: loadall.sh [-u]"
83 exit 1
84fi
85
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