i.minorperm_i386 revision 4bff34e37def8a90f9194d81bc345c52ba20086a
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj#!/bin/sh
e1c3000228ddea532093e3a5ca1cdaa7353471begstein#
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# CDDL HEADER START
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj#
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# The contents of this file are subject to the terms of the
09bd86d0db1114ee23eda0a6eb76ca055877a1cftrawick# Common Development and Distribution License (the "License").
09bd86d0db1114ee23eda0a6eb76ca055877a1cftrawick# You may not use this file except in compliance with the License.
2deb319e6b3de239f45c16a3e9e836d44f1f7108rbb#
bd929c73ef04789b7183b840d8db6e01d03a4d86rbb# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
70f6f32765cfaadd6da8de6f0fea97ddd72d8fadmanoj# or http://www.opensolaris.org/os/licensing.
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# See the License for the specific language governing permissions
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# and limitations under the License.
91a71946d0fb28c0866139edef3dd59f36ba5b9cstoddard#
91a71946d0fb28c0866139edef3dd59f36ba5b9cstoddard# When distributing Covered Code, include this CDDL HEADER in each
91a71946d0fb28c0866139edef3dd59f36ba5b9cstoddard# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
91a71946d0fb28c0866139edef3dd59f36ba5b9cstoddard# If applicable, add the following below this CDDL HEADER, with the
91a71946d0fb28c0866139edef3dd59f36ba5b9cstoddard# fields enclosed by brackets "[]" replaced with your own identifying
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# information: Portions Copyright [yyyy] [name of copyright owner]
369edcdd0a9c5516c61e736ec2a6fc8fb0d92fe2manoj#
369edcdd0a9c5516c61e736ec2a6fc8fb0d92fe2manoj# CDDL HEADER END
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj#
85cbdc16ac57fa68ce1358a308269abcd417f4d9stoddard#
85cbdc16ac57fa68ce1358a308269abcd417f4d9stoddard# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
85cbdc16ac57fa68ce1358a308269abcd417f4d9stoddard# Use is subject to license terms.
d208bda4a893cc81ed5d3ed1cdd7d706e012bd42stoddard#
d208bda4a893cc81ed5d3ed1cdd7d706e012bd42stoddard#ident "%Z%%M% %I% %E% SMI"
d208bda4a893cc81ed5d3ed1cdd7d706e012bd42stoddard#
d208bda4a893cc81ed5d3ed1cdd7d706e012bd42stoddard
10b386767f6c87b45937244371cb751f0b454d16wrowe#
10b386767f6c87b45937244371cb751f0b454d16wrowe# NOTE: When a change is made to the source file for
75960f20f88dad6bc67892c711c429946063d133stoddard# /etc/minor_perm, a corresponding change must be made to
75960f20f88dad6bc67892c711c429946063d133stoddard# this class-action script.
75960f20f88dad6bc67892c711c429946063d133stoddard#
75960f20f88dad6bc67892c711c429946063d133stoddard# - If an existing entry in minor_perm is having its
75960f20f88dad6bc67892c711c429946063d133stoddard# attributes e.g. permissions, ownership changed,
75960f20f88dad6bc67892c711c429946063d133stoddard# add it to the list produced by make_chattr_list below.
75960f20f88dad6bc67892c711c429946063d133stoddard#
10b386767f6c87b45937244371cb751f0b454d16wrowe# - If an existing entry must be deleted, add it to
10b386767f6c87b45937244371cb751f0b454d16wrowe# the list produced by make_delete_list below.
10b386767f6c87b45937244371cb751f0b454d16wrowe#
10b386767f6c87b45937244371cb751f0b454d16wrowe# - If a new entry must be added to the file, add it to the
10b386767f6c87b45937244371cb751f0b454d16wrowe# list produced by make_add_list.
10b386767f6c87b45937244371cb751f0b454d16wrowe#
10b386767f6c87b45937244371cb751f0b454d16wrowe# - If a new entry is being added to minor_perm, but there
10b386767f6c87b45937244371cb751f0b454d16wrowe# may already be devices of that name on the system (e.g.
10b386767f6c87b45937244371cb751f0b454d16wrowe# we used the system default permissions in a previous release),
10b386767f6c87b45937244371cb751f0b454d16wrowe# and those old devices now need to have their attributes changed,
10b386767f6c87b45937244371cb751f0b454d16wrowe# add it to the make_chattr_list AND the make_add_list lists
a9e07e4f90adcc7bc768db3055431c3dcd560cd1manoj#
f6a6245816cd866361da8c576b1f47c7a54b6610fanf
f6a6245816cd866361da8c576b1f47c7a54b6610fanf#
97b758d0b174d7b7c5a1de1a583f5840ec3fc910trawick# If an entry in /etc/minor_perm needs to have its attributes
db3ccce11afac4fc1d4f51a65424412f7480c46cgstein# changed, identify the entry in the list copied to /etc/chattr.$$
641cb23141f2238ed09e3b9fa79189225f8a2bcbrbb# by this function. The fields are:
641cb23141f2238ed09e3b9fa79189225f8a2bcbrbb#
641cb23141f2238ed09e3b9fa79189225f8a2bcbrbb# <device>:<minor> <old_attrs> <new_attrs> <optional list of logical
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# devices whose attributes
8bed76428f56e5c643174a2d6807c3f18016af5cbjh# will need to be changed>
8bed76428f56e5c643174a2d6807c3f18016af5cbjh#
8bed76428f56e5c643174a2d6807c3f18016af5cbjh# where an <attribute list> := <perm> <user> <group>
8bed76428f56e5c643174a2d6807c3f18016af5cbjh#
8bed76428f56e5c643174a2d6807c3f18016af5cbjh# NOTE: this list should also contain entries for nodes that previously
cfc020d6d6fc9b31d8945915e65a8787a796eb73stoddard# were not in /etc/minor_perm (which means the default mode of 600,
cfc020d6d6fc9b31d8945915e65a8787a796eb73stoddard# owner/group == root/sys), but now have an entry
cfc020d6d6fc9b31d8945915e65a8787a796eb73stoddard#
f824925ac58ff729289c017235eeb3bdd21ec3a2stoddard
f824925ac58ff729289c017235eeb3bdd21ec3a2stoddardmake_chattr_list()
f824925ac58ff729289c017235eeb3bdd21ec3a2stoddard{
f824925ac58ff729289c017235eeb3bdd21ec3a2stoddardcat > /tmp/chattr.$$ << EOF
2aae6faee508221efbeaba5547ca79b7a20ef047stoddardvol:volctl 0600 root sys 0666 root sys /dev/volctl
2aae6faee508221efbeaba5547ca79b7a20ef047stoddardclone:llc1 0600 root sys 0666 root sys /dev/llc1
10b386767f6c87b45937244371cb751f0b454d16wroweclone:sound,sbpro 0666 root sys 0600 root sys /dev/sound/*
10b386767f6c87b45937244371cb751f0b454d16wrowesbpro:* 0666 root sys 0600 root sys /dev/sound/*
10b386767f6c87b45937244371cb751f0b454d16wrowelog:conslog 0620 root sys 0666 root sys /dev/conslog
10b386767f6c87b45937244371cb751f0b454d16wrowesy:tty 0666 root sys 0666 root tty /dev/tty
10b386767f6c87b45937244371cb751f0b454d16wroweicmp:icmp 0600 root sys 0666 root sys /dev/rawip
10b386767f6c87b45937244371cb751f0b454d16wroweicmp6:icmp6 0600 root sys 0666 root sys /dev/rawip6
10b386767f6c87b45937244371cb751f0b454d16wroweip:ip 0660 root sys 0666 root sys /dev/ip
10b386767f6c87b45937244371cb751f0b454d16wroweip6:ip6 0660 root sys 0666 root sys /dev/ip6
75960f20f88dad6bc67892c711c429946063d133stoddardrts:rts 0660 root sys 0666 root sys /dev/rts
a5ed555df952c85bc1b179f5981e8a6c54ba16e6stoddardkeysock:keysock 0600 root sys 0666 root sys /dev/keysock
a5ed555df952c85bc1b179f5981e8a6c54ba16e6stoddardipsecah:ipsecah 0600 root sys 0666 root sys /dev/ipsecah
a5ed555df952c85bc1b179f5981e8a6c54ba16e6stoddardipsecesp:ipsecesp 0600 root sys 0666 root sys /dev/ipsecesp
a5ed555df952c85bc1b179f5981e8a6c54ba16e6stoddardspdsock:spdsock 0600 root sys 0666 root sys /dev/spdsock
a5ed555df952c85bc1b179f5981e8a6c54ba16e6stoddardsad:admin 0600 root sys 0666 root sys /dev/sad/admin
56ca30c968906053ae61acb218420667bb58d996rbbfssnap:ctl 0600 root sys 0666 root sys /dev/fssnapctl
56ca30c968906053ae61acb218420667bb58d996rbbfssnap:* 0600 root sys 0640 root sys /dev/fssnap/*
56ca30c968906053ae61acb218420667bb58d996rbbclone:dnet 0600 root sys 0666 root sys /dev/dnet
56ca30c968906053ae61acb218420667bb58d996rbbdnet:* 0600 root sys 0666 root sys /dev/dnet*
70f6f32765cfaadd6da8de6f0fea97ddd72d8fadmanojclone:elxl 0600 root sys 0666 root sys /dev/elxl
70f6f32765cfaadd6da8de6f0fea97ddd72d8fadmanojelxl:* 0600 root sys 0666 root sys /dev/elxl*
70f6f32765cfaadd6da8de6f0fea97ddd72d8fadmanojclone:iprb 0600 root sys 0666 root sys /dev/iprb
56ca30c968906053ae61acb218420667bb58d996rbbiprb:* 0600 root sys 0666 root sys /dev/iprb*
0bff2f28ef945280c17099c142126178a78e1e54manojclone:pcelx 0600 root sys 0666 root sys /dev/pcelx
0bff2f28ef945280c17099c142126178a78e1e54manojpcelx:* 0600 root sys 0666 root sys /dev/pcelx*
0bff2f28ef945280c17099c142126178a78e1e54manojclone:spwr 0600 root sys 0666 root sys /dev/spwr
1e585ba09ea32272e63c4c39c35491e975d21d98stoddardspwr:* 0600 root sys 0666 root sys /dev/spwr*
1e585ba09ea32272e63c4c39c35491e975d21d98stoddardcpc:* 0600 root sys 0666 root sys /devices/pseudo/cpc*
1e585ba09ea32272e63c4c39c35491e975d21d98stoddardipf:* 0600 root sys 0666 root sys /dev/ipf
1e585ba09ea32272e63c4c39c35491e975d21d98stoddardpfil:* 0600 root sys 0666 root sys /dev/pfil
1e585ba09ea32272e63c4c39c35491e975d21d98stoddardscsi_vhci:devctl 0600 root sys 0666 root sys /devices/scsi_vhci:devctl
1e585ba09ea32272e63c4c39c35491e975d21d98stoddardfbt:fbt 0600 root sys 0644 root sys /dev/dtrace/provider/fbt
1e585ba09ea32272e63c4c39c35491e975d21d98stoddardlockstat:* 0600 root sys 0644 root sys /dev/dtrace/provider/lockstat
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddardprofile:profile 0600 root sys 0644 root sys /dev/dtrace/provider/profile
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddardsdt:sdt 0600 root sys 0644 root sys /dev/dtrace/provider/sdt
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddardsystrace:systrace 0600 root sys 0644 root sys /dev/dtrace/provider/systrace
0bff2f28ef945280c17099c142126178a78e1e54manojclone:bge 0600 root sys 0666 root sys /dev/bge
0bff2f28ef945280c17099c142126178a78e1e54manojclone:rge 0600 root sys 0666 root sys /dev/rge
0bff2f28ef945280c17099c142126178a78e1e54manojclone:xge 0600 root sys 0666 root sys /dev/xge
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddardclone:nge 0600 root sys 0666 root sys /dev/nge
75960f20f88dad6bc67892c711c429946063d133stoddardclone:chxge 0600 root sys 0666 root sys /dev/chxge
1e585ba09ea32272e63c4c39c35491e975d21d98stoddardclone:pcn 0600 root sys 0666 root sys /dev/pcn
f03d292915be9977eaf74e9be7b0404aec226f84manojclone:rtls 0600 root sys 0666 root sys /dev/rtls
aa1faea36e4ae357bc603a2337b6adc54f5daec1manojclone:ath 0600 root sys 0666 root sys /dev/ath
bd929c73ef04789b7183b840d8db6e01d03a4d86rbbclone:ipw 0600 root sys 0666 root sys /dev/ipw
2a6c49cfaef5979a5a06098f3ce987cd76769409manojclone:iwi 0600 root sys 0666 root sys /dev/iwi
302dc1f7b3feee23a91ad8f3cf3cb2edd95a557bmanojclone:pcwl 0600 root sys 0666 root sys /dev/pcwl
302dc1f7b3feee23a91ad8f3cf3cb2edd95a557bmanojclone:pcan 0600 root sys 0666 root sys /dev/pcan
302dc1f7b3feee23a91ad8f3cf3cb2edd95a557bmanojclone:ral 0600 root sys 0666 root sys /dev/ral
302dc1f7b3feee23a91ad8f3cf3cb2edd95a557bmanojclone:rtw 0600 root sys 0666 root sys /dev/rtw
ff849e4163ed879288f0df15f78b6c9d278ec804fanfclone:wpi 0600 root sys 0666 root sys /dev/wpi
ff849e4163ed879288f0df15f78b6c9d278ec804fanfclone:afe 0600 root sys 0666 root sys /dev/afe
9805ac88e1befa6dea11d8513023f150d8f8e807fanfclone:dmfe 0600 root sys 0666 root sys /dev/dmfe
9805ac88e1befa6dea11d8513023f150d8f8e807fanfclone:mxfe 0600 root sys 0666 root sys /dev/mxfe
9805ac88e1befa6dea11d8513023f150d8f8e807fanfbge:* 0600 root sys 0666 root sys /dev/bge*
9805ac88e1befa6dea11d8513023f150d8f8e807fanfrge:* 0600 root sys 0666 root sys /dev/rge*
df4a7c143b27b489dd2d865bb3f6668c8420b3a9fanfxge:* 0600 root sys 0666 root sys /dev/xge*
c03566fa0156d3a1500a42e4fe539e3e0fc8a11dgsteinnge:* 0600 root sys 0666 root sys /dev/nge*
c03566fa0156d3a1500a42e4fe539e3e0fc8a11dgsteine1000g:* 0666 root root 0666 root sys /dev/e1000g*
c03566fa0156d3a1500a42e4fe539e3e0fc8a11dgsteinchxge:* 0600 root sys 0666 root sys /dev/chxge*
c03566fa0156d3a1500a42e4fe539e3e0fc8a11dgsteinpcn:* 0600 root sys 0666 root sys /dev/pcn*
c03566fa0156d3a1500a42e4fe539e3e0fc8a11dgsteinrtls:* 0600 root sys 0666 root sys /dev/rtls*
c03566fa0156d3a1500a42e4fe539e3e0fc8a11dgsteinath:* 0600 root sys 0666 root sys /dev/ath*
c03566fa0156d3a1500a42e4fe539e3e0fc8a11dgsteinipw:* 0600 root sys 0666 root sys /dev/ipw*
db3ccce11afac4fc1d4f51a65424412f7480c46cgsteiniwi:* 0600 root sys 0666 root sys /dev/iwi*
1e088f9182ba67f39713fcb850e11934be5f6d17gsteinpcwl:* 0600 root sys 0666 root sys /dev/pcwl*
dd4713dc5b186f4d1be7b88f86608fdb84cbe5d5gsteinpcan:* 0600 root sys 0666 root sys /dev/pcan*
dd4713dc5b186f4d1be7b88f86608fdb84cbe5d5gsteinral:* 0600 root sys 0666 root sys /dev/ral*
dd4713dc5b186f4d1be7b88f86608fdb84cbe5d5gsteinrtw:* 0600 root sys 0666 root sys /dev/rtw*
0eb7ca6cf812d98c534661ac474e873a32bf6325gsteinwpi:* 0600 root sys 0666 root sys /dev/wpi*
dd4713dc5b186f4d1be7b88f86608fdb84cbe5d5gsteinafe:* 0600 root sys 0666 root sys /dev/afe*
8d07897b52e3b7055874501f8a499e75800db206gsteindmfe:* 0600 root sys 0666 root sys /dev/dmfe*
8d07897b52e3b7055874501f8a499e75800db206gsteinmxfe:* 0600 root sys 0666 root sys /dev/mxfe*
db3ccce11afac4fc1d4f51a65424412f7480c46cgsteinEOF
93c5cba06b623ebe8e4372e886eece12d9a80c3egstein}
93c5cba06b623ebe8e4372e886eece12d9a80c3egstein
93c5cba06b623ebe8e4372e886eece12d9a80c3egstein#
93c5cba06b623ebe8e4372e886eece12d9a80c3egstein# If an entry in /etc/minor_perm needs to be deleted, identify
93c5cba06b623ebe8e4372e886eece12d9a80c3egstein# the entry in the list copied to /etc/delete.$$ by this function.
93c5cba06b623ebe8e4372e886eece12d9a80c3egstein# The fields are:
6fa71a1bd8c61518b05f5798a7a1594c270e78afrbb#
93c5cba06b623ebe8e4372e886eece12d9a80c3egstein# <device>:<minor> <optional list of logical devices to be deleted>
be386cf0beed1c3331e47f0736d92b9744a21f3agstein#
be386cf0beed1c3331e47f0736d92b9744a21f3agstein
be386cf0beed1c3331e47f0736d92b9744a21f3agsteinmake_delete_list()
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgstein{
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgsteincat > /tmp/delete.$$ << EOF
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgsteinrip:rawip
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgsteinconsfb:consfb
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgsteinclone:el
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgsteinclone:elx
eb3def494ba5580320dfe1dd47b4d8b05519cb74gsteinclone:sle
eb3def494ba5580320dfe1dd47b4d8b05519cb74gsteinclone:sie
eb3def494ba5580320dfe1dd47b4d8b05519cb74gsteinclone:sp
eb3def494ba5580320dfe1dd47b4d8b05519cb74gsteinclone:ip
eb3def494ba5580320dfe1dd47b4d8b05519cb74gsteinclone:icmp
1e088f9182ba67f39713fcb850e11934be5f6d17gsteinclone:udp
1e088f9182ba67f39713fcb850e11934be5f6d17gsteinclone:tcp
c695093c99519a8509ac85642e35c216e9d9186fgsteinclone:rts
6d886ec2d5055dd5da4cbf0e84d55b807ea1058agsteinclone:arp
c695093c99519a8509ac85642e35c216e9d9186fgsteinclone:ipsecah
8d07897b52e3b7055874501f8a499e75800db206gsteinclone:ipsecesp
6d886ec2d5055dd5da4cbf0e84d55b807ea1058agsteinclone:keysock
6d886ec2d5055dd5da4cbf0e84d55b807ea1058agsteinclone:smc
6d886ec2d5055dd5da4cbf0e84d55b807ea1058agsteinclone:tr
6d886ec2d5055dd5da4cbf0e84d55b807ea1058agsteinelx:*
e1c3000228ddea532093e3a5ca1cdaa7353471begsteinwin:*
e1c3000228ddea532093e3a5ca1cdaa7353471begsteincmtp:*
e1c3000228ddea532093e3a5ca1cdaa7353471begsteinprofile:profile
e1c3000228ddea532093e3a5ca1cdaa7353471begsteinasy:[a-z]
e1c3000228ddea532093e3a5ca1cdaa7353471begsteinasy:[a-z],cu
35d13495678fd9f0b29d9b9b6f87a49fb13b8d8agsteini2o_bs:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojEOF
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj}
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj
d5defd5a0c5cdbaf74b85939484dc2b6c8317d19manoj#
d5defd5a0c5cdbaf74b85939484dc2b6c8317d19manoj# If an entry needs to be added to /etc/minor_perm, add the first
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# field of the entry to the list created by this function. The
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# remainder of the entry will be extracted from the /etc/minor_perm
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# in the package being installed, so it is not necessary to supply
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# it here.
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj#
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj
0bff2f28ef945280c17099c142126178a78e1e54manojmake_add_list()
0bff2f28ef945280c17099c142126178a78e1e54manoj{
0bff2f28ef945280c17099c142126178a78e1e54manojcat > /tmp/add.$$ << EOF
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingvol:volctl
09bd86d0db1114ee23eda0a6eb76ca055877a1cftrawickclone:llc1
09bd86d0db1114ee23eda0a6eb76ca055877a1cftrawicktnf:tnfctl
09bd86d0db1114ee23eda0a6eb76ca055877a1cftrawicktnf:tnfmap
09bd86d0db1114ee23eda0a6eb76ca055877a1cftrawickst:*
09bd86d0db1114ee23eda0a6eb76ca055877a1cftrawickpm:*
fb777d35fc4730c312e161b3d803ae32700f6ca7saschadevinfo:devinfo
fb777d35fc4730c312e161b3d803ae32700f6ca7saschaopeneepr:openprom
fb777d35fc4730c312e161b3d803ae32700f6ca7saschawc:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojip:ip
2a6c49cfaef5979a5a06098f3ce987cd76769409manojip6:ip6
2a6c49cfaef5979a5a06098f3ce987cd76769409manojicmp:icmp
40a5b7189dbbb28e107bf008ee625f2f0142c2ccdgaudeticmp6:icmp6
2a6c49cfaef5979a5a06098f3ce987cd76769409manojudp:udp
dbf0c7bef06259486cd2748a2d0e82f27e099d6efieldingudp6:udp6
dbf0c7bef06259486cd2748a2d0e82f27e099d6efieldingtcp:tcp
2a6c49cfaef5979a5a06098f3ce987cd76769409manojtcp6:tcp6
bd929c73ef04789b7183b840d8db6e01d03a4d86rbbrts:rts
2a6c49cfaef5979a5a06098f3ce987cd76769409manojarp:arp
2a6c49cfaef5979a5a06098f3ce987cd76769409manojpoll:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojpool:pool
2a6c49cfaef5979a5a06098f3ce987cd76769409manojpool:poolctl
f6a6245816cd866361da8c576b1f47c7a54b6610fanfcpc:shared
f6a6245816cd866361da8c576b1f47c7a54b6610fanfsysmsg:msglog
f6a6245816cd866361da8c576b1f47c7a54b6610fanfsysmsg:sysmsg
f6a6245816cd866361da8c576b1f47c7a54b6610fanfipsecah:ipsecah
f6a6245816cd866361da8c576b1f47c7a54b6610fanfipsecesp:ipsecesp
2a6c49cfaef5979a5a06098f3ce987cd76769409manojkeysock:keysock
2a6c49cfaef5979a5a06098f3ce987cd76769409manojspdsock:spdsock
2a6c49cfaef5979a5a06098f3ce987cd76769409manojdevinfo:devinfo,ro
2a6c49cfaef5979a5a06098f3ce987cd76769409manojlofi:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojlofi:ctl
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingsgen:*
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingfssnap:*
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingfssnap:ctl
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingrsm:*
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingrandom:*
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingmm:allkmem
1e088f9182ba67f39713fcb850e11934be5f6d17gsteinclone:dnet
1e088f9182ba67f39713fcb850e11934be5f6d17gsteindnet:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojclone:elxl
670734c2ee137c587411795c6f82566c9d3729b7coarelxl:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojclone:ibd
2a6c49cfaef5979a5a06098f3ce987cd76769409manojibd:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojclone:iprb
2a6c49cfaef5979a5a06098f3ce987cd76769409manojiprb:*
ae6907470ddf23ab7c6b506e6407cc5372f9c0dftrawickclone:pcelx
ae6907470ddf23ab7c6b506e6407cc5372f9c0dftrawickpcelx:*
ae6907470ddf23ab7c6b506e6407cc5372f9c0dftrawickclone:spwr
2a6c49cfaef5979a5a06098f3ce987cd76769409manojspwr:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojsysevent:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojramdisk:*
2a6c49cfaef5979a5a06098f3ce987cd76769409manojramdisk:ctl
2a6c49cfaef5979a5a06098f3ce987cd76769409manojcryptoadm:cryptoadm
2a6c49cfaef5979a5a06098f3ce987cd76769409manojcrypto:crypto
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingdtrace:*
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingfasttrap:fasttrap
d6b3cb141f0667101c1bca883ad15b383402c93bfieldingipf:*
pfil:*
bl:*
sctp:*
sctp6:*
vni:*
cpuid:self
clone:bge
clone:rge
clone:xge
clone:nge
clone:e1000g
clone:chxge
clone:pcn
clone:rtls
clone:ath
clone:ipw
clone:iwi
clone:pcwl
clone:pcan
clone:ral
clone:rtw
clone:wpi
clone:afe
clone:dmfe
clone:mxfe
bge:*
rge:*
xge:*
nge:*
e1000g:*
chxge:*
pcn:*
rtls:*
ath:*
ipw:*
iwi:*
pcwl:*
pcan:*
ral:*
rtw:*
wpi:*
afe:*
dmfe:*
mxfe:*
bmc:bmc
dld:*
aggr:*
smbios:smbios
zfs:*
zfs:zfs
scsi_vhci:*
kssl:*
fbt:fbt
profile:profile
sdt:sdt
softmac:*
systrace:systrace
lx_ptm:lx_ptmajor
lx_systrace:*
physmem:*
asy:*
asy:*,cu
ucode:*
battery:*
smbsrv:*
vscan:*
nsmb:*
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
# sort the "change attributes" list
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 possibly 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
# 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