From 3ae8777075b1f8b329d59a9f9fb7255cbc974c4b Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Fri, 15 May 2020 11:16:22 +0200 Subject: [PATCH] Implemented Failed message in error function --- scripts/base.sh | 8 +++++++- scripts/image/chroot.sh | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/base.sh b/scripts/base.sh index 79ad41b..450499d 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -58,7 +58,13 @@ success(){ } error(){ - message "${COLOR_RED}" "ERROR" "$1 -> Leaving program." + if [ -z "$1" ] + then + message="Failed." + else + message="$1" + fi + message "${COLOR_RED}" "ERROR" "$message -> Leaving program." if declare -f "destructor" > /dev/null then info "Calling destructor..." diff --git a/scripts/image/chroot.sh b/scripts/image/chroot.sh index 9f03c30..74b62c9 100644 --- a/scripts/image/chroot.sh +++ b/scripts/image/chroot.sh @@ -41,12 +41,12 @@ source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh info "Making mount dir..." && mkdir -p /mnt/raspbian || -error "Failed." +error info "Mount partitions..." mount -o rw "$1""2" /mnt/raspbian && mount -o rw "$1""1" /mnt/raspbian/boot || -error "Failed." +error info "Mount binds..." && mount --bind /dev /mnt/raspbian/dev/ &&