Cross Reference: /illumos-gate/usr/src/pkgdefs/SUNWudapltr/preremove
preremove revision 7c478bd95313f5f23a4c958a745db2134aa03244
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
#
#pragma ident "%Z%%M% %I% %E% SMI"
#
# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH
#
# Driver info
#
DRV=daplt
REM_DRV=/usr/sbin/rem_drv
#
# Select the correct rem_drv options to execute.
# rem_drv touches /reconfigure to cause the
# next boot to be a reconfigure boot.
#
if [ "${BASEDIR}" = "/" ]; then
#
# On a running system, modify the
# system files and remove the driver
#
REM_DRV_FLAGS=""
else
#
# On a client, modify the system files
# relative to BASEDIR
#
REM_DRV_FLAGS="-b ${BASEDIR}"
fi
${REM_DRV} ${REM_DRV_FLAGS} ${DRV} || exit 1
# After the service provider has been removed, remove the entries for the
# service provider from /etc/dat/dat.conf to cleanup the state.
# We might not be able to run datadm(1m) here to cleanup the state because
# it might not be on the machine that pkgrm is invoked on so we run datadm
# only if {BASEDIR} is "/".
if [ "${BASEDIR}" = "/" ]; then
#
# On a running system, modify the
# dat.conf file using datadm
#
SPCONF=/usr/share/dat/SUNWudaplt.conf
DATADM=/usr/sbin/datadm
if [ -r "${SPCONF}" ]; then
${DATADM} -r ${SPCONF}
if [ $? -ne 0 ]; then
echo "datadm -r failed"
exit 1
fi
exit 0
else
echo "SUNWudaplt.conf does not exist. Cannot do datadm -r"
exit 1
fi
else
#
# If not on a running system (i.e, running on a client), modify
# the dat.conf file relative to $BASEDIR
#
DATCONF=${BASEDIR}/etc/dat/dat.conf
TMPDATCONF=${DATCONF}.$$.tmp
rm -f $TMPDATCONF
sed -e "/driver_name=tavor/d" $DATCONF > $TMPDATCONF
if [ $? -eq 0 ]; then
mv -f $TMPDATCONF $DATCONF
else
exit 1
fi
fi
exit 0