1 |
robbat2 08/10/11 02:47:50 |
2 |
|
3 |
Modified: init.d-pciparm |
4 |
Log: |
5 |
Cleanup init script more. |
6 |
(Portage version: 2.2_rc11/cvs/Linux 2.6.27-rc1-10246-gca5de40 x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.3 sys-apps/pciutils/files/init.d-pciparm |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm?rev=1.3&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm?rev=1.3&content-type=text/plain |
13 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm?r1=1.2&r2=1.3 |
14 |
|
15 |
Index: init.d-pciparm |
16 |
=================================================================== |
17 |
RCS file: /var/cvsroot/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm,v |
18 |
retrieving revision 1.2 |
19 |
retrieving revision 1.3 |
20 |
diff -p -w -b -B -u -u -r1.2 -r1.3 |
21 |
--- init.d-pciparm 8 Oct 2008 21:04:16 -0000 1.2 |
22 |
+++ init.d-pciparm 11 Oct 2008 02:47:50 -0000 1.3 |
23 |
@@ -1,7 +1,7 @@ |
24 |
#!/sbin/runscript |
25 |
# Copyright 1999-2004 Gentoo Foundation |
26 |
# Distributed under the terms of the GNU General Public License v2 |
27 |
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm,v 1.2 2008/10/08 21:04:16 robbat2 Exp $ |
28 |
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm,v 1.3 2008/10/11 02:47:50 robbat2 Exp $ |
29 |
|
30 |
depend() { |
31 |
before bootmisc hdparm |
32 |
@@ -23,27 +23,28 @@ checkconfig() { |
33 |
do_setpci() { |
34 |
#ewarn "do_setpci: /usr/sbin/setpci $SETPCI_OPT $@" |
35 |
SWITCH=$1 |
36 |
+ SPEC_ID=$2 |
37 |
+ shift 2 |
38 |
case "$SWITCH" in |
39 |
- -d) DESC="(vendor)" ;; |
40 |
- -s) DESC="(bus)" ;; |
41 |
- *) eerror "Unknown setpci type!" ; return 1 ;; |
42 |
+ -d) DESC=vendor ;; |
43 |
+ -s) DESC=bus ;; |
44 |
+ *) eerror "Unknown setpci type: $SWITCH" ; return 1 ;; |
45 |
esac |
46 |
- shift |
47 |
- SPEC_ID=$1 |
48 |
- shift |
49 |
- if [[ -z "$SPEC_ID" ]]; then |
50 |
+ |
51 |
+ if [ -z "$SPEC_ID" ]; then |
52 |
eerror "Missing device specifier!" |
53 |
return 1 |
54 |
fi |
55 |
- if [[ -z "$@" ]]; then |
56 |
- eerror "Missing configuration to set for $DESC $SPEC_ID!" |
57 |
+ if [ -z "$*" ]; then |
58 |
+ eerror "Missing configuration to set for ($DESC) $SPEC_ID!" |
59 |
return 1 |
60 |
fi |
61 |
- ebegin "Setting PCI params for $DESC $SPEC_ID to $@" |
62 |
+ |
63 |
+ ebegin "Setting PCI params for ($DESC) $SPEC_ID to $@" |
64 |
/usr/sbin/setpci $SETPCI_OPT $SWITCH $SPEC_ID "$@" |
65 |
- eend $? |
66 |
- SWITCH="" |
67 |
- SPEC_ID="" |
68 |
+ rc=$? |
69 |
+ eend $rc |
70 |
+ return $rc |
71 |
} |
72 |
|
73 |
do_setpci_array() { |
74 |
@@ -52,8 +53,11 @@ do_setpci_array() { |
75 |
i=0 |
76 |
while true; do |
77 |
eval opt="\$${name}_$i" |
78 |
- [[ -z "$opt" ]] && break |
79 |
- do_setpci "$*" $opt |
80 |
+ # End of loop |
81 |
+ [ -z "${opt}" ] && break |
82 |
+ # Pass in all other parameters here, in case we want to use multiple |
83 |
+ # arguments later. |
84 |
+ do_setpci "$@" $opt #|| return 1 |
85 |
i=$(($i+1)) |
86 |
done |
87 |
} |
88 |
@@ -66,9 +70,11 @@ start() { |
89 |
|
90 |
checkconfig || return 1 |
91 |
|
92 |
- [[ -n "$PCIPARM_ALL" ]] && \ |
93 |
- do_setpci -d '*:*' $PCIPARM_ALL |
94 |
+ # We do not exit after any errors presently, because it might be a |
95 |
+ # stability-related fix after a failure. |
96 |
+ [ -n "$PCIPARM_ALL" ] && \ |
97 |
+ do_setpci -d '*:*' $PCIPARM_ALL #|| return 1 |
98 |
|
99 |
- do_setpci_array PCIPARM_BUS -s |
100 |
- do_setpci_array PCIPARM_VENDOR -d |
101 |
+ do_setpci_array PCIPARM_BUS -s #|| return 1 |
102 |
+ do_setpci_array PCIPARM_VENDOR -d #|| return 1 |
103 |
} |