style(cli): carry glyph markers through the install scripts
Propagate the ✓ Success / ✗ Error / ! Notice / ❯ Question glyphs (from markers.sh) through the rest of the pipeline: swap the inlined helpers in init.sh and generate_arrays.sh, and replace raw echo -e "${RED}ERROR:${NC}" calls with the isX helpers in config_check_missing.sh, check_success.sh, initilize_files.sh, and reset_git.sh.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
parent
5ce0a88de0
commit
300301e6aa
8
init.sh
8
init.sh
@ -24,10 +24,10 @@ YELLOW='\033[0;33m'
|
|||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
isSuccessful() { echo -e "${GREEN}SUCCESS:${NC} $1"; }
|
isSuccessful() { echo -e "${GREEN}✓ Success${NC} $1"; }
|
||||||
isError() { echo -e "${RED}ERROR:${NC} $1"; }
|
isError() { echo -e "${RED}✗ Error${NC} $1"; }
|
||||||
isNotice() { echo -e "${YELLOW}NOTICE:${NC} $1"; }
|
isNotice() { echo -e "${YELLOW}! Notice${NC} $1"; }
|
||||||
isQuestion() { echo -e -n "${BLUE}QUESTION:${NC} $1 "; }
|
isQuestion() { echo -e -n "${BLUE}❯ Question${NC} $1 "; }
|
||||||
|
|
||||||
displayLibrePortalLogo() {
|
displayLibrePortalLogo() {
|
||||||
local hbar; hbar=$(printf '═%.0s' $(seq 1 50))
|
local hbar; hbar=$(printf '═%.0s' $(seq 1 50))
|
||||||
|
|||||||
@ -4,7 +4,7 @@ checkConfigFilesMissingFiles()
|
|||||||
{
|
{
|
||||||
# Simply check if the configs directory exists and has some content
|
# Simply check if the configs directory exists and has some content
|
||||||
if [ ! -d "$configs_dir" ]; then
|
if [ ! -d "$configs_dir" ]; then
|
||||||
echo -e "${RED}ERROR:${NC} Configs directory not found at $configs_dir"
|
isError "Configs directory not found at $configs_dir"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -41,12 +41,12 @@ checkConfigFilesMissingFiles()
|
|||||||
|
|
||||||
if [ "$found_files_count" -gt 0 ]; then
|
if [ "$found_files_count" -gt 0 ]; then
|
||||||
if [ "$missing_files_count" -gt 0 ]; then
|
if [ "$missing_files_count" -gt 0 ]; then
|
||||||
echo -e "${GREEN}SUCCESS:${NC} $missing_files_count config files were missing and have been added to the configs folder."
|
isSuccessful "$missing_files_count config files were missing and have been added to the configs folder."
|
||||||
else
|
else
|
||||||
echo -e "${GREEN}SUCCESS:${NC} All config files are successfully set up in the configs folder."
|
isSuccessful "All config files are successfully set up in the configs folder."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${YELLOW}NOTICE:${NC} No configuration files found in install directory. This may be a fresh installation."
|
isNotice "No configuration files found in install directory. This may be a fresh installation."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,12 @@
|
|||||||
function checkSuccess()
|
function checkSuccess()
|
||||||
{
|
{
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo -e "${GREEN}SUCCESS:${NC} $1"
|
isSuccessful "$1"
|
||||||
if [ -f "$logs_dir/$docker_log_file" ]; then
|
if [ -f "$logs_dir/$docker_log_file" ]; then
|
||||||
echo "SUCCESS: $1" | sudo tee -a "$logs_dir/$docker_log_file" >/dev/null
|
echo "✓ Success $1" | sudo tee -a "$logs_dir/$docker_log_file" >/dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${RED}ERROR:${NC} $1"
|
isError "$1"
|
||||||
|
|
||||||
# Non-interactive (task processor / cron / piped): bail instead of
|
# Non-interactive (task processor / cron / piped): bail instead of
|
||||||
# blocking on read.
|
# blocking on read.
|
||||||
|
|||||||
@ -19,8 +19,8 @@ SCRIPTS_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
|||||||
# the script keeps its zero-dependency property but still matches the look of
|
# the script keeps its zero-dependency property but still matches the look of
|
||||||
# the rest of the install pipeline.
|
# the rest of the install pipeline.
|
||||||
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m'; NC='\033[0m'
|
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m'; NC='\033[0m'
|
||||||
isSuccessful() { echo -e "${GREEN}SUCCESS:${NC} $1"; }
|
isSuccessful() { echo -e "${GREEN}✓ Success${NC} $1"; }
|
||||||
isNotice() { echo -e "${YELLOW}NOTICE:${NC} $1"; }
|
isNotice() { echo -e "${YELLOW}! Notice${NC} $1"; }
|
||||||
isHeader() {
|
isHeader() {
|
||||||
local title="$1"
|
local title="$1"
|
||||||
local width=52
|
local width=52
|
||||||
|
|||||||
@ -7,8 +7,8 @@ sourceInitilize()
|
|||||||
# We will only show the header for the full app
|
# We will only show the header for the full app
|
||||||
if [[ $flag == "run" ]]; then
|
if [[ $flag == "run" ]]; then
|
||||||
isHeader "Loading LibrePortal Startup Files"
|
isHeader "Loading LibrePortal Startup Files"
|
||||||
echo -e "${YELLOW}NOTICE:${NC} If you are experiencing loading issues..."
|
isNotice "If you are experiencing loading issues..."
|
||||||
echo -e "${YELLOW}NOTICE:${NC} Please run the following : 'libreportal reset'"
|
isNotice "Please run the following : 'libreportal reset'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Directory containing the files to source recursively
|
# Directory containing the files to source recursively
|
||||||
@ -40,7 +40,7 @@ sourceInitilize()
|
|||||||
# Checking for missing files
|
# Checking for missing files
|
||||||
for file_to_source in "${files_to_source[@]}"; do
|
for file_to_source in "${files_to_source[@]}"; do
|
||||||
if [ ! -f "${install_scripts_dir}${file_to_source}" ]; then
|
if [ ! -f "${install_scripts_dir}${file_to_source}" ]; then
|
||||||
echo "NOTICE: Missing file: ${install_scripts_dir}${file_to_source}"
|
isNotice "Missing file: ${install_scripts_dir}${file_to_source}"
|
||||||
else
|
else
|
||||||
source "${install_scripts_dir}${file_to_source}"
|
source "${install_scripts_dir}${file_to_source}"
|
||||||
#echo "Sourced file: ${install_scripts_dir}${file_to_source}"
|
#echo "Sourced file: ${install_scripts_dir}${file_to_source}"
|
||||||
|
|||||||
@ -4,7 +4,7 @@ gitReset()
|
|||||||
{
|
{
|
||||||
# Check if this is a local installation
|
# Check if this is a local installation
|
||||||
if [[ "$CFG_INSTALL_MODE" == "local" ]]; then
|
if [[ "$CFG_INSTALL_MODE" == "local" ]]; then
|
||||||
echo "NOTICE: Local installation detected - Git reset is not applicable."
|
isNotice "Local installation detected - Git reset is not applicable."
|
||||||
echo "To reset a local installation, please manually restore files and rerun the init script."
|
echo "To reset a local installation, please manually restore files and rerun the init script."
|
||||||
else
|
else
|
||||||
gitCheckGitDetails;
|
gitCheckGitDetails;
|
||||||
@ -31,11 +31,11 @@ gitReset()
|
|||||||
|
|
||||||
# Try HTTPS first
|
# Try HTTPS first
|
||||||
if sudo -u $sudo_user_name git clone -q "$AUTH_HTTPS_REPO_URL" "$script_dir" 2>/dev/null; then
|
if sudo -u $sudo_user_name git clone -q "$AUTH_HTTPS_REPO_URL" "$script_dir" 2>/dev/null; then
|
||||||
echo "SUCCESS: Git repository cloned via HTTPS into '$script_dir'."
|
isSuccessful "Git repository cloned via HTTPS into '$script_dir'."
|
||||||
else
|
else
|
||||||
# If HTTPS fails, try HTTP
|
# If HTTPS fails, try HTTP
|
||||||
if sudo -u $sudo_user_name git clone -q "$AUTH_HTTP_REPO_URL" "$script_dir" 2>/dev/null; then
|
if sudo -u $sudo_user_name git clone -q "$AUTH_HTTP_REPO_URL" "$script_dir" 2>/dev/null; then
|
||||||
echo "SUCCESS: Git repository cloned via HTTP into '$script_dir'."
|
isSuccessful "Git repository cloned via HTTP into '$script_dir'."
|
||||||
else
|
else
|
||||||
isError " Failed to clone repository via both HTTPS and HTTP."
|
isError " Failed to clone repository via both HTTPS and HTTP."
|
||||||
exit 1
|
exit 1
|
||||||
@ -43,11 +43,11 @@ gitReset()
|
|||||||
fi
|
fi
|
||||||
elif [[ $CFG_INSTALL_MODE == "local" ]]; then
|
elif [[ $CFG_INSTALL_MODE == "local" ]]; then
|
||||||
if sudo -u $sudo_user_name git clone -q "https://${CLEAN_GIT_URL}.git" "$script_dir" 2>/dev/null; then
|
if sudo -u $sudo_user_name git clone -q "https://${CLEAN_GIT_URL}.git" "$script_dir" 2>/dev/null; then
|
||||||
echo "SUCCESS: Git repository cloned via HTTPS into '$script_dir'."
|
isSuccessful "Git repository cloned via HTTPS into '$script_dir'."
|
||||||
else
|
else
|
||||||
# If HTTPS fails, try HTTP
|
# If HTTPS fails, try HTTP
|
||||||
if sudo -u $sudo_user_name git clone -q "http://${CLEAN_GIT_URL}.git" "$script_dir" 2>/dev/null; then
|
if sudo -u $sudo_user_name git clone -q "http://${CLEAN_GIT_URL}.git" "$script_dir" 2>/dev/null; then
|
||||||
echo "SUCCESS: Git repository cloned via HTTP into '$script_dir'."
|
isSuccessful "Git repository cloned via HTTP into '$script_dir'."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user