zsh-workers
 help / color / mirror / code / Atom feed
From: "Øystein Walle" <oystwa@gmail.com>
To: zsh-workers@zsh.org
Cc: "Øystein Walle" <ow@datarespons.no>
Subject: [PATCH] Fun!
Date: Tue, 16 Sep 2014 10:28:06 +0200	[thread overview]
Message-ID: <1410856096-2109-1-git-send-email-oystwa@gmail.com> (raw)
In-Reply-To: <cover.1410851605.git.oystwa@gmail.com>

From: Øystein Walle <ow@datarespons.no>

---
 SW/source/installdeps.sh | 56 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 38 insertions(+), 18 deletions(-)

diff --git a/SW/source/installdeps.sh b/SW/source/installdeps.sh
index 059ff3c..5a6dece 100755
--- a/SW/source/installdeps.sh
+++ b/SW/source/installdeps.sh
@@ -9,6 +9,26 @@ QCHARTSDIR=$BUILDDIR/include/qtcharts
 depsdir=$PWD/deps
 topdir=$PWD
 
+# Define colors if stdout is a terminal
+if [ -t 1 ]; then
+	# green=$(tput setaf 2)
+	# red=$(tput setaf 1)
+	# reset=$(tput sgr0)
+	red='^[[31m'
+	green='^[[32m'
+	reset='^[(B^[[m'
+else
+	red= green= reset=
+fi
+
+printok() {
+	printf "$green[OK]$reset %s\n" "$1"
+}
+
+printerr() {
+	printf "$red[ERROR]$reset %s\n" "$1" >&2
+}
+
 # compiling with mingw will yield 'Msys', while linux distros will yield 'GNU/Linux'
 DETECTED_OS=$(uname -o)
 
@@ -33,9 +53,9 @@ if [ ! -d "$BUILDDIR" ]; then
 	mkdir $BUILDDIR/bin
 	mkdir $BUILDDIR/lib
 	mkdir $BUILDDIR/html
-	echo "[OK]"
+	printok
 else
-	echo "[OK] Build Directory Found"
+	printok "Build Directory Found"
 fi
 echo ""
 
@@ -58,9 +78,9 @@ if [ ! -d "$GTESTDIR" ]; then
 	cp gtest.a $BUILDDIR/lib
 	cp -r ./../include $BUILDDIR
 	cd $topdir
-	echo "[OK]"
+	printok
 else
-	echo "[OK] Google Test Found"
+	printok "Google Test Found"
 fi
 echo ""
 
@@ -87,9 +107,9 @@ if [ ! -d "$QCHARTSDIR" ]; then
 	qmake CONFIG+="debug_and_release build_all nomake_demos_examples"; $MAKE -j1; $SUDO $MAKE install
 	mkdir $BUILDDIR/include/qtcharts
 	cd $topdir
-	echo "[OK]"
+	printok
 else
-	echo "[OK] QtCharts Found"
+	printok "QtCharts Found"
 fi
 echo ""
 
@@ -115,9 +135,9 @@ if [ ! -d "$ZLIBDIR" ]; then
 	cp zconf.h $BUILDDIR/include/zlib
 	cp libz.a $BUILDDIR/lib
 	cd $topdir
-	echo "[OK]"
+	printok
 else
-	echo "[OK] Zlib Found" 
+	printok "Zlib Found"
 fi
 echo ""
 
@@ -145,9 +165,9 @@ if [ ! -d "$PROTODIR" ]; then
 	then exit 1
 	fi
 	cd $topdir
-	echo "[OK]"
+	printok
 else
-	echo "[OK] Protobuf Found" 
+	printok "Protobuf Found"
 fi
 echo ""
 
@@ -164,9 +184,9 @@ if [ ! -d "$EIGENDIR" ]; then
 	mkdir $BUILDDIR/include/eigen
 	cp -r . $BUILDDIR/include/eigen
 	cd $topdir
-	echo "[OK]"
+	printok
 else
-	echo "[OK] Eigen FFT Found"
+	printok "Eigen FFT Found"
 fi
 echo ""
 
@@ -192,12 +212,12 @@ if [ "$DETECTED_OS" =  "Msys" ]; then
     if [ ! -f $BUILDDIR/release/Compress2003 ]; then
         cp $topdir/libs/compresslib/Compress2003.dll $BUILDDIR/release
     fi
-    echo "[OK] - installed/verified compressions libs for $DETECTED_OS"
+    printok "installed/verified compressions libs for $DETECTED_OS"
     echo ""
 elif [ "$DETECTED_OS" = "GNU/Linux" ]; then
-    echo "[OK] - no compression libs neccessary for $DETECTED_OS"
+    printok "no compression libs neccessary for $DETECTED_OS"
 else
-    echo "[ERROR] - failed installing compression libs, OS: $DETECTED_OS not recognized"
+    printerr "failed installing compression libs, OS: $DETECTED_OS not recognized"
 fi
 
 echo "Verifying SQL libraries Available"
@@ -212,7 +232,7 @@ if [ "$DETECTED_OS" =  "Msys" ]; then
     if [ ! -f $BUILDDIR/release/sqldrivers/qsqloci.dll ]; then
         cp $topdir/libs/sqldrivers/qsqloci.dll $BUILDDIR/release/sqldrivers/
     fi	
-    echo "[OK] - installed SQL drivers for $DETECTED_OS"
+    printok "installed SQL drivers for $DETECTED_OS"
 elif [ "$DETECTED_OS" = "GNU/Linux" ]; then
     if [ ! -f $BUILDDIR/debug/sqldrivers/libqsqloci.so ]; then
         cp $topdir/libs/sqldrivers/libqsqloci.so $BUILDDIR/debug/sqldrivers/
@@ -220,7 +240,7 @@ elif [ "$DETECTED_OS" = "GNU/Linux" ]; then
     if [ ! -f $BUILDDIR/release/sqldrivers/libqsqloci.so ]; then
         cp $topdir/libs/sqldrivers/libqsqloci.so $BUILDDIR/release/sqldrivers/
     fi
-    echo "[OK] - installed/verified SQL drivers for $DETECTED_OS"
+    printok "installed/verified SQL drivers for $DETECTED_OS"
 else
-    echo "[ERROR] - failed installing SQL drivers, OS: $DETECTED_OS not recognized"
+    printerr "failed installing SQL drivers, OS: $DETECTED_OS not recognized"
 fi
-- 
2.0.1


  reply	other threads:[~2014-09-16  8:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16  8:28 [PATCH 0/5] Git coompletion updates and fixes Øystein Walle
2014-09-16  8:28 ` Øystein Walle [this message]
2014-09-16  8:28 ` [PATCH 1/5] _git: updates for Git 2.0.0 Øystein Walle
2014-09-16  8:28 ` [PATCH 2/5] _git: Add missing --list to git-tag Øystein Walle
2014-09-16  8:28 ` [PATCH 3/5] _git: updates for Git 2.1.0 Øystein Walle
2014-09-16  8:28 ` [PATCH 4/5] _git: fix typo in git-apply Øystein Walle
2014-09-16  8:28 ` [PATCH 5/5] _git: add missing --3way option Øystein Walle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410856096-2109-1-git-send-email-oystwa@gmail.com \
    --to=oystwa@gmail.com \
    --cc=ow@datarespons.no \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).