diff --git a/init.sh b/init.sh index 8851bba..8910fe4 100755 --- a/init.sh +++ b/init.sh @@ -465,20 +465,13 @@ initCheckConfigs() { # Check if any config files exist (new structure) or old config files local config_found=false - # Check for new structure + # Check for new structure. Skip subdirectories (per-location nested backup + # configs are loaded by their own helper) and the .category markers. if [ -d "$configs_dir" ]; then for category_dir in "$configs_dir"/*; do if [ -d "$category_dir" ] && [ -f "$category_dir/.category" ]; then - # Load new structure config files for config_file in "$category_dir"/*; do - local should_load=true - local filename=$(basename "$config_file") - # Skip .category files and excluded files (hardcoded) - if [[ "$config_file" =~ \.category$ ]]; then - should_load=false - fi - - if [ "$should_load" = true ]; then + if [ -f "$config_file" ] && [[ ! "$config_file" =~ \.category$ ]]; then source "$config_file" config_found=true fi @@ -1225,18 +1218,15 @@ reset_git_config() { # Helper function to load config files in the libreportal command commandReloadConfigs() { - # Load new structure config files only + # Load new structure config files only. Skip subdirectories (e.g. the + # per-location nested backup configs/backup/locations//) — those are + # loaded by their own sourceBackupLocations helper. Skip the .category + # marker files too. Matches the guard initReloadConfigs / commandUpdateConfigOption + # already use. for category_dir in "$configs_dir"/*; do if [ -d "$category_dir" ] && [ -f "$category_dir/.category" ]; then for config_file in "$category_dir"/*; do - local should_load=true - local filename=$(basename "$config_file") - # Skip .category files and excluded files (hardcoded for now) - if [[ "$config_file" =~ \.category$ ]]; then - should_load=false - fi - - if [ "$should_load" = true ]; then + if [ -f "$config_file" ] && [[ ! "$config_file" =~ \.category$ ]]; then source "$config_file" fi done