[arch-projects] [initscripts] [PATCH 07/11] functions: Simplify ck_autostart() by refactoring using in_array()

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Sat Jul 2 14:44:25 EDT 2011


---
 functions |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/functions b/functions
index 11f8317..a8ef211 100644
--- a/functions
+++ b/functions
@@ -198,11 +198,7 @@ have_daemon() {

 # Check if $1 is started at boot
 ck_autostart() {
-	local d
-	for d in "${DAEMONS[@]}"; do
-		[[ "$1" = ${d#@} ]] && return 1
-	done
-	return 0
+	in_array "$1" "${DAEMONS[@]}" && return 1 || return 0
 }

 start_daemon() {
--
1.7.1



More information about the arch-projects mailing list