From 24ce892af5dea9652051f9e74d771c828e4e22cc Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Wed, 1 Apr 2015 09:15:00 +0200 Subject: bin/build-rpm-package: add make_boolean() function to convert a semi-random string into boolean 0 or 1. Shameless copy from maintenancescripts. Add FIXME to remember to outsource this some sunny day. --- bin/build-rpm-package | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/build-rpm-package b/bin/build-rpm-package index 2cb6302..5ba3334 100755 --- a/bin/build-rpm-package +++ b/bin/build-rpm-package @@ -109,6 +109,18 @@ cleanup () { # Run cleanup() automatically. trap cleanup EXIT SIGTERM SIGINT SIGHUP SIGPIPE SIGALRM SIGUSR1 SIGUSR2 +# FIXME: this should really be in a common.(sh) file! +function make_boolean () { + typeset -l OPTION="${1}" + + case "${OPTION}" in + ("0"|"no"|"false"|"") OPTION="0";; + (*) OPTION="1";; + esac + + printf "${OPTION}" +} + set_vars() { TEMP_BASE="$HOME/tmp/" mkdir -p "$TEMP_BASE" -- cgit v1.2.3