xref: /onnv-gate/usr/src/lib/libsecdb/svc-rbac (revision 9910)
1*9910SCasper.Dik@Sun.COM#! /usr/bin/sh
2*9910SCasper.Dik@Sun.COM#
3*9910SCasper.Dik@Sun.COM# CDDL HEADER START
4*9910SCasper.Dik@Sun.COM#
5*9910SCasper.Dik@Sun.COM# The contents of this file are subject to the terms of the
6*9910SCasper.Dik@Sun.COM# Common Development and Distribution License (the "License").
7*9910SCasper.Dik@Sun.COM# You may not use this file except in compliance with the License.
8*9910SCasper.Dik@Sun.COM#
9*9910SCasper.Dik@Sun.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*9910SCasper.Dik@Sun.COM# or http://www.opensolaris.org/os/licensing.
11*9910SCasper.Dik@Sun.COM# See the License for the specific language governing permissions
12*9910SCasper.Dik@Sun.COM# and limitations under the License.
13*9910SCasper.Dik@Sun.COM#
14*9910SCasper.Dik@Sun.COM# When distributing Covered Code, include this CDDL HEADER in each
15*9910SCasper.Dik@Sun.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*9910SCasper.Dik@Sun.COM# If applicable, add the following below this CDDL HEADER, with the
17*9910SCasper.Dik@Sun.COM# fields enclosed by brackets "[]" replaced with your own identifying
18*9910SCasper.Dik@Sun.COM# information: Portions Copyright [yyyy] [name of copyright owner]
19*9910SCasper.Dik@Sun.COM#
20*9910SCasper.Dik@Sun.COM# CDDL HEADER END
21*9910SCasper.Dik@Sun.COM#
22*9910SCasper.Dik@Sun.COM
23*9910SCasper.Dik@Sun.COM#
24*9910SCasper.Dik@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
25*9910SCasper.Dik@Sun.COM# Use is subject to license terms.
26*9910SCasper.Dik@Sun.COM#
27*9910SCasper.Dik@Sun.COM
28*9910SCasper.Dik@Sun.COM. /lib/svc/share/smf_include.sh
29*9910SCasper.Dik@Sun.COM
30*9910SCasper.Dik@Sun.COMfiles='/etc/user_attr /etc/security/auth_attr /etc/security/exec_attr
31*9910SCasper.Dik@Sun.COM    /etc/security/prof_attr'
32*9910SCasper.Dik@Sun.COM
33*9910SCasper.Dik@Sun.COMPKGINST=
34*9910SCasper.Dik@Sun.COMexport PKGINST
35*9910SCasper.Dik@Sun.COM
36*9910SCasper.Dik@Sun.COMirbac=/usr/sadm/install/scripts/i.rbac
37*9910SCasper.Dik@Sun.COM
38*9910SCasper.Dik@Sun.COMif [ ! -x $irbac ]
39*9910SCasper.Dik@Sun.COMthen
40*9910SCasper.Dik@Sun.COM	echo "${irbac}: not found."
41*9910SCasper.Dik@Sun.COM	exit $SMF_EXIT_ERR_FATAL
42*9910SCasper.Dik@Sun.COMfi
43*9910SCasper.Dik@Sun.COM
44*9910SCasper.Dik@Sun.COMcase "$1" in
45*9910SCasper.Dik@Sun.COMstart|refresh)
46*9910SCasper.Dik@Sun.COM	;;
47*9910SCasper.Dik@Sun.COMstop)
48*9910SCasper.Dik@Sun.COM	exit $SMF_EXIT_OK;;
49*9910SCasper.Dik@Sun.COM*)
50*9910SCasper.Dik@Sun.COM	echo "Usage: $0 { start | refresh | stop }"
51*9910SCasper.Dik@Sun.COM	exit $SMF_EXIT_ERR_FATAL;;
52*9910SCasper.Dik@Sun.COMesac
53*9910SCasper.Dik@Sun.COM
54*9910SCasper.Dik@Sun.COMfor f in $files
55*9910SCasper.Dik@Sun.COMdo
56*9910SCasper.Dik@Sun.COM	d=${f}.d
57*9910SCasper.Dik@Sun.COM	if [ ! -d ${d} ]
58*9910SCasper.Dik@Sun.COM	then
59*9910SCasper.Dik@Sun.COM		# No directory, nothing to do
60*9910SCasper.Dik@Sun.COM		continue
61*9910SCasper.Dik@Sun.COM	fi
62*9910SCasper.Dik@Sun.COM	#
63*9910SCasper.Dik@Sun.COM	# List all the files in the directory and the destination file
64*9910SCasper.Dik@Sun.COM	# in the order of their timestamp.  Most recent files are
65*9910SCasper.Dik@Sun.COM	# displayed first.  When we find the destination file, we're
66*9910SCasper.Dik@Sun.COM	# done as the rest of the files are older and they are already
67*9910SCasper.Dik@Sun.COM	# incorporated.
68*9910SCasper.Dik@Sun.COM	#
69*9910SCasper.Dik@Sun.COM	for frag in `ls -t $f $d/* 2> /dev/null`
70*9910SCasper.Dik@Sun.COM	do
71*9910SCasper.Dik@Sun.COM		if [ "$frag" = "$f" ]
72*9910SCasper.Dik@Sun.COM		then
73*9910SCasper.Dik@Sun.COM			break
74*9910SCasper.Dik@Sun.COM		fi
75*9910SCasper.Dik@Sun.COM		if [ -f "$frag" ]
76*9910SCasper.Dik@Sun.COM		then
77*9910SCasper.Dik@Sun.COM			echo $frag $f | $irbac
78*9910SCasper.Dik@Sun.COM		fi
79*9910SCasper.Dik@Sun.COM	done
80*9910SCasper.Dik@Sun.COMdone
81*9910SCasper.Dik@Sun.COM
82*9910SCasper.Dik@Sun.COMexit $SMF_EXIT_OK
83