i.minorperm_sparc revision 4eaa471005973e11a6110b69fe990530b3b95a38
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#! /bin/sh
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd# CDDL HEADER START
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd#
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd# The contents of this file are subject to the terms of the
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# Common Development and Distribution License (the "License").
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# You may not use this file except in compliance with the License.
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc# or http://www.opensolaris.org/os/licensing.
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# See the License for the specific language governing permissions
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# and limitations under the License.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen#
2e545ce2450a9953665f701bb05350f0d3f26275nd# When distributing Covered Code, include this CDDL HEADER in each
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen# If applicable, add the following below this CDDL HEADER, with the
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# fields enclosed by brackets "[]" replaced with your own identifying
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# information: Portions Copyright [yyyy] [name of copyright owner]
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen# CDDL HEADER END
3f08db06526d6901aa08c110b5bc7dde6bc39905nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
3f08db06526d6901aa08c110b5bc7dde6bc39905nd# Use is subject to license terms.
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung# NOTE: When a change is made to the source file for
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# /etc/minor_perm, a corresponding change must be made to
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# this class-action script.
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# - If an existing entry in minor_perm is having its
b09fcdfc59ada4712150e7bcc7b502bb9e4601d8rjung# attributes e.g. permissions, ownership changed,
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# add it to the list produced by make_chattr_list below.
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# - If an existing entry must be deleted, add it to
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# the list produced by make_delete_list below.
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# - If a new entry must be added to the file, add it to the
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# list produced by make_add_list.
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# - If a new entry is being added to minor_perm, but there
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# may already be devices of that name on the system (e.g.
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# we used the system default permissions in a previous release),
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# and those old devices now need to have their attributes changed,
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# add it to the make_chattr_list AND the make_add_list lists
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri# If an entry in /etc/minor_perm needs to have its attributes
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri# changed, identify the entry in the list copied to /etc/chattr.$$
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri# by this function. The fields are:
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri#
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri# <device>:<minor> <old_attrs> <new_attrs> <optional list of logical
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# devices whose attributes
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# will need to be changed>
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# where an <attribute list> := <perm> <user> <group>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndmake_chattr_list() {
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndcat > /tmp/chattr.$$ << EOF
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedoohaudio:* 0666 root sys 0600 root sys /dev/sound/*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndvol:volctl 0600 root sys 0666 root sys /dev/volctl
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarsad:user 0600 root sys 0666 root sys /dev/sad/user
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarse:* 0666 root sys 0600 uucp uucp /dev/cua/*
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarzs:* 0666 root sys 0600 uucp uucp /dev/cua/*
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarsu:* 0666 root sys 0600 uucp uucp /dev/cua/*
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarssd:* 0666 root sys 0640 root sys /dev/dsk/* /dev/rdsk/*
2fae9d127f7143fabe8f73958eb9bde31df17d41coardad:* 0600 root sys 0640 root sys /dev/dsk/* /dev/rdsk/*
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarcpc:* 0600 root sys 0666 root sys /devices/pseudo/cpc*
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarlog:conslog 0622 root sys 0666 root sys /dev/conslog
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarsy:tty 0666 root sys 0666 root tty /dev/tty
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarcvc:* 0666 root sys 0600 root sys
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarcvcredir:* 0666 root sys 0600 root sys
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarssm:* 0600 root sys 0640 root sys /devices/ssm*:*
1f1b6bf13313fdd14a45e52e553d3ff28689b717coaricmp:icmp 0600 root sys 0666 root sys /dev/rawip
1f1b6bf13313fdd14a45e52e553d3ff28689b717coaricmp6:icmp6 0600 root sys 0666 root sys /dev/rawip6
2fae9d127f7143fabe8f73958eb9bde31df17d41coarip:ip 0660 root sys 0666 root sys /dev/ip
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarip6:ip6 0660 root sys 0666 root sys /dev/ip6
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarrts:rts 0660 root sys 0666 root sys /dev/rts
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarkeysock:keysock 0600 root sys 0666 root sys /dev/keysock
1f1b6bf13313fdd14a45e52e553d3ff28689b717coaripsecah:ipsecah 0600 root sys 0666 root sys /dev/ipsecah
1f1b6bf13313fdd14a45e52e553d3ff28689b717coaripsecesp:ipsecesp 0600 root sys 0666 root sys /dev/ipsecesp
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarspdsock:spdsock 0600 root sys 0666 root sys /dev/spdsock
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarsad:admin 0600 root sys 0666 root sys /dev/sad/admin
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarfssnap:ctl 0600 root sys 0666 root sys /dev/fssnapctl
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarfssnap:* 0600 root sys 0640 root sys /dev/fssnap/*
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:ce 0600 root sys 0666 root sys /dev/ce
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:eri 0600 root sys 0666 root sys /dev/eri
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:ge 0600 root sys 0666 root sys /dev/ge
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:hme 0600 root sys 0666 root sys /dev/hme
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:qfe 0600 root sys 0666 root sys /dev/qfe
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:bge 0600 root sys 0666 root sys /dev/bge
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:igb 0600 root sys 0666 root sys /dev/igb
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:ixgbe 0600 root sys 0666 root sys /dev/ixgbe
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:myri10ge 0600 root sys 0666 root sys /dev/myri10ge
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:rge 0600 root sys 0666 root sys /dev/rge
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:xge 0600 root sys 0666 root sys /dev/xge
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:nge 0600 root sys 0666 root sys /dev/nge
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:e1000g 0666 root root 0666 root sys /dev/e1000g
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:chxge 0600 root sys 0666 root sys /dev/chxge
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:vsw 0600 root sys 0666 root sys /dev/vsw
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:vnet 0600 root sys 0666 root sys /dev/vnet
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:pcwl 0600 root sys 0666 root sys /dev/pcwl
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarclone:pcan 0600 root sys 0666 root sys /dev/pcan
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndclone:afe 0600 root sys 0666 root sys /dev/afe
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndclone:mxfe 0600 root sys 0666 root sys /dev/mxfe
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndclone:rtls 0600 root sys 0666 root sys /dev/rtls
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndbge:* 0600 root sys 0666 root sys /dev/bge*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndigb:* 0600 root sys 0666 root sys /dev/igb*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndixgbe:* 0600 root sys 0666 root sys /dev/ixgbe*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndmyri10ge:* 0600 root sys 0666 root sys /dev/myri10ge*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndrge:* 0600 root sys 0666 root sys /dev/rge*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndxge:* 0600 root sys 0666 root sys /dev/xge*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndnge:* 0600 root sys 0666 root sys /dev/nge*
0a69d9bb491d9810892a9949c01403a1de3c7ac2nde1000g:* 0666 root root 0666 root sys /dev/e1000g*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndchxge:* 0600 root sys 0666 root sys /dev/chxge*
722c4c7fb902aaea0d89d2ec1734869430558cc3ndvsw:* 0600 root sys 0666 root sys /dev/vsw*
722c4c7fb902aaea0d89d2ec1734869430558cc3ndvnet:* 0600 root sys 0666 root sys /dev/vnet*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndpcwl:* 0600 root sys 0666 root sys /dev/pcwl*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndpcan:* 0600 root sys 0666 root sys /dev/pcan*
722c4c7fb902aaea0d89d2ec1734869430558cc3ndclone:dmfe 0600 root sys 0666 root sys /dev/dmfe
0a69d9bb491d9810892a9949c01403a1de3c7ac2nddmfe:* 0600 root sys 0666 root sys /dev/dmfe*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndclone:pcelx 0600 root sys 0666 root sys /dev/pcelx
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndpcelx:* 0600 root sys 0666 root sys /dev/pcelx*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndafe:* 0600 root sys 0666 root sys /dev/afe*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndmxfe:* 0600 root sys 0666 root sys /dev/mxfe*
20f499565e77defe9dab24dd85c02f38a1175855ndrtls:* 0600 root sys 0666 root sys /dev/rtls*
e487d6c09669296f94a5190cc34586a98e624a00ndipf:* 0600 root sys 0666 root sys /dev/ipf
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndpfil:* 0600 root sys 0666 root sys /dev/pfil
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndscsi_vhci:devctl 0600 root sys 0666 root sys /devices/scsi_vhci:devctl
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndfbt:fbt 0600 root sys 0644 root sys /dev/dtrace/provider/fbt
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndlockstat:* 0600 root sys 0644 root sys /dev/dtrace/provider/lockstat
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndprofile:profile 0600 root sys 0644 root sys /dev/dtrace/provider/profile
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndsdt:sdt 0600 root sys 0644 root sys /dev/dtrace/provider/sdt
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndsystrace:systrace 0600 root sys 0644 root sys /dev/dtrace/provider/systrace
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndEOF
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd}
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# If an entry in /etc/minor_perm needs to be deleted, identify
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# the entry in the list copied to /etc/delete.$$ by this function.
722c4c7fb902aaea0d89d2ec1734869430558cc3nd# The fields are:
722c4c7fb902aaea0d89d2ec1734869430558cc3nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# <device>:<minor> <optional list of logical devices to be deleted>
722c4c7fb902aaea0d89d2ec1734869430558cc3nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndmake_delete_list() {
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndcat > /tmp/delete.$$ << EOF
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndmm:mbio /dev/mbio /devices/pseudo/mm:mbio
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndmm:mbmem /dev/mbmem /devices/pseudo/mm:mbmem
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndclone:amd,0,aux,audio
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndsw:drum
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndrip:rawip
722c4c7fb902aaea0d89d2ec1734869430558cc3ndzs:*
722c4c7fb902aaea0d89d2ec1734869430558cc3ndconsfb:consfb
d07eba7de731bfebcaba192c3b9a9eb89178ec04covenerwin:*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndrtvc:*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndgt:*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndmic:*
722c4c7fb902aaea0d89d2ec1734869430558cc3ndcgeight-p4:*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndcgfour:*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndcgtwo:*
722c4c7fb902aaea0d89d2ec1734869430558cc3ndid:*
722c4c7fb902aaea0d89d2ec1734869430558cc3ndxd:*
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coarxt:*
722c4c7fb902aaea0d89d2ec1734869430558cc3ndxy:*
722c4c7fb902aaea0d89d2ec1734869430558cc3ndie:*
e487d6c09669296f94a5190cc34586a98e624a00ndbe:*
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndse:ucm
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndse:ucmctl
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndclone:arp
0a69d9bb491d9810892a9949c01403a1de3c7ac2ndclone:icmp
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjungclone:ip
727872d18412fc021f03969b8641810d8896820bhumbedoohclone:tcp
0d0ba3a410038e179b695446bb149cce6264e0abndclone:udp
727872d18412fc021f03969b8641810d8896820bhumbedoohclone:rts
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohclone:ipsecah
0d0ba3a410038e179b695446bb149cce6264e0abndclone:ipsecesp
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohclone:keysock
727872d18412fc021f03969b8641810d8896820bhumbedoohclone:le
0d0ba3a410038e179b695446bb149cce6264e0abndsu:*
0d0ba3a410038e179b695446bb149cce6264e0abndprofile:profile
0d0ba3a410038e179b695446bb149cce6264e0abndclone:qe
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedoohcgfourteen:*
0d0ba3a410038e179b695446bb149cce6264e0abndcgeight:*
0d0ba3a410038e179b695446bb149cce6264e0abndSUNW,sx:*
0d0ba3a410038e179b695446bb149cce6264e0abndsx_cmem:*
727872d18412fc021f03969b8641810d8896820bhumbedoohstc:*
0d0ba3a410038e179b695446bb149cce6264e0abnddbri:*
0d0ba3a410038e179b695446bb149cce6264e0abndSUNW,DBRId:*
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedoohSUNW,DBRIe:*
205f749042ed530040a4f0080dbcb47ceae8a374rjungSUNW,DBRIf:*
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowenvni:*
0d0ba3a410038e179b695446bb149cce6264e0abndEOF
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd}
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd#
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd# If an entry needs to be added to /etc/minor_perm, add the first
# field of the entry to the list created by this function. The
# remainder of the entry will be extracted from the /etc/minor_perm
# in the package being installed, so it is not necessary to supply
# it here.
#
make_add_list() {
cat > /tmp/add.$$ << EOF
clone:llc1
stc:*
mcpzsa:*
mcpp:*
vol:volctl
tl:*
tnf:tnfctl
tnf:tnfmap
zs:[a-z]
zs:[a-z],cu
sad:user
se:*
su:[a-z]
su:[a-z],cu
su:ssp
su:sspctl
fdthree:*
ssd:*
dad:*
pm:*
tod:*
SUNW,pmc:*
SUNW,mic:*
SUNW,fas:devctl
cvc:*
cvcredir:*
devinfo:devinfo
envctrltwo:*
se:[a-h]
se:[a-h],cu
se:[0-7],hdlc
se:ssp
se:sspctl
clone:hme
clone:eri
wc:*
arp:arp
icmp:icmp
icmp6:icmp6
ip:ip
ip6:ip6
ipnet:lo0
tcp:tcp
tcp6:tcp6
udp:udp
udp6:udp6
rts:rts
poll:*
pool:pool
pool:poolctl
cpc:shared
sysmsg:msglog
sysmsg:sysmsg
ipsecah:ipsecah
ipsecesp:ipsecesp
keysock:keysock
spdsock:spdsock
devinfo:devinfo,ro
lofi:*
lofi:ctl
sgen:*
fssnap:*
fssnap:ctl
pcf8574:*
pcf8591:*
gpio_87317:*
rsm:*
random:*
mm:allkmem
ssm:*
bscv:*
clone:bge
clone:igb
clone:ixgbe
clone:myri10ge
clone:rge
clone:xge
clone:nge
clone:e1000g
clone:chxge
clone:vsw
clone:vnet
clone:pcwl
clone:pcan
clone:afe
clone:mxfe
clone:rtls
bge:*
igb:*
ixgbe:*
myri10ge:*
rge:*
xge:*
nge:*
e1000g:*
chxge:*
vsw:*
vnet:*
pcwl:*
pcan:*
afe:*
mxfe:*
rtls:*
clone:dmfe
dmfe:*
clone:pcelx
pcelx:*
clone:ibd
ibd:*
sysevent:*
ramdisk:*
ramdisk:ctl
cryptoadm:cryptoadm
crypto:crypto
dtrace:*
fasttrap:fasttrap
ipf:*
pfil:*
bl:*
sctp:*
sctp6:*
dlpistub:*
cpuid:self
ntwdt:*
dld:*
aggr:*
mdesc:*
zfs:*
zfs:zfs
scsi_vhci:*
kssl:*
fbt:fbt
profile:profile
sdt:sdt
softmac:*
systrace:systrace
physmem:*
smbsrv:*
vscan:*
nsmb:*
bmc:bmc
fm:*
clone:bridge
EOF
}
PATH="/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin"
export PATH
# Internal routine to create a sed script which can be used to
# escape all shell globbing metacharacters in a path.
create_esc_sedscript()
{
cat > /tmp/esc.sed.$$ << EOF
s/\*/\\\\*/g
s/\?/\\\\?/g
s/\[/\\\\[/g
s/\]/\\\\]/g
EOF
}
# Internal routine to convert an entry in a /tmp/chwhatever.$$ file to
# an appropriately escaped pattern which can be used to grep into minor_perm.
entry2pattern()
{
# the first argument is the 'key' field from the change file.
# entries can contain shell globbing characters to match
# several devices - hence all the palaver below.
printf '%s' `echo "$1" | sed \
-e 's/\*/\\\\*/g' -e 's/\?/\\\\?/g' \
-e 's/\./\\\\./g' -e 's/\[/\\\\[/g' \
-e 's/\]/\\\\]/g'`
shift
# the remaining optional arguments are tokens separated by white-space
if [ $# = 0 ] ; then
printf '[ \t]'
else
while [ -n "$1" ]
do
printf '[ \t][ \t]*%s' $1
shift
done
printf '[ \t]*$'
fi
}
while read src dest
do
if [ ! -f $dest ] ; then
cp $src $dest
else
rm -f /tmp/*.$$
create_esc_sedscript
make_chattr_list
make_delete_list
make_add_list
#
# Process the list of devices whose attributes are to be
# changed. Find those that actually need to be
# applied to the file. For each change that needs
# to be applied, add an entry for it to the sed
# script that will eventually be applied to the
# currently-installed /etc/minor_perm file. Also,
# add an entry to the /tmp/chdevs.$$ file, which
# contains the list of logical names of devices
# whose permissions need to be changed.
#
cat /tmp/chattr.$$ | \
while read key oldp oldu oldg newp newu newg chdevs
do
do_chdevs=no
#
# First determine whether the device entry
# is already in the file, but with the old
# permissions. If so, the entry needs to be
# modified and the devices in the chdevs list
# need to have their permissions and ownerships
# changed.
#
grepstr=`entry2pattern "${key}" $oldp $oldu $oldg`
if grep "$grepstr" $dest > /dev/null 2>&1; then
echo "s/${grepstr}/$key $newp $newu $newg/" \
>> /tmp/sedscript.$$
do_chdevs=yes
fi
#
# Now determine whether the device entry is
# in the file at all. If not, it is a new
# entry, but there may already be devices
# on the system whose permissions need to
# be changed.
#
grepstr=`entry2pattern "${key}"`
grep "${grepstr}" $dest > /dev/null 2>&1
if [ $? != 0 ] ; then
do_chdevs=yes
fi
if [ $do_chdevs = yes -a "$chdevs" != "" ] ; then
xchdevs=`echo "$chdevs" | \
sed -f /tmp/esc.sed.$$`
for m in $xchdevs ; do
echo "$m" $oldp $oldu $oldg \
$newp $newu $newg >> /tmp/chdevs.$$
done
fi
done
#
# Make sure /dev/volctl gets its permissions corrected.
# (systems upgraded from 2.2 to 2.3 may have a correct
# entry for /dev/volctl in the /etc/minor_perm file
# but the actual /dev/volctl node may have the wrong
# permissions.)
#
echo /dev/volctl 0600 root sys 0666 root sys >> /tmp/chdevs.$$
if [ -s /tmp/chdevs.$$ ] ; then
sort -u /tmp/chdevs.$$ > /tmp/tmp.$$
mv /tmp/tmp.$$ /tmp/chdevs.$$
fi
#
# Process the list of devices to be deleted.
# Find those that actually need to be deleted
# from the file. For each entry to be deleted,
# add an entry for it to the sed script that will
# eventually be applied to the currently-installed
# /etc/minor_perm file. Also, add an entry to the
# /tmp/deldevs.$$ file, which contains the list of
# logical names of devices to be deleted.
#
cat /tmp/delete.$$ | while read key deldevs
do
grepstr=`entry2pattern "${key}"`
if grep "$grepstr" $dest > /dev/null 2>&1; then
echo "/${grepstr}/d" >> /tmp/sedscript.$$
if [ "$deldevs" != "" ] ; then
xdeldevs=`echo "$deldevs" | \
sed -f /tmp/esc.sed.$$`
for m in $xdeldevs ; do
echo "$m" >> /tmp/deldevs.$$
done
fi
fi
done
if [ -s /tmp/deldevs.$$ ] ; then
sort -u /tmp/deldevs.$$ > /tmp/tmp.$$
mv /tmp/tmp.$$ /tmp/deldevs.$$
fi
#
# Apply the sed script built above to the
# currently-installed /etc/minor_perm file.
#
if [ -s /tmp/sedscript.$$ ] ; then
sed -f /tmp/sedscript.$$ $dest > /tmp/tmp.$$
cp /tmp/tmp.$$ $dest
fi
#
# Special case code to handle bug in 2.1, 2.2, and
# early 2.3 releases: the link from /dev/sound/*
# has one extra set of "../"'s in the link. This
# doesn't cause problems in normal operation
# because ".."'s that would take the search path
# higher than the real root are ignored. However,
# during upgrade, when the system being upgraded is
# mounted at /a, the extra ".." in the link causes
# the link to be unresolvable. The link must be
# corrected so that the chmod of /dev/sound/*
# works.
#
if [ "$PKG_INSTALL_ROOT" != "" -a "$PKG_INSTALL_ROOT" != "/" ]
then
for i in $PKG_INSTALL_ROOT/dev/sound/* ; do
if [ "$i" = "$PKG_INSTALL_ROOT/dev/sound/*" ]
then
break;
fi
# if it's not a symlink, continue
if [ ! -h $i ] ; then
continue
fi
ls -L $i >/dev/null 2>&1
if [ $? = 0 ] ; then
# link is already OK
continue
fi
# otherwise, link can't be followed
# build the correct link
link=`ls -l $i | sed 's,.* ,,'`
link=`expr $link : '\.\.\/\(.*\)'`
if [ "$link" = "" ] ; then
continue;
fi
# build a test link
rm -f $PKG_INSTALL_ROOT/dev/sound/test.$$
ln -s $link $PKG_INSTALL_ROOT/dev/sound/test.$$
# test the link
ls -L $PKG_INSTALL_ROOT/dev/sound/test.$$ \
>/dev/null 2>&1
# it worked, so replace old link with new
if [ $? = 0 ] ; then
rm -f $i
ln -s $link $i
fi
rm -f $PKG_INSTALL_ROOT/dev/sound/test.$$
done
fi
# For all entries in minor_perm whose attributes had
# to be corrected, correct the relevant attributes of the
# already-existing devices that correspond to those
# entries.
#
if [ -s /tmp/chdevs.$$ -a "$PKG_INSTALL_ROOT" != "" -a \
"$PKG_INSTALL_ROOT" != "/" ] ; then
cat /tmp/chdevs.$$ |\
while read device oldp oldu oldg newp newu newg
do
#
# Note that we take pains -only- to change
# the permission/ownership of devices that
# have kept their original permissions.
#
for dev in $PKG_INSTALL_ROOT/$device; do
find $dev -follow -perm $oldp -exec \
chmod $newp $dev \; >/dev/null 2>&1
find $dev -follow -user $oldu -exec \
chown $newu $dev \; >/dev/null 2>&1
find $dev -follow -group $oldg -exec \
chgrp $newg $dev \; >/dev/null 2>&1
done
done
fi
#
# For all entries in minor_perm that were deleted,
# remove the /dev entries that point to device nodes
# that correspond to those entries.
#
if [ -s /tmp/deldevs.$$ -a "$PKG_INSTALL_ROOT" != "" -a \
"$PKG_INSTALL_ROOT" != "/" ] ; then
cat /tmp/deldevs.$$ | while read device
do
rm -f $PKG_INSTALL_ROOT/$device
done
fi
cat /tmp/add.$$ | while read key
do
grepstr=`entry2pattern "${key}"`
grep "$grepstr" $dest > /dev/null 2>&1
if [ $? != 0 ] ; then
grep "$grepstr" $src >> $dest
fi
done
rm -f /tmp/*.$$
fi
done
exit 0