From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-907749-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 601C3138B09 for <garchives@archives.gentoo.org>; Sun, 23 Oct 2016 23:50:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D0F07E080C; Sun, 23 Oct 2016 23:50:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B260FE080C for <gentoo-commits@lists.gentoo.org>; Sun, 23 Oct 2016 23:50:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 45B3834164D for <gentoo-commits@lists.gentoo.org>; Sun, 23 Oct 2016 23:50:17 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 719CE2FF for <gentoo-commits@lists.gentoo.org>; Sun, 23 Oct 2016 23:50:15 +0000 (UTC) From: "Robin H. Johnson" <robbat2@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" <robbat2@gentoo.org> Message-ID: <1477266060.e337a9906e526b4b60fea7d260a4b21badb89ca1.robbat2@OpenRC> Subject: [gentoo-commits] proj/netifrc:master commit in: init.d/ X-VCS-Repository: proj/netifrc X-VCS-Files: init.d/net.lo.in X-VCS-Directories: init.d/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: e337a9906e526b4b60fea7d260a4b21badb89ca1 X-VCS-Branch: master Date: Sun, 23 Oct 2016 23:50:15 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 2ba3d0ca-745f-42e6-bb02-19fa69a57d14 X-Archives-Hash: 55961290cf3588e4ef72d6c67e797d26 commit: e337a9906e526b4b60fea7d260a4b21badb89ca1 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> AuthorDate: Sun Oct 23 23:41:00 2016 +0000 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> CommitDate: Sun Oct 23 23:41:00 2016 +0000 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=e337a990 net.lo: framework for error handling customization. Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> init.d/net.lo.in | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/init.d/net.lo.in b/init.d/net.lo.in index a8e19dd..3b47f1a 100644 --- a/init.d/net.lo.in +++ b/init.d/net.lo.in @@ -227,6 +227,34 @@ _show_address() einfo "received address $(_get_inet_address "${IFACE}")" } +# Allow custom error handling behavior to be set by the user. +# Known used combinations, with defaults +# errh_IFVAR_address_EEXIST=warn +# errh_IFVAR_route_EEXIST=warn +_get_errorhandler_behavior() { + IFVAR="$1" + object="$2" + error="$3" + fallback="$4" + value= + for key in \ + "errh_${IFVAR}_${object}_${error}" \ + "errh_${IFVAR}_${object}_DEFAULT" \ + "errh_${IFVAR}_DEFAULT_${error}" \ + "errh_${IFVAR}_DEFAULT_DEFAULT" \ + "errh_DEFAULT_${object}_${error}" \ + "errh_DEFAULT_${object}_DEFAULT" \ + "errh_DEFAULT_DEFAULT_${error}" \ + "errh_DEFAULT_DEFAULT_DEFAULT" \ + "errh" \ + "fallback" ; do + eval value="\${key}" + if [ -n "$value" ]; then + echo "$value" && break + fi + done +} + # Basically sorts our modules into order and saves the list _gen_module_list() {