i.minorperm_i386 revision b127ac411761a3d8d642d9342d9cac2785e1faaa
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#!/bin/sh
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# CDDL HEADER START
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# The contents of this file are subject to the terms of the
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# Common Development and Distribution License (the "License").
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# You may not use this file except in compliance with the License.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# or http://www.opensolaris.org/os/licensing.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# See the License for the specific language governing permissions
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# and limitations under the License.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# When distributing Covered Code, include this CDDL HEADER in each
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# If applicable, add the following below this CDDL HEADER, with the
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# fields enclosed by brackets "[]" replaced with your own identifying
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# information: Portions Copyright [yyyy] [name of copyright owner]
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# CDDL HEADER END
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# Use is subject to license terms.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# NOTE: When a change is made to the source file for
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# /etc/minor_perm, a corresponding change must be made to
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# this class-action script.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# - If an existing entry in minor_perm is having its
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# attributes e.g. permissions, ownership changed,
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# add it to the list produced by make_chattr_list below.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# - If an existing entry must be deleted, add it to
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# the list produced by make_delete_list below.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# - If a new entry must be added to the file, add it to the
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# list produced by make_add_list.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# - If a new entry is being added to minor_perm, but there
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# may already be devices of that name on the system (e.g.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# we used the system default permissions in a previous release),
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# and those old devices now need to have their attributes changed,
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# add it to the make_chattr_list AND the make_add_list lists
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# If an entry in /etc/minor_perm needs to have its attributes
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# changed, identify the entry in the list copied to /etc/chattr.$$
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# by this function. The fields are:
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# <device>:<minor> <old_attrs> <new_attrs> <optional list of logical
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# devices whose attributes
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# will need to be changed>
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# where an <attribute list> := <perm> <user> <group>
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# NOTE: this list should also contain entries for nodes that previously
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# were not in /etc/minor_perm (which means the default mode of 600,
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# owner/group == root/sys), but now have an entry
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonmake_chattr_list()
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington{
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoncat > /tmp/chattr.$$ << EOF
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonvol:volctl 0600 root sys 0666 root sys /dev/volctl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:llc1 0600 root sys 0666 root sys /dev/llc1
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonlog:conslog 0620 root sys 0666 root sys /dev/conslog
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsy:tty 0666 root sys 0666 root tty /dev/tty
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonicmp:icmp 0600 root sys 0666 root sys /dev/rawip
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonicmp6:icmp6 0600 root sys 0666 root sys /dev/rawip6
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonip:ip 0660 root sys 0666 root sys /dev/ip
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonip6:ip6 0660 root sys 0666 root sys /dev/ip6
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrts:rts 0660 root sys 0666 root sys /dev/rts
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonkeysock:keysock 0600 root sys 0666 root sys /dev/keysock
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonipsecah:ipsecah 0600 root sys 0666 root sys /dev/ipsecah
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonipsecesp:ipsecesp 0600 root sys 0666 root sys /dev/ipsecesp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonspdsock:spdsock 0600 root sys 0666 root sys /dev/spdsock
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsad:admin 0600 root sys 0666 root sys /dev/sad/admin
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonfssnap:ctl 0600 root sys 0666 root sys /dev/fssnapctl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonfssnap:* 0600 root sys 0640 root sys /dev/fssnap/*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:dnet 0600 root sys 0666 root sys /dev/dnet
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtondnet:* 0600 root sys 0666 root sys /dev/dnet*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:elxl 0600 root sys 0666 root sys /dev/elxl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonelxl:* 0600 root sys 0666 root sys /dev/elxl*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:iprb 0600 root sys 0666 root sys /dev/iprb
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoniprb:* 0600 root sys 0666 root sys /dev/iprb*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:pcelx 0600 root sys 0666 root sys /dev/pcelx
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpcelx:* 0600 root sys 0666 root sys /dev/pcelx*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:spwr 0600 root sys 0666 root sys /dev/spwr
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonspwr:* 0600 root sys 0666 root sys /dev/spwr*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoncpc:* 0600 root sys 0666 root sys /devices/pseudo/cpc*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonipf:* 0600 root sys 0666 root sys /dev/ipf
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpfil:* 0600 root sys 0666 root sys /dev/pfil
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonscsi_vhci:devctl 0600 root sys 0666 root sys /devices/scsi_vhci:devctl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonfbt:fbt 0600 root sys 0644 root sys /dev/dtrace/provider/fbt
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonlockstat:* 0600 root sys 0644 root sys /dev/dtrace/provider/lockstat
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonprofile:profile 0600 root sys 0644 root sys /dev/dtrace/provider/profile
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsdt:sdt 0600 root sys 0644 root sys /dev/dtrace/provider/sdt
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsystrace:systrace 0600 root sys 0644 root sys /dev/dtrace/provider/systrace
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:bge 0600 root sys 0666 root sys /dev/bge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:igb 0600 root sys 0666 root sys /dev/igb
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ixgbe 0600 root sys 0666 root sys /dev/ixgbe
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:rge 0600 root sys 0666 root sys /dev/rge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:xge 0600 root sys 0666 root sys /dev/xge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:nge 0600 root sys 0666 root sys /dev/nge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:chxge 0600 root sys 0666 root sys /dev/chxge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:pcn 0600 root sys 0666 root sys /dev/pcn
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:rtls 0600 root sys 0666 root sys /dev/rtls
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ath 0600 root sys 0666 root sys /dev/ath
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ipw 0600 root sys 0666 root sys /dev/ipw
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:iwh 0600 root sys 0666 root sys /dev/iwh
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:iwi 0600 root sys 0666 root sys /dev/iwi
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:iwk 0600 root sys 0666 root sys /dev/iwk
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:pcwl 0600 root sys 0666 root sys /dev/pcwl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:pcan 0600 root sys 0666 root sys /dev/pcan
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ral 0600 root sys 0666 root sys /dev/ral
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:rtw 0600 root sys 0666 root sys /dev/rtw
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:rum 0600 root sys 0666 root sys /dev/rum
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ural 0600 root sys 0666 root sys /dev/ural
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:wpi 0600 root sys 0666 root sys /dev/wpi
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:afe 0600 root sys 0666 root sys /dev/afe
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:dmfe 0600 root sys 0666 root sys /dev/dmfe
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:mxfe 0600 root sys 0666 root sys /dev/mxfe
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonbge:* 0600 root sys 0666 root sys /dev/bge*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonigb:* 0600 root sys 0666 root sys /dev/igb*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonixgbe:* 0600 root sys 0666 root sys /dev/ixgbe*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrge:* 0600 root sys 0666 root sys /dev/rge*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonxge:* 0600 root sys 0666 root sys /dev/xge*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonnge:* 0600 root sys 0666 root sys /dev/nge*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtone1000g:* 0666 root root 0666 root sys /dev/e1000g*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonchxge:* 0600 root sys 0666 root sys /dev/chxge*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpcn:* 0600 root sys 0666 root sys /dev/pcn*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrtls:* 0600 root sys 0666 root sys /dev/rtls*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonath:* 0600 root sys 0666 root sys /dev/ath*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonipw:* 0600 root sys 0666 root sys /dev/ipw*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoniwh:* 0600 root sys 0666 root sys /dev/iwh*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoniwi:* 0600 root sys 0666 root sys /dev/iwi*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoniwk:* 0600 root sys 0666 root sys /dev/iwk*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpcwl:* 0600 root sys 0666 root sys /dev/pcwl*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpcan:* 0600 root sys 0666 root sys /dev/pcan*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonral:* 0600 root sys 0666 root sys /dev/ral*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrtw:* 0600 root sys 0666 root sys /dev/rtw*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrum:* 0600 root sys 0666 root sys /dev/rum*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonural:* 0600 root sys 0666 root sys /dev/ural*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonwpi:* 0600 root sys 0666 root sys /dev/wpi*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonafe:* 0600 root sys 0666 root sys /dev/afe*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtondmfe:* 0600 root sys 0666 root sys /dev/dmfe*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonmxfe:* 0600 root sys 0666 root sys /dev/mxfe*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonballoon:* 0600 root sys 0444 root sys /dev/xen/balloon
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtondomcaps:* 0600 root sys 0444 root sys /dev/xen/domcaps
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonevtchn:* 0600 root sys 0666 root sys /dev/xen/evtchn
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonprivcmd:* 0600 root sys 0666 root sys /dev/xen/privcmd
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonxenbus:* 0600 root sys 0666 root sys /dev/xen/xenbus
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonxpvtap:* 0600 root sys 0666 root sys /devices/xpvd/xpvtap*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian WellingtonEOF
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington}
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# If an entry in /etc/minor_perm needs to be deleted, identify
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# the entry in the list copied to /etc/delete.$$ by this function.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# The fields are:
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# <device>:<minor> <optional list of logical devices to be deleted>
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonmake_delete_list()
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington{
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoncat > /tmp/delete.$$ << EOF
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrip:rawip
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonconsfb:consfb
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:el
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:elx
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:sle
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:sie
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:sp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ip
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:icmp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:udp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:tcp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:rts
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:arp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ipsecah
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ipsecesp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:keysock
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:smc
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:tr
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:sbpro
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonelx:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsbpro:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonwin:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoncmtp:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonprofile:profile
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonasy:[a-z]
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonasy:[a-z],cu
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoni2o_bs:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian WellingtonEOF
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington}
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# If an entry needs to be added to /etc/minor_perm, add the first
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# field of the entry to the list created by this function. The
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# remainder of the entry will be extracted from the /etc/minor_perm
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# in the package being installed, so it is not necessary to supply
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# it here.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonmake_add_list()
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington{
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoncat > /tmp/add.$$ << EOF
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonvol:volctl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:llc1
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtontnf:tnfctl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtontnf:tnfmap
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonst:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpm:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtondevinfo:devinfo
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonopeneepr:openprom
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonwc:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonip:ip
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonip6:ip6
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonipnet:lo0
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonicmp:icmp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonicmp6:icmp6
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonudp:udp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonudp6:udp6
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtontcp:tcp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtontcp6:tcp6
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrts:rts
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonarp:arp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpoll:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpool:pool
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpool:poolctl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoncpc:shared
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsysmsg:msglog
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsysmsg:sysmsg
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonipsecah:ipsecah
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonipsecesp:ipsecesp
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonkeysock:keysock
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonspdsock:spdsock
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtondevinfo:devinfo,ro
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonlofi:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonlofi:ctl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsgen:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonfssnap:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonfssnap:ctl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrsm:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrandom:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonmm:allkmem
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:dnet
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtondnet:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:elxl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonelxl:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ibd
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonibd:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:iprb
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoniprb:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:pcelx
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpcelx:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:spwr
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonspwr:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsysevent:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonramdisk:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonramdisk:ctl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoncryptoadm:cryptoadm
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoncrypto:crypto
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtondtrace:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonfasttrap:fasttrap
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonipf:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonpfil:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonbl:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsctp:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonsctp6:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonvni:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtoncpuid:self
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:bge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:igb
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ixgbe
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:rge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:xge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:nge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:e1000g
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:chxge
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:pcn
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:rtls
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ath
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ipw
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:iwh
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:iwi
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:iwk
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:pcwl
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:pcan
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ral
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:rtw
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:rum
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:ural
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:wpi
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:afe
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:dmfe
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonclone:mxfe
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonbge:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonigb:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonixgbe:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonrge:*
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonxge:*
nge:*
e1000g:*
chxge:*
pcn:*
rtls:*
ath:*
ipw:*
iwh:*
iwi:*
iwk:*
pcwl:*
pcan:*
ral:*
rtw:*
rum:*
ural:*
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:*
acpi_drv:*
smbsrv:*
vscan:*
nsmb:*
balloon:*
domcaps:*
evtchn:*
privcmd:*
xenbus:*
fm:*
amd_iommu:*
xpvtap:*
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