From 72e39e1f8154623b6fbbd495e582355b0e96a265 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 4 Jun 2010 14:16:54 -0400 Subject: Add functions to check shvar-style variables. --- rc.d/init.d/functions | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index d48ee032..cda14b99 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -579,5 +579,26 @@ is_ignored_file() { esac return 1 } + +# Evaluate shvar-style booleans +is_true() { + case "$1" in + [tT] | [yY] | [yY][eE][sS] | [tT][rR][uU][eE]) + return 0 + ;; + esac + return 1 +} + +# Evaluate shvar-style booleans +is_false() { + case "$1" in + [fF] | [nN] | [nN][oO] | [fF][aA][lL][sS][eE]) + return 0 + ;; + esac + return 1 +} + # A sed expression to filter out the files that is_ignored_file recognizes __sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d' -- cgit v1.2.1