summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorneoninteger2019-11-14 22:32:41 +1030
committerneoninteger2019-11-14 22:32:41 +1030
commitf496d7fba8d3318231698631372491759f7c181f (patch)
tree4b3b4c6e50cf6a370ca60105f71548d47cb6af94
parent7951354b5bedba7de72a1b723b5fb7a8dcdfe18c (diff)
downloadaur-f496d7fba8d3318231698631372491759f7c181f.tar.gz
Implement more efficient logging function
-rw-r--r--PKGBUILD23
1 files changed, 17 insertions, 6 deletions
diff --git a/PKGBUILD b/PKGBUILD
index d6c26488d92f..032f7e60e47d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -47,12 +47,6 @@ build() {
check() {
cd "core-rs-${_commithash}"
- # Echoes a blue arrow followed by a bolded log message, much like the
- # verbose printing that makepkg itself does
- log() {
- echo -e " $(tput setaf 4)$(tput bold)->$(tput sgr0) $(tput bold)$@$(tput sgr0)"
- }
-
# NOTE: The integration tests need to link to the already-built turtl_core
# library and used to do so automatically, however this does not work
# anymore. Upstream bug or deprecated funtionality in Rust?
@@ -60,6 +54,23 @@ check() {
# containing turtl_core.so to allow the dynamic linking to occur.
export LD_LIBRARY_PATH="${srcdir}/core-rs-${_commithash}/target/release:${LD_LIBRARY_PATH}"
+ # Determine the capabilities of the terminal this script is running in
+ reset="$(tput sgr0 2> /dev/null)"
+ if [ "$?" -eq 0 ]; then
+ bold="$(tput bold 2> /dev/null)"
+
+ numColours="$(tput colors)"
+ if [ "$numColours" -ge 8 ]; then
+ blue="$(tput setaf 4)"
+ fi
+ fi
+
+ # Echoes a blue arrow followed by a bolded log message, much like the
+ # verbose printing that makepkg itself does
+ log() {
+ echo -e "${reset} ${bold}${blue}->${reset} ${bold}$@${reset}"
+ }
+
# Create the directories for the PostgreSQL database cluster, Turtl server
# copy and Turtl server upload contents. Copy the core-rs and server
# configuration files, initialize the database cluster and start a