8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 #
28 # Copyright (c) 2012 by Delphix. All rights reserved.
29 #
30
31 . ${STF_TOOLS}/contrib/include/logapi.shlib
32
33 ZFS=${ZFS:-/usr/sbin/zfs}
34 ZPOOL=${ZPOOL:-/usr/sbin/zpool}
35
36 # Determine whether a dataset is mounted
37 #
38 # $1 dataset name
39 # $2 filesystem type; optional - defaulted to zfs
40 #
41 # Return 0 if dataset is mounted; 1 if unmounted; 2 on error
42
43 function ismounted
44 {
45 typeset fstype=$2
46 [[ -z $fstype ]] && fstype=zfs
47 typeset out dir name ret
48
2551 }
2552
2553 function ds_is_snapshot
2554 {
2555 typeset type=$(get_prop type $1)
2556 [[ $type = "snapshot" ]] && return 0
2557 return 1
2558 }
2559
2560 #
2561 # Check if Trusted Extensions are installed and enabled
2562 #
2563 function is_te_enabled
2564 {
2565 $SVCS -H -o state labeld 2>/dev/null | $GREP "enabled"
2566 if (($? != 0)); then
2567 return 1
2568 else
2569 return 0
2570 fi
2571 }
|
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 #
28 # Copyright (c) 2013 by Delphix. All rights reserved.
29 #
30
31 . ${STF_TOOLS}/contrib/include/logapi.shlib
32
33 ZFS=${ZFS:-/usr/sbin/zfs}
34 ZPOOL=${ZPOOL:-/usr/sbin/zpool}
35
36 # Determine whether a dataset is mounted
37 #
38 # $1 dataset name
39 # $2 filesystem type; optional - defaulted to zfs
40 #
41 # Return 0 if dataset is mounted; 1 if unmounted; 2 on error
42
43 function ismounted
44 {
45 typeset fstype=$2
46 [[ -z $fstype ]] && fstype=zfs
47 typeset out dir name ret
48
2551 }
2552
2553 function ds_is_snapshot
2554 {
2555 typeset type=$(get_prop type $1)
2556 [[ $type = "snapshot" ]] && return 0
2557 return 1
2558 }
2559
2560 #
2561 # Check if Trusted Extensions are installed and enabled
2562 #
2563 function is_te_enabled
2564 {
2565 $SVCS -H -o state labeld 2>/dev/null | $GREP "enabled"
2566 if (($? != 0)); then
2567 return 1
2568 else
2569 return 0
2570 fi
2571 }
2572
2573 # Utility function to determine if a system has multiple cpus.
2574 function is_mp
2575 {
2576 (($(psrinfo -p) > 1))
2577 }
2578
2579 # Run the given command as the user provided.
2580 function user_run
2581 {
2582 typeset user=$1
2583 shift
2584
2585 eval \$SU \$user -c \"$@\" > /tmp/out 2>/tmp/err
2586 return $?
2587 }
|