Optimized base.sh

This commit is contained in:
Kevin Veen-Birkenbach 2020-05-02 12:37:26 +02:00
parent f385bc3d98
commit c7a804f3f1
2 changed files with 45 additions and 21 deletions

View File

@ -4,6 +4,7 @@
# @author Kevin Veen-Birkenbach [aka. Frantz] # @author Kevin Veen-Birkenbach [aka. Frantz]
# #
# shellcheck disable=SC2034 #Deactivate checking of unused variables # shellcheck disable=SC2034 #Deactivate checking of unused variables
REPOSITORY_PATH=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../") REPOSITORY_PATH=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../")
ENCRYPTED_PATH="$REPOSITORY_PATH/.encrypted"; ENCRYPTED_PATH="$REPOSITORY_PATH/.encrypted";
DECRYPTED_PATH="$REPOSITORY_PATH/decrypted"; DECRYPTED_PATH="$REPOSITORY_PATH/decrypted";
@ -24,16 +25,38 @@ declare -a BACKUP_LIST=("$HOME/.ssh/" \
"$HOME/Documents/passwords/" \ "$HOME/Documents/passwords/" \
"$HOME/Documents/licenses/"); "$HOME/Documents/licenses/");
COLOR_RED=$(tput setaf 1) COLOR_RED=$(tput setaf 1)
COLOR_GREEN=$(tput setaf 2) COLOR_GREEN=$(tput setaf 2)
COLOR_YELLOW=$(tput setaf 3) COLOR_YELLOW=$(tput setaf 3)
COLOR_BLUE=$(tput setaf 4) COLOR_BLUE=$(tput setaf 4)
COLOR_MAGENTA=$(tput setaf 5) COLOR_MAGENTA=$(tput setaf 5)
COLOR_CYAN=$(tput setaf 6) COLOR_CYAN=$(tput setaf 6)
COLOR_WHITE=$(tput setaf 7) COLOR_WHITE=$(tput setaf 7)
COLOR_RESET=$(tput sgr0) COLOR_RESET=$(tput sgr0)
HEADER(){ # FUNCTIONS
message(){
echo "$1[$2]:${COLOR_RESET} $3 ";
}
question(){
message "${COLOR_MAGENTA}" "QUESTION" "$1";
}
info(){
message "${COLOR_BLUE}" "INFO" "$1";
}
warning(){
message "${COLOR_YELLOW}" "WARNING" "$1";
}
success(){
message "${COLOR_GREEN}" "SUCCESS" "$1";
}
HEADER(){
echo echo
echo "${COLOR_YELLOW}The" echo "${COLOR_YELLOW}The"
base64 -d <<<"ICBfX19fXyAgICAgICAgICAgICAgICBfX19fXyAgICAgICAgICAgXyAgICAgICAgICAgICAgICAgCiAvIF9fX198ICAgICAgICAgICAgICAvIF9fX198ICAgICAgICAgfCB8ICAgICAgICAgICAgICAgIAp8IHwgICAgIF9fXyAgXyBfXyBfX198IChfX18gIF8gICBfIF9fX3wgfF8gX19fIF8gX18gX19fICAKfCB8ICAgIC8gXyBcfCAnX18vIF8gXFxfX18gXHwgfCB8IC8gX198IF9fLyBfIFwgJ18gYCBfIFwgCnwgfF9fX3wgKF8pIHwgfCB8ICBfXy9fX19fKSB8IHxffCBcX18gXCB8fCAgX18vIHwgfCB8IHwgfAogXF9fX19fXF9fXy98X3wgIFxfX198X19fX18vIFxfXywgfF9fXy9cX19cX19ffF98IHxffCB8X3wKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX18vIHwgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfF9fXy8gICAgICAgICAgICAgICAgICAgICAgIAo=" base64 -d <<<"ICBfX19fXyAgICAgICAgICAgICAgICBfX19fXyAgICAgICAgICAgXyAgICAgICAgICAgICAgICAgCiAvIF9fX198ICAgICAgICAgICAgICAvIF9fX198ICAgICAgICAgfCB8ICAgICAgICAgICAgICAgIAp8IHwgICAgIF9fXyAgXyBfXyBfX198IChfX18gIF8gICBfIF9fX3wgfF8gX19fIF8gX18gX19fICAKfCB8ICAgIC8gXyBcfCAnX18vIF8gXFxfX18gXHwgfCB8IC8gX198IF9fLyBfIFwgJ18gYCBfIFwgCnwgfF9fX3wgKF8pIHwgfCB8ICBfXy9fX19fKSB8IHxffCBcX18gXCB8fCAgX18vIHwgfCB8IHwgfAogXF9fX19fXF9fXy98X3wgIFxfX198X19fX18vIFxfXywgfF9fXy9cX19cX19ffF98IHxffCB8X3wKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX18vIHwgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfF9fXy8gICAgICAgICAgICAgICAgICAgICAgIAo="
@ -41,6 +64,6 @@ declare -a BACKUP_LIST=("$HOME/.ssh/" \
echo echo
echo "Licensed under GNU GENERAL PUBLIC LICENSE Version 3" echo "Licensed under GNU GENERAL PUBLIC LICENSE Version 3"
echo "${COLOR_RESET}" echo "${COLOR_RESET}"
} }
HEADER HEADER

View File

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