VirtualBox

source: vbox/trunk/src/VBox/Additions/solaris/SharedFolders/loadfs.sh

Last change on this file was 106061, checked in by vboxsync, 2 months 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.6 KB
Line 
1#!/bin/bash
2# $Id: loadfs.sh 106061 2024-09-16 14:03:52Z vboxsync $
3## @file
4# For GA development.
5#
6
7#
8# Copyright (C) 2006-2024 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# The contents of this file may alternatively be used under the terms
27# of the Common Development and Distribution License Version 1.0
28# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
29# in the VirtualBox distribution, in which case the provisions of the
30# CDDL are applicable instead of those of the GPL.
31#
32# You may elect to license modified versions of this file under the
33# terms and conditions of either the GPL or the CDDL or both.
34#
35# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
36#
37
38DRVNAME="vboxfs"
39MOUNTHLP="vboxfsmount"
40
41DRVFILE=`dirname "$0"`
42DRVFILE=`cd "$DRVFILE" && pwd`
43MOUNTHLPFILE="$DRVFILE/$MOUNTHLP"
44DRVFILE="$DRVFILE/$DRVNAME"
45if [ ! -f "$DRVFILE" ]; then
46 echo "loadfs.sh: Cannot find $DRVFILE or it's not a file..."
47 exit 1;
48fi
49if [ ! -f "$MOUNTHLPFILE" ]; then
50 echo "load.sh: Cannot find $MOUNTHLPFILE or it's not a file..."
51 exit 1;
52fi
53
54SUDO=sudo
55#set -x
56
57# Unload the driver if loaded.
58for drv in $DRVNAME;
59do
60 LOADED=`modinfo | grep -w "$drv"`
61 if test -n "$LOADED"; then
62 MODID=`echo "$LOADED" | cut -d ' ' -f 1`
63 $SUDO modunload -i $MODID;
64 LOADED=`modinfo | grep -w "$drv"`;
65 if test -n "$LOADED"; then
66 echo "load.sh: failed to unload $drv";
67 dmesg | tail
68 exit 1;
69 fi
70 fi
71done
72
73#
74# Remove old stuff.
75#
76MY_RC=1
77set -e
78$SUDO rm -f \
79 "/usr/kernel/fs/${DRVNAME}" \
80 "/usr/kernel/fs/amd64/${DRVNAME}" \
81 "/etc/fs/vboxfs/mount"
82sync
83set +e
84
85#
86# Install the mount program.
87#
88if [ ! -d /etc/fs/vboxfs ]; then
89 $SUDO mkdir -p /etc/fs/vboxfs
90fi
91$SUDO ln -sf "$MOUNTHLPFILE" /etc/fs/vboxfs/mount
92
93#
94# Load the module. We can load it without copying it to /usr/kernel/fs/.
95#
96if $SUDO modload "$DRVFILE"; then
97 sync
98 MY_RC=0
99else
100 dmesg | tail
101 echo "load.sh: add_drv failed."
102fi
103
104exit $MY_RC;
105
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