xref: /freebsd-src/usr.sbin/bsdconfig/networking/share/common.subr (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1ab2043b8SDevin Teskeif [ ! "$_NETWORKING_COMMON_SUBR" ]; then _NETWORKING_COMMON_SUBR=1
2ab2043b8SDevin Teske#
37323adacSDevin Teske# Copyright (c) 2006-2013 Devin Teske
4f8ea072aSDevin Teske# All rights reserved.
5ab2043b8SDevin Teske#
6ab2043b8SDevin Teske# Redistribution and use in source and binary forms, with or without
7ab2043b8SDevin Teske# modification, are permitted provided that the following conditions
8ab2043b8SDevin Teske# are met:
9ab2043b8SDevin Teske# 1. Redistributions of source code must retain the above copyright
10ab2043b8SDevin Teske#    notice, this list of conditions and the following disclaimer.
11ab2043b8SDevin Teske# 2. Redistributions in binary form must reproduce the above copyright
12ab2043b8SDevin Teske#    notice, this list of conditions and the following disclaimer in the
13ab2043b8SDevin Teske#    documentation and/or other materials provided with the distribution.
14ab2043b8SDevin Teske#
15ab2043b8SDevin Teske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*8e37a7c8SDevin Teske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17ab2043b8SDevin Teske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ab2043b8SDevin Teske# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19ab2043b8SDevin Teske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*8e37a7c8SDevin Teske# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21ab2043b8SDevin Teske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22ab2043b8SDevin Teske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23ab2043b8SDevin Teske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24ab2043b8SDevin Teske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25ab2043b8SDevin Teske# SUCH DAMAGE.
26ab2043b8SDevin Teske#
27ab2043b8SDevin Teske#
28ab2043b8SDevin Teske############################################################ INCLUDES
29ab2043b8SDevin Teske
30ab2043b8SDevin TeskeBSDCFG_SHARE="/usr/share/bsdconfig"
31ab2043b8SDevin Teske. $BSDCFG_SHARE/common.subr || exit 1
32ab2043b8SDevin Teske
33ab2043b8SDevin Teske############################################################ FUNCTIONS
34ab2043b8SDevin Teske
35ab2043b8SDevin Teske# f_jailed
36ab2043b8SDevin Teske#
37ab2043b8SDevin Teske# Returns true if the current process is jail(8)ed.
38ab2043b8SDevin Teske#
39ab2043b8SDevin Teskef_jailed()
40ab2043b8SDevin Teske{
41ab2043b8SDevin Teske	! f_quietly ps 1
42ab2043b8SDevin Teske}
43ab2043b8SDevin Teske
44ab2043b8SDevin Teske# f_nfs_mounted
45ab2043b8SDevin Teske#
46ab2043b8SDevin Teske# Returns true if there are any NFS mounts currently active, otherwise false.
47ab2043b8SDevin Teske#
48ab2043b8SDevin Teskef_nfs_mounted()
49ab2043b8SDevin Teske{
50ab2043b8SDevin Teske	[ "$( df -t nfs )" ]
51ab2043b8SDevin Teske}
52ab2043b8SDevin Teske
5356961fd7SDevin Teske############################################################ MAIN
5456961fd7SDevin Teske
5556961fd7SDevin Teskef_dprintf "%s: Successfully loaded." networking/common.subr
5656961fd7SDevin Teske
57ab2043b8SDevin Teskefi # ! $_NETWORKING_COMMON_SUBR
58