Update install script and utils

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2019-09-17 18:50:16 +02:00
parent 7e6a5dd4da
commit b4361d455e
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
2 changed files with 21 additions and 23 deletions

View file

@ -22,13 +22,13 @@ PACKAGES_DIR="${DIR}/packages"
#######################################
# Bash color code variables
#######################################
RESET='\033[0m'
GREEN='\033[32m'
RED='\033[31m'
BLUE='\033[34m'
YELLOW='\033[33m'
RESET="$(tput sgr0)"
GREEN="$(tput setaf 2)"
RED="$(tput setaf 1)"
BLUE="$(tput setaf 4)"
DEFAULT="$(tput op)"
YELLOW="$(tput setaf 3)"
BOLD="$(tput bold)"
NORMAL="$(tput sgr0)"
#######################################
# Helper functions
@ -44,23 +44,21 @@ function print_time_log() {
# USAGE: print_notify TITLE MESSAGE
function print_notify() {
notify-send "${1}" "${2}"
echo -e "${YELLOW}[$(date "+%T")] ${1} ${2}${RESET}"
echo -e "${YELLOW}[$(date "+%T")] ${1} ${2}${DEFAULT}"
}
# Prints a section title.
# USAGE: print_section TITLE
function print_section() {
echo -e "${YELLOW}${BOLD}┌──────────────────────────────────────────────────────────────────────────────┐"
echo -e "│ $(printf "%-77s" "${1}")│"
echo -e "└──────────────────────────────────────────────────────────────────────────────┘${RESET}"
echo -e "${BOLD}${BLUE}::${DEFAULT} ${1}${RESET}"
}
function print_log() {
echo -e " • $1"
echo -e " ${BLUE}->${DEFAULT} ${1}"
}
function ask_prompt() {
read -p "${BOLD}${1} (y/n): ${NORMAL}" -n 1 -r
read -p "${BOLD}${BLUE}::${DEFAULT} ${1} [Y/n] ${RESET}" -n 1 -r
echo ""
if [[ ${REPLY} =~ ^[^yY]$ ]]; then