Print this page
XXX Remove nawk(1)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/lvm/util/svc-metasync
+++ new/usr/src/cmd/lvm/util/svc-metasync
1 1 #!/bin/sh
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 #
23 23 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 -# ident "%Z%%M% %I% %E% SMI"
27 -#
28 26 # Start mirror resync threads.
29 27
30 28 DEVFSADM=/usr/sbin/devfsadm
31 29 METADEVADM=/usr/sbin/metadevadm
32 30 METASYNC=/usr/sbin/metasync
33 31 METADEV=/dev/md/admin
34 32 METASET=/usr/sbin/metaset
35 33 TMPFILE=/var/run/metaset.$$
36 34
37 35 . /lib/svc/share/smf_include.sh
38 36
39 37 print_verbose()
40 38 {
41 39 echo "Unable to resolve unnamed devices for volume management."
42 40 echo "Please refer to the Solaris Volume Manager documentation,"
43 41 echo "Troubleshooting section, at http://docs.sun.com or from"
44 42 echo "your local copy."
45 43 }
46 44
47 45 resolve_auto_take_sets()
48 46 {
49 47 if [ -x $METASET ]; then
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
50 48 # Fixing up of the ctd names for devices in auto take
51 49 # sets relies heavily on the output of the metaset
52 50 # command. Any change to the output of the metaset command
53 51 # should modify this script as well in order ensure nothing
54 52 # breaks
55 53 #
56 54 # The following command saves all of the auto-take set names
57 55 # into the TMPFILE
58 56 name_str=`gettext "Set name"`
59 57 mn_str=`gettext "Multi-owner"`
60 - $METASET | /bin/nawk -F ' |\t|,' -v snm="$name_str" \
58 + $METASET | /usr/xpg4/bin/awk -F ' |\t|,' -v snm="$name_str" \
61 59 -v mstr="$mn_str" '$0 ~ snm { \
62 60 if (index($0, mstr) == 0) print $4 \
63 61 }' > $TMPFILE 2>&1
64 62
65 63 if [ -s "$TMPFILE" ]; then
66 64 localised_string=`gettext "Yes (auto)"`
67 65 for i in `cat $TMPFILE`; do
68 66 $METASET -s $i | grep "$localised_string" \
69 67 > /dev/null 2>&1
70 68 if [ $? -eq 0 ]; then
71 69 $METADEVADM -l -r -s $i
72 70 error=$?
73 71 case $error in
74 72 0|2) ;;
75 73 3) print_verbose
76 74 ;;
77 75 *) echo "$METADEVADM \
78 76 -r failure $error."
79 77 ;;
80 78 esac
81 79 fi
82 80 done
83 81 fi
84 82 if [ -f "$TMPFILE" ]; then
85 83 /usr/bin/rm -f $TMPFILE
86 84 fi
87 85 fi
88 86 }
89 87
90 88 if [ ! -s /kernel/drv/md.conf ]; then
91 89 echo "/kernel/drv/md.conf is missing."
92 90 exit 0
93 91 fi
94 92
95 93 if grep '^mddb_bootlist' /kernel/drv/md.conf >/dev/null 2>&1; then :; else
96 94 echo "No 'mddb_bootlist' entry in /kernel/drv/md.conf."
97 95 exit 0
98 96 fi
99 97
100 98 if [ ! -x $METADEVADM ]; then
101 99 echo "$METADEVADM is missing or not executable."
102 100 exit $SMF_EXIT_ERR_CONFIG
103 101 fi
104 102
105 103 if [ ! -x $METASYNC ]; then
106 104 echo "$METASYNC is missing or not executable."
107 105 exit $SMF_EXIT_ERR_CONFIG
108 106 fi
109 107
110 108 if [ ! -c $METADEV ]; then
111 109 echo "$METADEV is missing or not a character device."
112 110 exit 0
113 111 fi
114 112
115 113 $METADEVADM -l -r
116 114 error=$?
117 115 case $error in
118 116 0|2) ;;
119 117
120 118 3) echo "Executing devfsadm"
121 119 $DEVFSADM
122 120 devfsadmerror=$?
123 121 if [ $devfsadmerror = 0 ]; then
124 122 echo "Executing metadevadm -r"
125 123 $METADEVADM -l -r
126 124 error=$?
127 125 fi
128 126 if [ $devfsadmerror != 0 -o $error = 3 ]; then
129 127 print_verbose
130 128 elif [ $error != 0 -a $error != 2 ]; then
131 129 echo "$METADEVADM -r failure $error."
132 130 fi
133 131 ;;
134 132
135 133 *) echo "$METADEVADM -r failure $error."
136 134 exit 1
137 135 ;;
138 136 esac
139 137
140 138 resolve_auto_take_sets
141 139
142 140 $METASYNC -r
143 141 error=$?
144 142 case $error in
145 143 0) ;;
146 144
147 145 *) echo "Unknown $METASYNC -r failure $error."
148 146 exit 1
149 147 ;;
150 148 esac
151 149
↓ open down ↓ |
81 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX