Completed error function

This commit is contained in:
Kevin Veen-Birkenbach 2020-05-02 13:15:15 +02:00
parent a49901eb5b
commit 283abc9d8f
2 changed files with 17 additions and 4 deletions

View File

@ -56,6 +56,19 @@ success(){
message "${COLOR_GREEN}" "SUCCESS" "$1";
}
error(){
message "${COLOR_RED}" "ERROR" "$1 -> Leaving program."
if declare -f "destructor" > /dev/null
then
info "Calling destructor..."
destructor
else
warning "No destructor defined."
info "Can be that this script left some waste."
fi
exit 1;
}
HEADER(){
echo
echo "${COLOR_YELLOW}The"

View File

@ -4,14 +4,14 @@
# @author Kevin Veen-Birkenbach [aka. Frantz]
#
# shellcheck source=/dev/null # Deactivate SC1090
source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1)
SYSTEM_MEMORY_KB="$(grep MemTotal /proc/meminfo | awk '{print $2}')"
info "Start setup of customized core software..."
info "Copying templates to home folder..."
exit
cp -rfv "$TEMPLATE_PATH/." "$HOME"
echo "Synchronising packages..."
sudo pacman -Syyu
cp -rfv "$TEMPLATE_PATH/." "$HOME" || error "Copy templates failed."
info "Synchronising packages..."
sudo pacman -Syyu || error "Package syncronisation failed."
FSTAB_SWAP_ENTRY="/swapfile none swap defaults 0 0"
SWAP_FILE="/swapfile"
FSTAB_FILE="/etc/fstab"