i.minorperm_i386 revision c533a883a71cff9ff32df1c53c31201e1cbf371f
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# CDDL HEADER START
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# The contents of this file are subject to the terms of the
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Common Development and Distribution License (the "License").
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# You may not use this file except in compliance with the License.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# See the License for the specific language governing permissions
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# and limitations under the License.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# When distributing Covered Code, include this CDDL HEADER in each
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User# fields enclosed by brackets "[]" replaced with your own identifying
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# CDDL HEADER END
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Use is subject to license terms.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews#ident "%Z%%M% %I% %E% SMI"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# NOTE: When a change is made to the source file for
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# /etc/minor_perm, a corresponding change must be made to
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# this class-action script.
0c6ada0a814f3c5417daa1654129bc2af56ed504Automatic Updater# - If an existing entry in minor_perm is having its
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# attributes e.g. permissions, ownership changed,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# add it to the list produced by make_chattr_list below.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# - If an existing entry must be deleted, add it to
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# the list produced by make_delete_list below.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# - If a new entry must be added to the file, add it to the
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# list produced by make_add_list.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# - If a new entry is being added to minor_perm, but there
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# may already be devices of that name on the system (e.g.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# we used the system default permissions in a previous release),
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# and those old devices now need to have their attributes changed,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# add it to the make_chattr_list AND the make_add_list lists
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# If an entry in /etc/minor_perm needs to have its attributes
94479b38340a00f0daf0ae0e1d3d673f845609ffTinderbox User# changed, identify the entry in the list copied to /etc/chattr.$$
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# by this function. The fields are:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# <device>:<minor> <old_attrs> <new_attrs> <optional list of logical
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# devices whose attributes
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# will need to be changed>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# where an <attribute list> := <perm> <user> <group>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# NOTE: this list should also contain entries for nodes that previously
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# were not in /etc/minor_perm (which means the default mode of 600,
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User# owner/group == root/sys), but now have an entry
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox Uservol:volctl 0600 root sys 0666 root sys /dev/volctl
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox Userclone:llc1 0600 root sys 0666 root sys /dev/llc1
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:sound,sbpro 0666 root sys 0600 root sys /dev/sound/*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewssbpro:* 0666 root sys 0600 root sys /dev/sound/*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewslog:conslog 0620 root sys 0666 root sys /dev/conslog
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewssy:tty 0666 root sys 0666 root tty /dev/tty
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsicmp:icmp 0600 root sys 0666 root sys /dev/rawip
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsicmp6:icmp6 0600 root sys 0666 root sys /dev/rawip6
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsip:ip 0660 root sys 0666 root sys /dev/ip
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsip6:ip6 0660 root sys 0666 root sys /dev/ip6
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsrts:rts 0660 root sys 0666 root sys /dev/rts
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewskeysock:keysock 0600 root sys 0666 root sys /dev/keysock
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsipsecah:ipsecah 0600 root sys 0666 root sys /dev/ipsecah
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsipsecesp:ipsecesp 0600 root sys 0666 root sys /dev/ipsecesp
94479b38340a00f0daf0ae0e1d3d673f845609ffTinderbox Userspdsock:spdsock 0600 root sys 0666 root sys /dev/spdsock
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewssad:admin 0600 root sys 0666 root sys /dev/sad/admin
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsfssnap:ctl 0600 root sys 0666 root sys /dev/fssnapctl
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsfssnap:* 0600 root sys 0640 root sys /dev/fssnap/*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:dnet 0600 root sys 0666 root sys /dev/dnet
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsdnet:* 0600 root sys 0666 root sys /dev/dnet*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:elxl 0600 root sys 0666 root sys /dev/elxl
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewselxl:* 0600 root sys 0666 root sys /dev/elxl*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:iprb 0600 root sys 0666 root sys /dev/iprb
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsiprb:* 0600 root sys 0666 root sys /dev/iprb*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:pcelx 0600 root sys 0666 root sys /dev/pcelx
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewspcelx:* 0600 root sys 0666 root sys /dev/pcelx*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:spwr 0600 root sys 0666 root sys /dev/spwr
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsspwr:* 0600 root sys 0666 root sys /dev/spwr*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewscpc:* 0600 root sys 0666 root sys /devices/pseudo/cpc*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsipf:* 0600 root sys 0666 root sys /dev/ipf
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewspfil:* 0600 root sys 0666 root sys /dev/pfil
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsscsi_vhci:devctl 0600 root sys 0666 root sys /devices/scsi_vhci:devctl
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsfbt:fbt 0600 root sys 0644 root sys /dev/dtrace/provider/fbt
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewslockstat:* 0600 root sys 0644 root sys /dev/dtrace/provider/lockstat
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsprofile:profile 0600 root sys 0644 root sys /dev/dtrace/provider/profile
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewssdt:sdt 0600 root sys 0644 root sys /dev/dtrace/provider/sdt
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewssystrace:systrace 0600 root sys 0644 root sys /dev/dtrace/provider/systrace
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:bge 0600 root sys 0666 root sys /dev/bge
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:rge 0600 root sys 0666 root sys /dev/rge
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:xge 0600 root sys 0666 root sys /dev/xge
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:nge 0600 root sys 0666 root sys /dev/nge
1224c3b69b3d18f7127aa042644936af25a2d679Mark Andrewsclone:chxge 0600 root sys 0666 root sys /dev/chxge
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:pcn 0600 root sys 0666 root sys /dev/pcn
1224c3b69b3d18f7127aa042644936af25a2d679Mark Andrewsclone:rtls 0600 root sys 0666 root sys /dev/rtls
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:ath 0600 root sys 0666 root sys /dev/ath
1224c3b69b3d18f7127aa042644936af25a2d679Mark Andrewsclone:ipw 0600 root sys 0666 root sys /dev/ipw
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox Userclone:iwi 0600 root sys 0666 root sys /dev/iwi
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:iwk 0600 root sys 0666 root sys /dev/iwk
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:pcwl 0600 root sys 0666 root sys /dev/pcwl
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:pcan 0600 root sys 0666 root sys /dev/pcan
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:ral 0600 root sys 0666 root sys /dev/ral
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:rtw 0600 root sys 0666 root sys /dev/rtw
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:wpi 0600 root sys 0666 root sys /dev/wpi
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:afe 0600 root sys 0666 root sys /dev/afe
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:dmfe 0600 root sys 0666 root sys /dev/dmfe
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:mxfe 0600 root sys 0666 root sys /dev/mxfe
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsbge:* 0600 root sys 0666 root sys /dev/bge*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsrge:* 0600 root sys 0666 root sys /dev/rge*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsxge:* 0600 root sys 0666 root sys /dev/xge*
c247e3f281613fabe1af362e9f3157e35ebbe52cMark Andrewsnge:* 0600 root sys 0666 root sys /dev/nge*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewse1000g:* 0666 root root 0666 root sys /dev/e1000g*
c247e3f281613fabe1af362e9f3157e35ebbe52cMark Andrewschxge:* 0600 root sys 0666 root sys /dev/chxge*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewspcn:* 0600 root sys 0666 root sys /dev/pcn*
c247e3f281613fabe1af362e9f3157e35ebbe52cMark Andrewsrtls:* 0600 root sys 0666 root sys /dev/rtls*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsath:* 0600 root sys 0666 root sys /dev/ath*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsipw:* 0600 root sys 0666 root sys /dev/ipw*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsiwi:* 0600 root sys 0666 root sys /dev/iwi*
c247e3f281613fabe1af362e9f3157e35ebbe52cMark Andrewsiwk:* 0600 root sys 0666 root sys /dev/iwk*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewspcwl:* 0600 root sys 0666 root sys /dev/pcwl*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewspcan:* 0600 root sys 0666 root sys /dev/pcan*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsral:* 0600 root sys 0666 root sys /dev/ral*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsrtw:* 0600 root sys 0666 root sys /dev/rtw*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewswpi:* 0600 root sys 0666 root sys /dev/wpi*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsafe:* 0600 root sys 0666 root sys /dev/afe*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsdmfe:* 0600 root sys 0666 root sys /dev/dmfe*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsmxfe:* 0600 root sys 0666 root sys /dev/mxfe*
94479b38340a00f0daf0ae0e1d3d673f845609ffTinderbox User# If an entry in /etc/minor_perm needs to be deleted, identify
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# the entry in the list copied to /etc/delete.$$ by this function.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User# The fields are:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# <device>:<minor> <optional list of logical devices to be deleted>
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Userclone:ipsecesp
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Userprofile:profile
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User# If an entry needs to be added to /etc/minor_perm, add the first
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User# field of the entry to the list created by this function. The
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User# remainder of the entry will be extracted from the /etc/minor_perm
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User# in the package being installed, so it is not necessary to supply
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Userdevinfo:devinfo
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Useropeneepr:openprom
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Useripsecah:ipsecah
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Useripsecesp:ipsecesp
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Userkeysock:keysock
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Userspdsock:spdsock
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Userdevinfo:devinfo,ro
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Usercryptoadm:cryptoadm
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Userfasttrap:fasttrap
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Userprofile:profile
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Usersystrace:systrace
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox Userlx_ptm:lx_ptmajor
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox UserPATH="/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin"
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User# Internal routine to create a sed script which can be used to
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User# escape all shell globbing metacharacters in a path.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User# Internal routine to convert an entry in a /tmp/chwhatever.$$ file to
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User# an appropriately escaped pattern which can be used to grep into minor_perm.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # the first argument is the 'key' field from the change file.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # entries can contain shell globbing characters to match
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # several devices - hence all the palaver below.
94479b38340a00f0daf0ae0e1d3d673f845609ffTinderbox User # the remaining optional arguments are tokens separated by white-space
94479b38340a00f0daf0ae0e1d3d673f845609ffTinderbox User if [ $# = 0 ] ; then
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if [ ! -f $dest ] ; then
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # Process the list of devices whose attributes are to be
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # changed. Find those that actually need to be
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # applied to the file. For each change that needs
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # to be applied, add an entry for it to the sed
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # script that will eventually be applied to the
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # currently-installed /etc/minor_perm file. Also,
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # add an entry to the /tmp/chdevs.$$ file, which
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # contains the list of logical names of devices
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # whose permissions need to be changed.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User while read key oldp oldu oldg newp newu newg chdevs
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # First determine whether the device entry
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # is already in the file, but with the old
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # permissions. If so, the entry needs to be
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # modified and the devices in the chdevs list
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # need to have their permissions and ownerships
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User grepstr=`entry2pattern "${key}" $oldp $oldu $oldg`
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if grep "$grepstr" $dest > /dev/null 2>&1; then
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User echo "s/${grepstr}/$key $newp $newu $newg/" \
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # Now determine whether the device entry is
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # in the file at all. If not, it is a new
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # entry, but there may already be devices
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # on the system whose permissions need to
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # be changed.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if [ $? != 0 ] ; then
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if [ $do_chdevs = yes -a "$chdevs" != "" ] ; then
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # sort the "change attributes" list
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # Process the list of devices to be deleted.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # Find those that actually need to be deleted
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # from the file. For each entry to be deleted,
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # add an entry for it to the sed script that will
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # eventually be applied to the currently-installed
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # /etc/minor_perm file. Also, add an entry to the
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # /tmp/deldevs.$$ file, which contains the list of
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # logical names of devices to be deleted.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if grep "$grepstr" $dest > /dev/null 2>&1; then
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # Apply the sed script possibly built above to the
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # currently-installed /etc/minor_perm file.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # For all entries in minor_perm whose attributes had
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # to be corrected, correct the relevant attributes of the
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # already-existing devices that correspond to those
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if [ -s /tmp/chdevs.$$ -a "$PKG_INSTALL_ROOT" != "" -a \
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User while read device oldp oldu oldg newp newu newg
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # Note that we take pains -only- to change
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # the permission/ownership of devices that
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # have kept their original permissions.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # For all entries in minor_perm that were deleted,
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # remove the /dev entries that point to device nodes
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # that correspond to those entries.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if [ -s /tmp/deldevs.$$ -a "$PKG_INSTALL_ROOT" != "" -a \
94479b38340a00f0daf0ae0e1d3d673f845609ffTinderbox User if [ $? != 0 ] ; then