i.minorperm_i386 revision 4bff34e37def8a90f9194d81bc345c52ba20086a
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# CDDL HEADER START
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# The contents of this file are subject to the terms of the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Common Development and Distribution License (the "License").
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# You may not use this file except in compliance with the License.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# See the License for the specific language governing permissions
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# and limitations under the License.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# When distributing Covered Code, include this CDDL HEADER in each
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# If applicable, add the following below this CDDL HEADER, with the
3ce014e9afe4abc756f9aee363c8f4bfcded9b04Automatic Updater# fields enclosed by brackets "[]" replaced with your own identifying
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# information: Portions Copyright [yyyy] [name of copyright owner]
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# CDDL HEADER END
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Use is subject to license terms.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#ident "%Z%%M% %I% %E% SMI"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# NOTE: When a change is made to the source file for
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews# /etc/minor_perm, a corresponding change must be made to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# this class-action script.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# - If an existing entry in minor_perm is having its
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# attributes e.g. permissions, ownership changed,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# add it to the list produced by make_chattr_list below.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# - If an existing entry must be deleted, add it to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the list produced by make_delete_list below.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# - If a new entry must be added to the file, add it to the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# list produced by make_add_list.
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews# - If a new entry is being added to minor_perm, but there
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# may already be devices of that name on the system (e.g.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# we used the system default permissions in a previous release),
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# and those old devices now need to have their attributes changed,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# add it to the make_chattr_list AND the make_add_list lists
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# If an entry in /etc/minor_perm needs to have its attributes
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# changed, identify the entry in the list copied to /etc/chattr.$$
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# by this function. The fields are:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# <device>:<minor> <old_attrs> <new_attrs> <optional list of logical
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# devices whose attributes
3acf5eb97cebc2ba868e6ac4a4e01e6d1be0c892Automatic Updater# will need to be changed>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# where an <attribute list> := <perm> <user> <group>
3acf5eb97cebc2ba868e6ac4a4e01e6d1be0c892Automatic Updater# NOTE: this list should also contain entries for nodes that previously
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# were not in /etc/minor_perm (which means the default mode of 600,
3acf5eb97cebc2ba868e6ac4a4e01e6d1be0c892Automatic Updater# owner/group == root/sys), but now have an entry
3acf5eb97cebc2ba868e6ac4a4e01e6d1be0c892Automatic Updatervol:volctl 0600 root sys 0666 root sys /dev/volctl
3acf5eb97cebc2ba868e6ac4a4e01e6d1be0c892Automatic Updaterclone:llc1 0600 root sys 0666 root sys /dev/llc1
3acf5eb97cebc2ba868e6ac4a4e01e6d1be0c892Automatic Updaterclone:sound,sbpro 0666 root sys 0600 root sys /dev/sound/*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinsbpro:* 0666 root sys 0600 root sys /dev/sound/*
3acf5eb97cebc2ba868e6ac4a4e01e6d1be0c892Automatic Updaterlog:conslog 0620 root sys 0666 root sys /dev/conslog
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinsy:tty 0666 root sys 0666 root tty /dev/tty
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinicmp:icmp 0600 root sys 0666 root sys /dev/rawip
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinicmp6:icmp6 0600 root sys 0666 root sys /dev/rawip6
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinip:ip 0660 root sys 0666 root sys /dev/ip
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinip6:ip6 0660 root sys 0666 root sys /dev/ip6
a1ad6695ed6f988406cf155aa26376f84f73bcb9Automatic Updaterrts:rts 0660 root sys 0666 root sys /dev/rts
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updaterkeysock:keysock 0600 root sys 0666 root sys /dev/keysock
a1ad6695ed6f988406cf155aa26376f84f73bcb9Automatic Updateripsecah:ipsecah 0600 root sys 0666 root sys /dev/ipsecah
44d0f0256fbdce130a18655023c3b06bacacbd61Automatic Updateripsecesp:ipsecesp 0600 root sys 0666 root sys /dev/ipsecesp
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updaterspdsock:spdsock 0600 root sys 0666 root sys /dev/spdsock
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updatersad:admin 0600 root sys 0666 root sys /dev/sad/admin
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updaterfssnap:ctl 0600 root sys 0666 root sys /dev/fssnapctl
44d0f0256fbdce130a18655023c3b06bacacbd61Automatic Updaterfssnap:* 0600 root sys 0640 root sys /dev/fssnap/*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:dnet 0600 root sys 0666 root sys /dev/dnet
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeindnet:* 0600 root sys 0666 root sys /dev/dnet*
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updaterclone:elxl 0600 root sys 0666 root sys /dev/elxl
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinelxl:* 0600 root sys 0666 root sys /dev/elxl*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:iprb 0600 root sys 0666 root sys /dev/iprb
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updateriprb:* 0600 root sys 0666 root sys /dev/iprb*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:pcelx 0600 root sys 0666 root sys /dev/pcelx
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updaterpcelx:* 0600 root sys 0666 root sys /dev/pcelx*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:spwr 0600 root sys 0666 root sys /dev/spwr
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinspwr:* 0600 root sys 0666 root sys /dev/spwr*
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updatercpc:* 0600 root sys 0666 root sys /devices/pseudo/cpc*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinipf:* 0600 root sys 0666 root sys /dev/ipf
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updaterpfil:* 0600 root sys 0666 root sys /dev/pfil
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updaterscsi_vhci:devctl 0600 root sys 0666 root sys /devices/scsi_vhci:devctl
fde6bfde6ec1d7a5f9907aeea8618db9dbd02f4cAutomatic Updaterfbt:fbt 0600 root sys 0644 root sys /dev/dtrace/provider/fbt
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrewslockstat:* 0600 root sys 0644 root sys /dev/dtrace/provider/lockstat
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprofile:profile 0600 root sys 0644 root sys /dev/dtrace/provider/profile
507151045be68c671ffd4e2f37e17cdfa0376fc4Automatic Updatersdt:sdt 0600 root sys 0644 root sys /dev/dtrace/provider/sdt
507151045be68c671ffd4e2f37e17cdfa0376fc4Automatic Updatersystrace:systrace 0600 root sys 0644 root sys /dev/dtrace/provider/systrace
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:bge 0600 root sys 0666 root sys /dev/bge
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:rge 0600 root sys 0666 root sys /dev/rge
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:xge 0600 root sys 0666 root sys /dev/xge
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrewsclone:nge 0600 root sys 0666 root sys /dev/nge
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrewsclone:chxge 0600 root sys 0666 root sys /dev/chxge
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:pcn 0600 root sys 0666 root sys /dev/pcn
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrewsclone:rtls 0600 root sys 0666 root sys /dev/rtls
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrewsclone:ath 0600 root sys 0666 root sys /dev/ath
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:ipw 0600 root sys 0666 root sys /dev/ipw
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:iwi 0600 root sys 0666 root sys /dev/iwi
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrewsclone:pcwl 0600 root sys 0666 root sys /dev/pcwl
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:pcan 0600 root sys 0666 root sys /dev/pcan
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:ral 0600 root sys 0666 root sys /dev/ral
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrewsclone:rtw 0600 root sys 0666 root sys /dev/rtw
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:wpi 0600 root sys 0666 root sys /dev/wpi
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:afe 0600 root sys 0666 root sys /dev/afe
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:dmfe 0600 root sys 0666 root sys /dev/dmfe
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinclone:mxfe 0600 root sys 0666 root sys /dev/mxfe
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinbge:* 0600 root sys 0666 root sys /dev/bge*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinrge:* 0600 root sys 0666 root sys /dev/rge*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinxge:* 0600 root sys 0666 root sys /dev/xge*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinnge:* 0600 root sys 0666 root sys /dev/nge*
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrewse1000g:* 0666 root root 0666 root sys /dev/e1000g*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinchxge:* 0600 root sys 0666 root sys /dev/chxge*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinpcn:* 0600 root sys 0666 root sys /dev/pcn*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinrtls:* 0600 root sys 0666 root sys /dev/rtls*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinath:* 0600 root sys 0666 root sys /dev/ath*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinipw:* 0600 root sys 0666 root sys /dev/ipw*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeiniwi:* 0600 root sys 0666 root sys /dev/iwi*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinpcwl:* 0600 root sys 0666 root sys /dev/pcwl*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinpcan:* 0600 root sys 0666 root sys /dev/pcan*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinral:* 0600 root sys 0666 root sys /dev/ral*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinrtw:* 0600 root sys 0666 root sys /dev/rtw*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinwpi:* 0600 root sys 0666 root sys /dev/wpi*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinafe:* 0600 root sys 0666 root sys /dev/afe*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeindmfe:* 0600 root sys 0666 root sys /dev/dmfe*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinmxfe:* 0600 root sys 0666 root sys /dev/mxfe*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# If an entry in /etc/minor_perm needs to be deleted, identify
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the entry in the list copied to /etc/delete.$$ by this function.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# The fields are:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# <device>:<minor> <optional list of logical devices to be deleted>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinconsfb:consfb
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:ipsecah
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:ipsecesp
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclone:keysock
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsprofile:profile
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# If an entry needs to be added to /etc/minor_perm, add the first
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# field of the entry to the list created by this function. The
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# remainder of the entry will be extracted from the /etc/minor_perm
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# in the package being installed, so it is not necessary to supply
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeincat > /tmp/add.$$ << EOF
afb33f777af856f8c3382604a7a8ffdfe2b512c5Automatic Updaterdevinfo:devinfo
afb33f777af856f8c3382604a7a8ffdfe2b512c5Automatic Updateropeneepr:openprom
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinsysmsg:msglog
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinsysmsg:sysmsg
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinipsecah:ipsecah
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinipsecesp:ipsecesp
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinkeysock:keysock
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinspdsock:spdsock
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeindevinfo:devinfo,ro
ceeb18e6907a10547859faa340ecad83bedae90cMark Andrewscryptoadm:cryptoadm
ceeb18e6907a10547859faa340ecad83bedae90cMark Andrewscrypto:crypto
ceeb18e6907a10547859faa340ecad83bedae90cMark Andrewsfasttrap:fasttrap
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinsmbios:smbios
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprofile:profile
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinsystrace:systrace
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinlx_ptm:lx_ptmajor
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinlx_systrace:*
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinPATH="/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Internal routine to create a sed script which can be used to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# escape all shell globbing metacharacters in a path.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Internal routine to convert an entry in a /tmp/chwhatever.$$ file to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# an appropriately escaped pattern which can be used to grep into minor_perm.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # the first argument is the 'key' field from the change file.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # entries can contain shell globbing characters to match
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # several devices - hence all the palaver below.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # the remaining optional arguments are tokens separated by white-space
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [ $# = 0 ] ; then
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [ ! -f $dest ] ; then
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # Process the list of devices whose attributes are to be
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # changed. Find those that actually need to be
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # applied to the file. For each change that needs
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # to be applied, add an entry for it to the sed
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # script that will eventually be applied to the
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # currently-installed /etc/minor_perm file. Also,
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # add an entry to the /tmp/chdevs.$$ file, which
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # contains the list of logical names of devices
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # whose permissions need to be changed.
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater while read key oldp oldu oldg newp newu newg chdevs
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # First determine whether the device entry
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # is already in the file, but with the old
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # permissions. If so, the entry needs to be
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # modified and the devices in the chdevs list
984c2e9f76e66e86f7d9aca99a774836ddf196eaAutomatic Updater # need to have their permissions and ownerships
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein grepstr=`entry2pattern "${key}" $oldp $oldu $oldg`
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein echo "s/${grepstr}/$key $newp $newu $newg/" \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Now determine whether the device entry is
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews # in the file at all. If not, it is a new
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # entry, but there may already be devices
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # on the system whose permissions need to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # be changed.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if [ $? != 0 ] ; then
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if [ $do_chdevs = yes -a "$chdevs" != "" ] ; then
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # sort the "change attributes" list
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Process the list of devices to be deleted.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Find those that actually need to be deleted
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # from the file. For each entry to be deleted,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # add an entry for it to the sed script that will
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # eventually be applied to the currently-installed
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # /etc/minor_perm file. Also, add an entry to the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # /tmp/deldevs.$$ file, which contains the list of
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # logical names of devices to be deleted.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Apply the sed script possibly built above to the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # currently-installed /etc/minor_perm file.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # For all entries in minor_perm whose attributes had
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # to be corrected, correct the relevant attributes of the
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce # already-existing devices that correspond to those
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [ -s /tmp/chdevs.$$ -a "$PKG_INSTALL_ROOT" != "" -a \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Note that we take pains -only- to change
4556ad3a270bf049b3225433a402666aaffe3c36Mark Andrews # the permission/ownership of devices that
4556ad3a270bf049b3225433a402666aaffe3c36Mark Andrews # have kept their original permissions.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # For all entries in minor_perm that were deleted,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # remove the /dev entries that point to device nodes
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # that correspond to those entries.
4556ad3a270bf049b3225433a402666aaffe3c36Mark Andrews if [ -s /tmp/deldevs.$$ -a "$PKG_INSTALL_ROOT" != "" -a \
4556ad3a270bf049b3225433a402666aaffe3c36Mark Andrews if [ $? != 0 ] ; then