i.minorperm_i386 revision 40db2e2b777b79f3dd0d6d9629593a07f86b9c0a
7e5b2100ea65658a7ec3795919b4ecd29a6f118aMark Andrews# CDDL HEADER START
eae67738cba5ca069e9d1d4e7b836a2f7b00a374Mark Andrews# The contents of this file are subject to the terms of the
2a40fdc2d34adb8a5c72a748449699666032d461Mark Andrews# Common Development and Distribution License (the "License").
46e873c835bf7d9ec3e1097e0aceb8db5b1ae93aMark Andrews# You may not use this file except in compliance with the License.
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# or http://www.opensolaris.org/os/licensing.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# See the License for the specific language governing permissions
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# and limitations under the License.
d56e188030368b835122d759ebbf8d9613c166f4Mark Andrews# When distributing Covered Code, include this CDDL HEADER in each
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# CDDL HEADER END
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Use is subject to license terms.
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews#ident "%Z%%M% %I% %E% SMI"
b6617c5adad7f12e5fcde1e873f7b982d247fe05Mark Andrews# NOTE: When a change is made to the source file for
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# /etc/minor_perm, a corresponding change must be made to
b6617c5adad7f12e5fcde1e873f7b982d247fe05Mark Andrews# this class-action script.
a3b428812703d22a605a9f882e71ed65f0ffdc65Mark Andrews# - If an existing entry in minor_perm is having its
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# attributes e.g. permissions, ownership changed,
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews# add it to the list produced by make_chattr_list below.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# - If an existing entry must be deleted, add it to
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews# the list produced by make_delete_list below.
c069a20053d41ae299eb9457e50ea44ae9f73ed2Mark Andrews# - If a new entry must be added to the file, add it to the
ed178efa9ab8f813538fce4ff603b81ded9f1799Mark Andrews# list produced by make_add_list.
605bd686e437162b5ab65ac4e7c1be0bba1886ddMark Andrews# - If a new entry is being added to minor_perm, but there
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# may already be devices of that name on the system (e.g.
3f6174bffe227be44e241a29d186add00c032ff6Mark Andrews# we used the system default permissions in a previous release),
1eb1e1e838d2ea00b166c918bf50764a95826be8Mark Andrews# and those old devices now need to have their attributes changed,
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# add it to the make_chattr_list AND the make_add_list lists
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# If an entry in /etc/minor_perm needs to have its attributes
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# changed, identify the entry in the list copied to /etc/chattr.$$
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# by this function. The fields are:
992616aaf75643a0c9f84826f0a1ed5a27e84328Mark Andrews# <device>:<minor> <old_attrs> <new_attrs> <optional list of logical
821d2613356f81e5bb5c107288d6d5cf35c2a1e8Mark Andrews# devices whose attributes
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# will need to be changed>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# where an <attribute list> := <perm> <user> <group>
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# NOTE: this list should also contain entries for nodes that previously
7e5b2100ea65658a7ec3795919b4ecd29a6f118aMark Andrews# were not in /etc/minor_perm (which means the default mode of 600,
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# owner/group == root/sys), but now have an entry
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsvol:volctl 0600 root sys 0666 root sys /dev/volctl
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewsclone:llc1 0600 root sys 0666 root sys /dev/llc1
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrewsclone:sound,sbpro 0666 root sys 0600 root sys /dev/sound/*
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrewssbpro:* 0666 root sys 0600 root sys /dev/sound/*
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrewslog:conslog 0620 root sys 0666 root sys /dev/conslog
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonsy:tty 0666 root sys 0666 root tty /dev/tty
992616aaf75643a0c9f84826f0a1ed5a27e84328Mark Andrewsicmp:icmp 0600 root sys 0666 root sys /dev/rawip
821d2613356f81e5bb5c107288d6d5cf35c2a1e8Mark Andrewsicmp6:icmp6 0600 root sys 0666 root sys /dev/rawip6
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonip:ip 0660 root sys 0666 root sys /dev/ip
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrewsip6:ip6 0660 root sys 0666 root sys /dev/ip6
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonrts:rts 0660 root sys 0666 root sys /dev/rts
992616aaf75643a0c9f84826f0a1ed5a27e84328Mark Andrewskeysock:keysock 0600 root sys 0666 root sys /dev/keysock
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonipsecah:ipsecah 0600 root sys 0666 root sys /dev/ipsecah
45eca3a5d46ed15aee14d81f6cb6c9fb6f365344Mark Andrewsipsecesp:ipsecesp 0600 root sys 0666 root sys /dev/ipsecesp
45eca3a5d46ed15aee14d81f6cb6c9fb6f365344Mark Andrewsspdsock:spdsock 0600 root sys 0666 root sys /dev/spdsock
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewssad:admin 0600 root sys 0666 root sys /dev/sad/admin
46e873c835bf7d9ec3e1097e0aceb8db5b1ae93aMark Andrewsfssnap:ctl 0600 root sys 0666 root sys /dev/fssnapctl
46e873c835bf7d9ec3e1097e0aceb8db5b1ae93aMark Andrewsfssnap:* 0600 root sys 0640 root sys /dev/fssnap/*
dd9ad704c3800e3ab07ede8595871eac79984871Mark Andrewsclone:dnet 0600 root sys 0666 root sys /dev/dnet
605bd686e437162b5ab65ac4e7c1be0bba1886ddMark Andrewsdnet:* 0600 root sys 0666 root sys /dev/dnet*
45eca3a5d46ed15aee14d81f6cb6c9fb6f365344Mark Andrewsclone:elxl 0600 root sys 0666 root sys /dev/elxl
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewselxl:* 0600 root sys 0666 root sys /dev/elxl*
ab81f57ca0c3addfec3df3babdcea9644757cf23Mark Andrewsclone:iprb 0600 root sys 0666 root sys /dev/iprb
605bd686e437162b5ab65ac4e7c1be0bba1886ddMark Andrewsiprb:* 0600 root sys 0666 root sys /dev/iprb*
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsclone:pcelx 0600 root sys 0666 root sys /dev/pcelx
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewspcelx:* 0600 root sys 0666 root sys /dev/pcelx*
413988c8166976498250c0ebb2e3a645d0366bd3Mark Andrewsclone:spwr 0600 root sys 0666 root sys /dev/spwr
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsspwr:* 0600 root sys 0666 root sys /dev/spwr*
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewscpc:* 0600 root sys 0666 root sys /devices/pseudo/cpc*
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsipf:* 0600 root sys 0666 root sys /dev/ipf
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewspfil:* 0600 root sys 0666 root sys /dev/pfil
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsscsi_vhci:devctl 0600 root sys 0666 root sys /devices/scsi_vhci:devctl
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsfbt:fbt 0600 root sys 0644 root sys /dev/dtrace/provider/fbt
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewslockstat:* 0600 root sys 0644 root sys /dev/dtrace/provider/lockstat
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsprofile:profile 0600 root sys 0644 root sys /dev/dtrace/provider/profile
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewssdt:sdt 0600 root sys 0644 root sys /dev/dtrace/provider/sdt
642e0716c8b4ab82ebc8e60f94c9e897ee89f19aMark Andrewssystrace:systrace 0600 root sys 0644 root sys /dev/dtrace/provider/systrace
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsclone:bge 0600 root sys 0666 root sys /dev/bge
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsclone:ixgbe 0600 root sys 0666 root sys /dev/ixgbe
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsclone:rge 0600 root sys 0666 root sys /dev/rge
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsclone:xge 0600 root sys 0666 root sys /dev/xge
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsclone:nge 0600 root sys 0666 root sys /dev/nge
45eca3a5d46ed15aee14d81f6cb6c9fb6f365344Mark Andrewsclone:chxge 0600 root sys 0666 root sys /dev/chxge
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsclone:pcn 0600 root sys 0666 root sys /dev/pcn
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsclone:rtls 0600 root sys 0666 root sys /dev/rtls
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsclone:ath 0600 root sys 0666 root sys /dev/ath
d3a3e690ab1f87fa02b3fa77be5ddea5c1fe0cd4Mark Andrewsclone:ipw 0600 root sys 0666 root sys /dev/ipw
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsclone:iwi 0600 root sys 0666 root sys /dev/iwi
d56e188030368b835122d759ebbf8d9613c166f4Mark Andrewsclone:iwk 0600 root sys 0666 root sys /dev/iwk
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsclone:pcwl 0600 root sys 0666 root sys /dev/pcwl
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsclone:pcan 0600 root sys 0666 root sys /dev/pcan
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsclone:ral 0600 root sys 0666 root sys /dev/ral
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsclone:rtw 0600 root sys 0666 root sys /dev/rtw
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsclone:ural 0600 root sys 0666 root sys /dev/ural
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsclone:wpi 0600 root sys 0666 root sys /dev/wpi
b7aab05edae933e169d5f83c653935b17c7f0a8bMark Andrewsclone:afe 0600 root sys 0666 root sys /dev/afe
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsclone:dmfe 0600 root sys 0666 root sys /dev/dmfe
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsclone:mxfe 0600 root sys 0666 root sys /dev/mxfe
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsbge:* 0600 root sys 0666 root sys /dev/bge*
ed178efa9ab8f813538fce4ff603b81ded9f1799Mark Andrewsixgbe:* 0600 root sys 0666 root sys /dev/ixgbe*
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsrge:* 0600 root sys 0666 root sys /dev/rge*
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsxge:* 0600 root sys 0666 root sys /dev/xge*
46e873c835bf7d9ec3e1097e0aceb8db5b1ae93aMark Andrewsnge:* 0600 root sys 0666 root sys /dev/nge*
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewse1000g:* 0666 root root 0666 root sys /dev/e1000g*
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewschxge:* 0600 root sys 0666 root sys /dev/chxge*
46e873c835bf7d9ec3e1097e0aceb8db5b1ae93aMark Andrewspcn:* 0600 root sys 0666 root sys /dev/pcn*
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsrtls:* 0600 root sys 0666 root sys /dev/rtls*
dd9ad704c3800e3ab07ede8595871eac79984871Mark Andrewsath:* 0600 root sys 0666 root sys /dev/ath*
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsipw:* 0600 root sys 0666 root sys /dev/ipw*
0d3490f93bb980fde704055e74c1b508987a5fe4Mark Andrewsiwi:* 0600 root sys 0666 root sys /dev/iwi*
46e873c835bf7d9ec3e1097e0aceb8db5b1ae93aMark Andrewsiwk:* 0600 root sys 0666 root sys /dev/iwk*
46e873c835bf7d9ec3e1097e0aceb8db5b1ae93aMark Andrewspcwl:* 0600 root sys 0666 root sys /dev/pcwl*
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewspcan:* 0600 root sys 0666 root sys /dev/pcan*
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsral:* 0600 root sys 0666 root sys /dev/ral*
605bd686e437162b5ab65ac4e7c1be0bba1886ddMark Andrewsrtw:* 0600 root sys 0666 root sys /dev/rtw*
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonural:* 0600 root sys 0666 root sys /dev/ural*
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewswpi:* 0600 root sys 0666 root sys /dev/wpi*
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsafe:* 0600 root sys 0666 root sys /dev/afe*
62ee2c9f460d2e2e45dcf1abc8b4b4a4a43f5618Mark Andrewsdmfe:* 0600 root sys 0666 root sys /dev/dmfe*
1eb1e1e838d2ea00b166c918bf50764a95826be8Mark Andrewsmxfe:* 0600 root sys 0666 root sys /dev/mxfe*
992616aaf75643a0c9f84826f0a1ed5a27e84328Mark Andrews# If an entry in /etc/minor_perm needs to be deleted, identify
45eca3a5d46ed15aee14d81f6cb6c9fb6f365344Mark Andrews# the entry in the list copied to /etc/delete.$$ by this function.
ca12f7f4cf72e2368ee946f3eb4915ab73576cdcMark Andrews# The fields are:
1eb1e1e838d2ea00b166c918bf50764a95826be8Mark Andrews# <device>:<minor> <optional list of logical devices to be deleted>
821d2613356f81e5bb5c107288d6d5cf35c2a1e8Mark Andrewsconsfb:consfb
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewsclone:ipsecah
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsclone:ipsecesp
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsclone:keysock
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsprofile:profile
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# If an entry needs to be added to /etc/minor_perm, add the first
992616aaf75643a0c9f84826f0a1ed5a27e84328Mark Andrews# field of the entry to the list created by this function. The
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# remainder of the entry will be extracted from the /etc/minor_perm
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# in the package being installed, so it is not necessary to supply
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrewsdevinfo:devinfo
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonopeneepr:openprom
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonipsecah:ipsecah
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonipsecesp:ipsecesp
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonkeysock:keysock
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonspdsock:spdsock
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtondevinfo:devinfo,ro
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtoncryptoadm:cryptoadm
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonfasttrap:fasttrap
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonprofile:profile
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewssystrace:systrace
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonlx_ptm:lx_ptmajor
01bf5871f8861eb805dd8ca79bdb9b0b9e4e6a5eMark Andrewslx_systrace:*
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian WellingtonPATH="/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# Internal routine to create a sed script which can be used to
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# escape all shell globbing metacharacters in a path.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# Internal routine to convert an entry in a /tmp/chwhatever.$$ file to
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# an appropriately escaped pattern which can be used to grep into minor_perm.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # the first argument is the 'key' field from the change file.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # entries can contain shell globbing characters to match
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # several devices - hence all the palaver below.
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews # the remaining optional arguments are tokens separated by white-space
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews if [ $# = 0 ] ; then
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington if [ ! -f $dest ] ; then
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # Process the list of devices whose attributes are to be
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # changed. Find those that actually need to be
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # applied to the file. For each change that needs
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # to be applied, add an entry for it to the sed
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # script that will eventually be applied to the
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # currently-installed /etc/minor_perm file. Also,
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # add an entry to the /tmp/chdevs.$$ file, which
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # contains the list of logical names of devices
bf54ac86eeddce16b67c525d38d1096cc956f478Mark Andrews # whose permissions need to be changed.
abf32d940f8f674b3971ef41b306a01b3da8d2cfMark Andrews while read key oldp oldu oldg newp newu newg chdevs
eaccf5e805405de257b5a4840256c580fefe00e3Mark Andrews # First determine whether the device entry
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # is already in the file, but with the old
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # permissions. If so, the entry needs to be
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews # modified and the devices in the chdevs list
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # need to have their permissions and ownerships
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews grepstr=`entry2pattern "${key}" $oldp $oldu $oldg`
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews if grep "$grepstr" $dest > /dev/null 2>&1; then
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews echo "s/${grepstr}/$key $newp $newu $newg/" \
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington # Now determine whether the device entry is
821d2613356f81e5bb5c107288d6d5cf35c2a1e8Mark Andrews # in the file at all. If not, it is a new
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # entry, but there may already be devices
2bef3713093349af52ba61eaab07adf3207da873Mark Andrews # on the system whose permissions need to
2bef3713093349af52ba61eaab07adf3207da873Mark Andrews # be changed.
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews if [ $? != 0 ] ; then
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews if [ $do_chdevs = yes -a "$chdevs" != "" ] ; then
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # sort the "change attributes" list
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # Process the list of devices to be deleted.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # Find those that actually need to be deleted
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # from the file. For each entry to be deleted,
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews # add an entry for it to the sed script that will
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # eventually be applied to the currently-installed
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # /etc/minor_perm file. Also, add an entry to the
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews # /tmp/deldevs.$$ file, which contains the list of
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # logical names of devices to be deleted.
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews if grep "$grepstr" $dest > /dev/null 2>&1; then
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # Apply the sed script possibly built above to the
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # currently-installed /etc/minor_perm file.
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews # For all entries in minor_perm whose attributes had
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews # to be corrected, correct the relevant attributes of the
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # already-existing devices that correspond to those
2da2220fe7af2c45724b50b0187523b1fab0cf08Rob Austein if [ -s /tmp/chdevs.$$ -a "$PKG_INSTALL_ROOT" != "" -a \
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews while read device oldp oldu oldg newp newu newg
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # Note that we take pains -only- to change
3a9a66b32adf379e680d18e92428058910880119Mark Andrews # the permission/ownership of devices that
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # have kept their original permissions.
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews # For all entries in minor_perm that were deleted,
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews # remove the /dev entries that point to device nodes
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # that correspond to those entries.
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews if [ -s /tmp/deldevs.$$ -a "$PKG_INSTALL_ROOT" != "" -a \
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington if [ $? != 0 ] ; then