Browse Source

ui

feature/dst-changes
Daniel Gibbs 2 years ago
parent
commit
071b73a1ab
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 10
      lgsm/modules/command_update_linuxgsm.sh
  2. 2
      lgsm/modules/core_dl.sh
  3. 138
      lgsm/modules/core_messages.sh

10
lgsm/modules/command_update_linuxgsm.sh

@ -57,7 +57,7 @@ fi
if [ "${tmp_script_diff}" != "" ]; then
fn_print_update_eol_nl
fn_script_log_update "Checking ${remotereponame} linuxgsm.sh"
fn_script_log "Checking ${remotereponame} linuxgsm.sh"
rm -f "${tmpdir:?}/linuxgsm.sh"
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "nochmodx" "norun" "noforcedl" "nohash"
else
@ -73,7 +73,7 @@ fn_script_log_info "Checking ${selfname}"
script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}"))
if [ "${script_diff}" != "" ]; then
fn_print_update_eol_nl
fn_script_log_update "Checking ${selfname}"
fn_script_log "Checking ${selfname}"
echo -en "backup ${selfname}...\c"
fn_script_log_info "Backup ${selfname}"
if [ ! -d "${backupdir}/script" ]; then
@ -137,7 +137,7 @@ fi
if [ "${config_file_diff}" != "" ]; then
fn_print_update_eol_nl
fn_script_log_update "Checking ${remotereponame} config _default.cfg"
fn_script_log "Checking ${remotereponame} config _default.cfg"
rm -f "${configdirdefault:?}/config-lgsm/${gameservername:?}/_default.cfg"
fn_fetch_file_github "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "nochmodx" "norun" "noforce" "nohash"
alert="config"
@ -171,7 +171,7 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
if [ "${config_file_diff}" != "" ]; then
fn_print_update_eol_nl
fn_script_log_update "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
fn_script_log "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
rm -f "${datadir:?}/${distroid}-${distroversioncsv}.csv"
fn_fetch_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" "${datadir}" "nochmodx" "norun" "noforce" "nohash"
else
@ -217,7 +217,7 @@ if [ -n "${modulesdir}" ]; then
# results
if [ "${module_file_diff}" != "" ]; then
fn_print_update_eol_nl
fn_script_log_update "Checking ${remotereponame} module ${modulefile}"
fn_script_log "Checking ${remotereponame} module ${modulefile}"
rm -rf "${modulesdir:?}/${modulefile}"
fn_update_module
else

2
lgsm/modules/core_dl.sh

@ -403,7 +403,7 @@ fn_fetch_file() {
"${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1
exitcode="$?"
else
echo -en "fetching ${fileurl_name} ${local_filename}...\c"
echo -en "${dim}fetching from ${fileurl_name} ( ${local_filename} )\c${default}"
"${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1
exitcode="$?"
fi

138
lgsm/modules/core_messages.sh

@ -33,14 +33,11 @@ fn_ansi_loader() {
# carriage return & erase to end of line.
creeol="\r\033[K"
if command -v tput > /dev/null 2>&1; then
if num_colors=$(tput colors 2> /dev/null) && [ "${num_colors:-0}" -ge 8 ]; then
# Enable colors
tputreset="$(tput sgr 0)"
tputbold="$(tput bold)"
tputdim="$(tput dim)"
fi
fi
bold="\e[1m"
dim="\e[2m"
italic="\e[3m"
underline="\e[4m"
reverse="\e[7m"
}
fn_sleep_time() {
@ -78,13 +75,13 @@ fn_script_log_pass() {
exitcode=0
}
## Feb 28 14:56:58 ut99-server: Monitor: FATAL:
## Feb 28 14:56:58 ut99-server: Monitor: FAIL:
fn_script_log_fatal() {
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: FATAL: ${1}" >> "${lgsmlog}"
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: FAIL: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: FATAL: ${1}" >> "${lgsmlog}"
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: FAIL: ${1}" >> "${lgsmlog}"
fi
fi
exitcode=1
@ -125,35 +122,24 @@ fn_script_log_info() {
fi
}
## Feb 28 14:56:58 ut99-server: Monitor: UPDATE:
fn_script_log_update() {
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: UPDATE: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: UPDATE: ${1}" >> "${lgsmlog}"
fi
fi
}
# On-Screen - Automated functions
##################################
# [ .... ]
fn_print_dots() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[ .... ]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[ .... ]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[ .... ]${tputreset} $*"
echo -en "${bold}${creeol}[ .... ]${tputreset} $*"
fi
fn_sleep_time
}
fn_print_dots_nl() {
if [ "${commandaction}" ]; then
echo -e "${tputbold}${creeol}[ .... ]${tputreset} ${commandaction} ${selfname}: $*"
echo -e "${bold}${creeol}[ .... ]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -e "${tputbold}${creeol}[ .... ]${tputreset} $*"
echo -e "${bold}${creeol}[ .... ]${tputreset} $*"
fi
fn_sleep_time
echo -en "\n"
@ -162,18 +148,18 @@ fn_print_dots_nl() {
# [ OK ]
fn_print_ok() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${green} OK ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${green} OK ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${green} OK ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${green} OK ${default}]${tputreset} $*"
fi
fn_sleep_time
}
fn_print_ok_nl() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${green} OK ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${green} OK ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${green} OK ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${green} OK ${default}]${tputreset} $*"
fi
fn_sleep_time
echo -en "\n"
@ -182,18 +168,18 @@ fn_print_ok_nl() {
# [ FAIL ]
fn_print_fail() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${red} FAIL ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${red} FAIL ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${red} FAIL ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${red} FAIL ${default}]${tputreset} $*"
fi
fn_sleep_time
}
fn_print_fail_nl() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${red} FAIL ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${red} FAIL ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${red} FAIL ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${red} FAIL ${default}]${tputreset} $*"
fi
fn_sleep_time
echo -en "\n"
@ -202,18 +188,18 @@ fn_print_fail_nl() {
# [ ERROR ]
fn_print_error() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${red} ERROR ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${red} ERROR ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${red} ERROR ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${red} ERROR ${default}]${tputreset} $*"
fi
fn_sleep_time
}
fn_print_error_nl() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${red} ERROR ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${red} ERROR ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${red} ERROR ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${red} ERROR ${default}]${tputreset} $*"
fi
fn_sleep_time
echo -en "\n"
@ -222,18 +208,18 @@ fn_print_error_nl() {
# [ WARN ]
fn_print_warn() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${lightyellow} WARN ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${lightyellow} WARN ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${lightyellow} WARN ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${lightyellow} WARN ${default}]${tputreset} $*"
fi
fn_sleep_time
}
fn_print_warn_nl() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${lightyellow} WARN ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${lightyellow} WARN ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${lightyellow} WARN ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${lightyellow} WARN ${default}]${tputreset} $*"
fi
fn_sleep_time
echo -en "\n"
@ -242,18 +228,18 @@ fn_print_warn_nl() {
# [ INFO ]
fn_print_info() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}:${tputreset} $*"
echo -en "${bold}${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}:${tputreset} $*"
else
echo -en "${tputbold}${creeol}[${cyan} INFO ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${cyan} INFO ${default}]${tputreset} $*"
fi
fn_sleep_time
}
fn_print_info_nl() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}:${tputreset} $*"
echo -en "${bold}${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}:${tputreset} $*"
else
echo -en "${tputbold}${creeol}[${cyan} INFO ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${cyan} INFO ${default}]${tputreset} $*"
fi
fn_sleep_time
echo -en "\n"
@ -262,18 +248,18 @@ fn_print_info_nl() {
# [ START ]
fn_print_start() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${lightgreen} START ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${lightgreen} START ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${lightgreen} START ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${lightgreen} START ${default}]${tputreset} $*"
fi
fn_sleep_time
}
fn_print_start_nl() {
if [ "${commandaction}" ]; then
echo -en "${tputbold}${creeol}[${lightgreen} START ${default}]${tputreset} ${commandaction} ${selfname}: $*"
echo -en "${bold}${creeol}[${lightgreen} START ${default}]${tputreset} ${commandaction} ${selfname}: $*"
else
echo -en "${tputbold}${creeol}[${lightgreen} START ${default}]${tputreset} $*"
echo -en "${bold}${creeol}[${lightgreen} START ${default}]${tputreset} $*"
fi
fn_sleep_time
echo -en "\n"
@ -408,144 +394,144 @@ fn_print_no_eol_nl() {
# OK
fn_print_ok_eol() {
echo -en "${green}OK${default}"
echo -en " ${green}OK${default}"
fn_sleep_time
}
fn_print_ok_eol_nl() {
echo -e "${green}[ OK ]${default}"
echo -e " ${green}OK${default}"
fn_sleep_time
}
# FAIL
fn_print_fail_eol() {
echo -en "${red}FAIL${default}"
echo -en " ${red}FAIL${default}"
fn_sleep_time
}
fn_print_fail_eol_nl() {
echo -e "${red}FAIL${default}"
echo -e " ${red}FAIL${default}"
fn_sleep_time
}
# ERROR
fn_print_error_eol() {
echo -en "${red}ERROR${default}"
echo -en " ${red}ERROR${default}"
fn_sleep_time
}
fn_print_error_eol_nl() {
echo -e "${red}ERROR${default}"
echo -e " ${red}ERROR${default}"
fn_sleep_time
}
# WAIT
fn_print_wait_eol() {
echo -en "${cyan}WAIT${default}"
echo -en " ${cyan}WAIT${default}"
fn_sleep_time
}
fn_print_wait_eol_nl() {
echo -e "${cyan}WAIT${default}"
echo -e " ${cyan}WAIT${default}"
fn_sleep_time
}
# WARN
fn_print_warn_eol() {
echo -en "${lightyellow}WARN${default}"
echo -en " ${lightyellow}WARN${default}"
fn_sleep_time
}
fn_print_warn_eol_nl() {
echo -e "${lightyellow}WARN${default}"
echo -e " ${lightyellow}WARN${default}"
fn_sleep_time
}
# INFO
fn_print_info_eol() {
echo -en "${cyan}INFO${default}"
echo -en " ${cyan}INFO${default}"
fn_sleep_time
}
fn_print_info_eol_nl() {
echo -e "${cyan}INFO${default}"
echo -e " ${cyan}INFO${default}"
fn_sleep_time
}
# QUERYING
fn_print_querying_eol() {
echo -en "${cyan}QUERYING${default}"
echo -en " ${cyan}QUERYING${default}"
fn_sleep_time
}
fn_print_querying_eol_nl() {
echo -e "${cyan}QUERYING${default}"
echo -e " ${cyan}QUERYING${default}"
fn_sleep_time
}
# CHECKING
fn_print_checking_eol() {
echo -en "${cyan}CHECKING${default}"
echo -en " ${cyan}CHECKING${default}"
fn_sleep_time
}
fn_print_checking_eol_nl() {
echo -e "${cyan}CHECKING${default}"
echo -e " ${cyan}CHECKING${default}"
fn_sleep_time
}
# DELAY
fn_print_delay_eol() {
echo -en "${green}DELAY${default}"
echo -en " ${green}DELAY${default}"
fn_sleep_time
}
fn_print_delay_eol_nl() {
echo -e "${green}DELAY${default}"
echo -e " ${green}DELAY${default}"
fn_sleep_time
}
# CANCELED
fn_print_canceled_eol() {
echo -en "${lightyellow}CANCELED${default}"
echo -en " ${lightyellow}CANCELED${default}"
fn_sleep_time
}
fn_print_canceled_eol_nl() {
echo -e "${lightyellow}CANCELED${default}"
echo -e " ${lightyellow}CANCELED${default}"
fn_sleep_time
}
# REMOVED
fn_print_removed_eol() {
echo -en "${red}REMOVED${default}"
echo -en " ${red}REMOVED${default}"
fn_sleep_time
}
fn_print_removed_eol_nl() {
echo -e "${red}REMOVED${default}"
echo -e " ${red}REMOVED${default}"
fn_sleep_time
}
# UPDATE
fn_print_update_eol() {
echo -en "${cyan}UPDATE${default}"
echo -en " ${cyan}UPDATE${default}"
fn_sleep_time
}
fn_print_update_eol_nl() {
echo -e "${cyan}UPDATE${default}"
echo -e " ${cyan}UPDATE${default}"
fn_sleep_time
}
# SKIP
fn_print_skip_eol() {
echo -en " ${cyan}[ SKIP ]${default}"
echo -en " ${cyan}SKIP${default}"
fn_sleep_time
}
fn_print_skip_eol_nl() {
echo -e " ${cyan}[ SKIP ]${default}"
echo -e " ${cyan}SKIP${default}"
fn_sleep_time
}

Loading…
Cancel
Save