LibrePortal/scripts/source/loading/initilize_files.sh
librelad 300301e6aa 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>
2026-05-22 13:25:59 +01:00

55 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
sourceInitilize()
{
local flag="$1"
# We will only show the header for the full app
if [[ $flag == "run" ]]; then
isHeader "Loading LibrePortal Startup Files"
isNotice "If you are experiencing loading issues..."
isNotice "Please run the following : 'libreportal reset'"
fi
# Directory containing the files to source recursively
local file_list_directory="${install_scripts_dir}source/files"
# Check if the directory exists
if [ -d "$file_list_directory" ]; then
# Use find to get a list of all files (excluding directories) in the directory and its subdirectories
local file_list=$(find "$file_list_directory" -type f -name "*.sh")
# Loop through each file in the file list
while IFS= read -r file; do
# Source the file
source "$file"
done <<< "$file_list"
else
echo "Directory $file_list_directory does not exist. Unable to start!"
fi
# For loading files needed for the full app or CLI
if [[ $flag == "run" ]]; then
source "${install_scripts_dir}source/files/app_files.sh"
files_to_source=("${files_libreportal_app[@]}")
elif [[ $flag == "cli" ]]; then
source "${install_scripts_dir}source/files/cli_files.sh"
files_to_source=("${files_libreportal_cli[@]}")
fi
# Checking for missing files
for file_to_source in "${files_to_source[@]}"; do
if [ ! -f "${install_scripts_dir}${file_to_source}" ]; then
isNotice "Missing file: ${install_scripts_dir}${file_to_source}"
else
source "${install_scripts_dir}${file_to_source}"
#echo "Sourced file: ${install_scripts_dir}${file_to_source}"
fi
done
# Loading of all files
sourceScanFiles "libreportal_configs";
sourceScanFiles "app_configs";
sourceScanFiles "containers";
}