Browse Source

Moved cprint

Joachim M. Giæver 5 years ago
parent
commit
3d7a1e3555
1 changed files with 15 additions and 14 deletions
  1. 15 14
      bin/lxcbuild

+ 15 - 14
bin/lxcbuild

@@ -4,6 +4,21 @@ CONTAINER_OS=ubuntu
 CONTAINER_VERSION=18.04
 CONTAINER_NAME=$(basename `git rev-parse --show-toplevel`)
 
+function cprint {
+	ERR='\033[0;31m'
+	OK='\033[0;32m'
+	INFO='\033[0;33m'
+	END='\033[0m'
+	while IFS= read -r L; do
+	case "${1}" in 
+		err) echo -e "LXDBuild ${ERR}Error: ${L}${END}";;
+		ok) echo -e "LXDBuild ${OK}${L}${END}";;
+		info) echo -e "LXDBuild ${INFO}${L}${END}";;
+	esac
+	done < <(printf "%s\n" "${2}")
+}
+
+
 if [ "${CONTAINER_NAME}" != "$(basename $(pwd))" ]; then
 	cprint "err" "Run script from root folder of project"
 	exit 1
@@ -19,20 +34,6 @@ if [ "${CURRF}" != "$(md5sum "${0}")" ]; then
 	exit 1
 fi
 
-function cprint {
-	ERR='\033[0;31m'
-	OK='\033[0;32m'
-	INFO='\033[0;33m'
-	END='\033[0m'
-	while IFS= read -r L; do
-	case "${1}" in 
-		err) echo -e "LXDBuild ${ERR}Error: ${L}${END}";;
-		ok) echo -e "LXDBuild ${OK}${L}${END}";;
-		info) echo -e "LXDBuild ${INFO}${L}${END}";;
-	esac
-	done < <(printf "%s\n" "${2}")
-}
-
 function container_sh {
 	if [ $# -eq 1 ]; then
 		cprint "info" "${1}"