[X2Go-Commits] [buildscripts] 03/05: bin/build-rpm-package: add make_boolean() function to convert a semi-random string into boolean 0 or 1. Shameless copy from maintenancescripts.

git-admin at x2go.org git-admin at x2go.org
Wed Apr 1 09:28:49 CEST 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository buildscripts.

commit 24ce892af5dea9652051f9e74d771c828e4e22cc
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Apr 1 09:15:00 2015 +0200

    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"

--
Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git


More information about the x2go-commits mailing list