postremove revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# ident "%Z%%M% %I% %E% SMI"
# SUNWpd postremove script
# Copyright (c) 1995,1999-2000 by Sun Microsystems, Inc.
# All rights reserved.
}
export PATH
status=0
NAMEMAJOR="${BASEDIR}/etc/name_to_major"
MINORPERM="${BASEDIR}/etc/minor_perm"
then
echo "rem_major: data file \'${NAMEMAJOR}\' is missing/inaccessible." >&2
exit 1
fi
then
fi
echo "rem_devlink: data file ${DEVLINKTB} is missing/inaccessible." >&2
exit 1
fi
echo "rem_drv_alias: data file ${DRIVERALS} is missing/inaccessible." >&2
exit 1
fi
trap "rm -f /tmp/$$.*;exit 1" 1 2 3 13 15
# removes major numbers from system for device drivers
# Usage:
# rem_major name1 name2 name3 name4 ....
{
NR == 1 {n=split(namelist,x)
if (n < 1)
exit(1)
for (i=1; i<=n; i++)
chklist[x[i]]++
}
{if ($1 in chklist)
print
}
then
fi
}
# removes minor permissions from system for device drivers
# Usage:
# rem_minor name1 name2 name3 name4 ....
# i.e.
# rem_minor 'sd:*' 'sd:a'
{
for p in "$@"
do echo "$p"
done | nawk '#
FILENAME != "-" {permtab[$1] = $0;next}
FILENAME == "-" {
if ($1 !~ /:/) {
printf("Bad name:minor pair: %s, skipping.\n", $1)
next
}
if ($1 in permtab)
print permtab[$1] >> permdel
next
}
then
fi
}
# removes entries from devlink.tab file
# Usage:
# rem_devlink spec1 spec2 spec3 spec4 ...
#
# where each <spec> is:
# <devfs-spec> <dev-name> <dev-link>
#
#
{
while test $# -ge 2
do
echo "$1 $2"
shift 2
done | nawk '-F ' '#
FILENAME != "-" {devlinktab[$1] = $0;next}
FILENAME == "-" {if ($1 in devlinktab)
print devlinktab[$1] >> devlinktmp
}
' devlinktmp=$TMP.devlink ${DEVLINKTB} - >&2
then
fi
}
# removes entries to driver_aliases file
# Usage:
# rem_drv_alias spec1 spec2 spec3
#
# where spec is:
# <driver> <alias>
#
{
while test $# -ge 2
do
echo "$1 $2"
shift 2
done | nawk '#
FILENAME != "-" {drvalias[$1] = $0;next}
FILENAME == "-" {if ($1 in drvalias)
print drvalias[$1] >> drvaliastmp
}
' drvaliastmp=$TMP.drvalias ${DRIVERALS} - >&2
then
# echo Removing
# cat $TMP.drvalias
fi
}
# Remove drivers if installed
if [ "$modnum" = "1" ]; then
fi
exit $status