summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2008-10-11 02:47:50 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2008-10-11 02:47:50 +0000
commit1bf46cefbb0759b9436f85b91096d0a82cc42a21 (patch)
tree43c8b023e4d49d6ce5ad31b2d6be263aeb828363 /sys-apps/pciutils/files
parentEAPI 2 support (diff)
downloadgentoo-2-1bf46cefbb0759b9436f85b91096d0a82cc42a21.tar.gz
gentoo-2-1bf46cefbb0759b9436f85b91096d0a82cc42a21.tar.bz2
gentoo-2-1bf46cefbb0759b9436f85b91096d0a82cc42a21.zip
Cleanup init script more.
(Portage version: 2.2_rc11/cvs/Linux 2.6.27-rc1-10246-gca5de40 x86_64)
Diffstat (limited to 'sys-apps/pciutils/files')
-rw-r--r--sys-apps/pciutils/files/init.d-pciparm46
1 files changed, 26 insertions, 20 deletions
diff --git a/sys-apps/pciutils/files/init.d-pciparm b/sys-apps/pciutils/files/init.d-pciparm
index 56dd3b7e65be..705b647e58db 100644
--- a/sys-apps/pciutils/files/init.d-pciparm
+++ b/sys-apps/pciutils/files/init.d-pciparm
@@ -1,7 +1,7 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm,v 1.2 2008/10/08 21:04:16 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm,v 1.3 2008/10/11 02:47:50 robbat2 Exp $
depend() {
before bootmisc hdparm
@@ -23,27 +23,28 @@ checkconfig() {
do_setpci() {
#ewarn "do_setpci: /usr/sbin/setpci $SETPCI_OPT $@"
SWITCH=$1
+ SPEC_ID=$2
+ shift 2
case "$SWITCH" in
- -d) DESC="(vendor)" ;;
- -s) DESC="(bus)" ;;
- *) eerror "Unknown setpci type!" ; return 1 ;;
+ -d) DESC=vendor ;;
+ -s) DESC=bus ;;
+ *) eerror "Unknown setpci type: $SWITCH" ; return 1 ;;
esac
- shift
- SPEC_ID=$1
- shift
- if [[ -z "$SPEC_ID" ]]; then
+
+ if [ -z "$SPEC_ID" ]; then
eerror "Missing device specifier!"
return 1
fi
- if [[ -z "$@" ]]; then
- eerror "Missing configuration to set for $DESC $SPEC_ID!"
+ if [ -z "$*" ]; then
+ eerror "Missing configuration to set for ($DESC) $SPEC_ID!"
return 1
fi
- ebegin "Setting PCI params for $DESC $SPEC_ID to $@"
+
+ ebegin "Setting PCI params for ($DESC) $SPEC_ID to $@"
/usr/sbin/setpci $SETPCI_OPT $SWITCH $SPEC_ID "$@"
- eend $?
- SWITCH=""
- SPEC_ID=""
+ rc=$?
+ eend $rc
+ return $rc
}
do_setpci_array() {
@@ -52,8 +53,11 @@ do_setpci_array() {
i=0
while true; do
eval opt="\$${name}_$i"
- [[ -z "$opt" ]] && break
- do_setpci "$*" $opt
+ # End of loop
+ [ -z "${opt}" ] && break
+ # Pass in all other parameters here, in case we want to use multiple
+ # arguments later.
+ do_setpci "$@" $opt #|| return 1
i=$(($i+1))
done
}
@@ -66,9 +70,11 @@ start() {
checkconfig || return 1
- [[ -n "$PCIPARM_ALL" ]] && \
- do_setpci -d '*:*' $PCIPARM_ALL
+ # We do not exit after any errors presently, because it might be a
+ # stability-related fix after a failure.
+ [ -n "$PCIPARM_ALL" ] && \
+ do_setpci -d '*:*' $PCIPARM_ALL #|| return 1
- do_setpci_array PCIPARM_BUS -s
- do_setpci_array PCIPARM_VENDOR -d
+ do_setpci_array PCIPARM_BUS -s #|| return 1
+ do_setpci_array PCIPARM_VENDOR -d #|| return 1
}