#!/bin/sh
-# Copyright 2006 Gentoo Foundation
-# Copyright 2007 Roy Marples
+# Copyright 2007-2008 Roy Marples
# All rights reserved
# Redistribution and use in source and binary forms, with or without
local result=
while [ -n "$1" ]; do
case " ${result} " in
- *" $1 "*) ;;
- *) result="${result} $1" ;;
+ *" $1 "*);;
+ *) result="${result} $1";;
esac
shift
done
# If restarting check if service is running or not if we can
if [ "x${ACTION}" = "xrestart" ]; then
if [ -s /var/run/"${SERVICE}".pid ]; then
- kill -0 $(cat /var/run/"${SERVICE}".pid)
+ kill -0 $(cat /var/run/"${SERVICE}".pid) 2>/dev/null
elif [ -s /var/run/"${SERVICE}"/"${SERVICE}".pid ]; then
- kill -0 $(cat /var/run/"${SERVICE}".pid)
+ kill -0 $(cat /var/run/"${SERVICE}".pid) 2>/dev/null
elif [ -s /var/run/"${SERVICE}"/pid ]; then
- kill -0 $(cat /var/run/"${SERVICE}"/pid)
+ kill -0 $(cat /var/run/"${SERVICE}"/pid) 2>/dev/null
else
false
fi
# Service not running, so don't restart
- [ $? != 0 ] && exit 1
+ [ $? != 0 ] && exit 0
fi
if [ -x /sbin/service ]; then
service "${SERVICE}" "${ACTION}" "$@"
shift
fi
-# -l is a Gentoo option that lists our resolv files
-# optionally for a specific interface
+# -l lists our resolv files, optionally for a specific interface
if [ "x${CMD}" = "x-l" -o "x${CMD}" = "x-i" ]; then
[ -d "${IFACEDIR}" ] || exit 0
NEWSEARCH=
NEWNS=
NEWDOMAIN=
- LINES="$("${argv0}" -l "${IFACE}" | sed -e "s/'/'\\\\''/g" -e "s/^/'/g" -e "s/$/'/g")"
+ LINES="$("${argv0}" -l "${IFACE}" |
+ sed -e "s/'/'\\\\''/g" -e "s/^/'/g" -e "s/$/'/g")"
eval set -- ${LINES}
for LINE in "$@"; do
case "${LINE}" in
"nameserver "*)
case "${LINE#* }" in
- 127.*) continue ;;
+ 127.*) continue;;
esac
NS="${NS}${LINE#* } "
;;
for S in ${NEWSEARCH}; do
for DN in ${NEWDOMAIN}; do
if [ "${S%,*}" = "${DN%,*}" ]; then
- NEWSEARCH="$(echo "${NEWSEARCH}" | sed -e "s/${S}/${DN}/g")"
- NEWDOMAIN="$(echo "${NEWDOMAIN}" | sed -e "s/${DN}//g")"
+ NEWSEARCH="$(echo "${NEWSEARCH}" |
+ sed -e "s/${S}/${DN}/g")"
+ NEWDOMAIN="$(echo "${NEWDOMAIN}" |
+ sed -e "s/${DN}//g")"
break
fi
done
if [ "x${CMD}" = "x-a" ]; then
for x in '/' \\ ' ' '*'; do
case "${IFACE}" in
- *[${x}]*) error_exit "${x} not allowed in interface name" ;;
+ *[${x}]*) error_exit "${x} not allowed in interface name";;
esac
done
for x in '.' '-' '~'; do
case "${IFACE}" in
- [${x}]*) error_exit "${x} not allowed at start of interface name" ;;
+ [${x}]*) error_exit "${x} not allowed at start of interface name";;
esac
done
[ "x${CMD}" = "x-a" -a -t 0 ] && error_exit "No file given via stdin"
done
exit ${retval}
-
-# vim: set ts=4 :