Fix module config reading
This commit is contained in:
parent
4ab8a9c8ec
commit
ab1939834d
@ -141,6 +141,19 @@ image_copy() {
|
|||||||
echo "$icons_dir_name/$file_name.$extension"
|
echo "$icons_dir_name/$file_name.$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Read the module's configuration.
|
||||||
|
read_config() {
|
||||||
|
eval timestamp="\${${MODULE}_timestamp:-}"
|
||||||
|
eval dusum="\${${MODULE}_dusum:-}"
|
||||||
|
eval section="\${${MODULE}_section:-}"
|
||||||
|
eval repo_title="\${${MODULE}_repo_title:-}"
|
||||||
|
eval icon="\${${MODULE}_repo_icon:-}"
|
||||||
|
eval repo_description="\${${MODULE}_repo_description:-}"
|
||||||
|
eval disable_size_calc="\${${MODULE}_disable_size_calc:-0}"
|
||||||
|
eval repo_skip="\${${MODULE}_repo_skip:-0}"
|
||||||
|
eval timestamp_file_stat="\${${MODULE}_timestamp_file_stat:-}"
|
||||||
|
}
|
||||||
|
|
||||||
# Cli options.
|
# Cli options.
|
||||||
update_unknown_dir_size=0
|
update_unknown_dir_size=0
|
||||||
selected_mirrors=()
|
selected_mirrors=()
|
||||||
@ -315,6 +328,10 @@ for ((i=0; i<${#selected_mirrors[@]}; i++)); do
|
|||||||
fi
|
fi
|
||||||
log "Checking repo $dir_name"
|
log "Checking repo $dir_name"
|
||||||
|
|
||||||
|
|
||||||
|
# If a module was found, we do not need to look further.
|
||||||
|
found_repo=0
|
||||||
|
|
||||||
# Check each module to see if this directory is a module's repo.
|
# Check each module to see if this directory is a module's repo.
|
||||||
for MODULE in ${MODULES:?}; do
|
for MODULE in ${MODULES:?}; do
|
||||||
# Get the repo with the trailing slash removed.
|
# Get the repo with the trailing slash removed.
|
||||||
@ -322,10 +339,9 @@ for ((i=0; i<${#selected_mirrors[@]}; i++)); do
|
|||||||
# Get the sync method for QFM detection.
|
# Get the sync method for QFM detection.
|
||||||
eval sync_method="\${${MODULE}_sync_method:-rsync}"
|
eval sync_method="\${${MODULE}_sync_method:-rsync}"
|
||||||
|
|
||||||
# Deterimine if this module is this repo.
|
# If is this module.
|
||||||
this_repo=0
|
|
||||||
if [[ "${repo:?}" == "$real_dir" ]]; then
|
if [[ "${repo:?}" == "$real_dir" ]]; then
|
||||||
this_repo=1
|
found_repo=1
|
||||||
# If QFM module, we need to determine sub path using QFM logic.
|
# If QFM module, we need to determine sub path using QFM logic.
|
||||||
elif [[ "${sync_method:?}" == "qfm" ]]; then
|
elif [[ "${sync_method:?}" == "qfm" ]]; then
|
||||||
# We need a mapping so we can know the final directory name.
|
# We need a mapping so we can know the final directory name.
|
||||||
@ -356,24 +372,16 @@ for ((i=0; i<${#selected_mirrors[@]}; i++)); do
|
|||||||
docroot=$repo
|
docroot=$repo
|
||||||
for module in ${modules:?}; do
|
for module in ${modules:?}; do
|
||||||
if [[ "$docroot/$(module_dir "$module")" == "$real_dir" ]]; then
|
if [[ "$docroot/$(module_dir "$module")" == "$real_dir" ]]; then
|
||||||
this_repo=1
|
found_repo=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If this module was identified as this repo, grab configs.
|
# If this module was identified as this repo, grab configs.
|
||||||
if ((this_repo)); then
|
if ((found_repo)); then
|
||||||
log "Found repo configurations"
|
log "Found repo configurations"
|
||||||
eval timestamp="\${${MODULE}_timestamp:-}"
|
read_config
|
||||||
eval dusum="\${${MODULE}_dusum:-}"
|
|
||||||
eval section="\${${MODULE}_section:-}"
|
|
||||||
eval repo_title="\${${MODULE}_repo_title:-}"
|
|
||||||
eval icon="\${${MODULE}_repo_icon:-}"
|
|
||||||
eval repo_description="\${${MODULE}_repo_description:-}"
|
|
||||||
eval disable_size_calc="\${${CUSTOM_MODULE}_disable_size_calc:-0}"
|
|
||||||
eval repo_skip="\${${CUSTOM_MODULE}_repo_skip:-0}"
|
|
||||||
eval timestamp_file_stat="\${${CUSTOM_MODULE}_timestamp_file_stat:-}"
|
|
||||||
|
|
||||||
# If a timestamp file exists, grab and format the date.
|
# If a timestamp file exists, grab and format the date.
|
||||||
if [[ -f ${timestamp:?} ]]; then
|
if [[ -f ${timestamp:?} ]]; then
|
||||||
@ -392,23 +400,19 @@ for ((i=0; i<${#selected_mirrors[@]}; i++)); do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# To allow customization of non synced modules, check each module.
|
if ((found_repo == 0)); then
|
||||||
for CUSTOM_MODULE in ${CUSTOM_MODULES:?}; do
|
# To allow customization of non synced modules, check each module.
|
||||||
# Get the repo with trailing slash removed.
|
for MODULE in ${CUSTOM_MODULES:?}; do
|
||||||
eval repo="\${${CUSTOM_MODULE}_repo%/}"
|
# Get the repo with trailing slash removed.
|
||||||
|
eval repo="\${${MODULE}_repo%/}"
|
||||||
# Confirm if this custom module is this repo, and parse configs if it is.
|
|
||||||
if [[ "${repo:?}" == "$real_dir" ]]; then
|
# Confirm if this custom module is this repo, and parse configs if it is.
|
||||||
log "Found custom configurations"
|
if [[ "${repo:?}" == "$real_dir" ]]; then
|
||||||
eval section="\${${CUSTOM_MODULE}_section:-}"
|
log "Found custom configurations"
|
||||||
eval repo_title="\${${CUSTOM_MODULE}_repo_title:-}"
|
read_config
|
||||||
eval icon="\${${CUSTOM_MODULE}_repo_icon:-}"
|
fi
|
||||||
eval repo_description="\${${CUSTOM_MODULE}_repo_description:-}"
|
done
|
||||||
eval disable_size_calc="\${${CUSTOM_MODULE}_disable_size_calc:-0}"
|
fi
|
||||||
eval repo_skip="\${${CUSTOM_MODULE}_repo_skip:-0}"
|
|
||||||
eval timestamp_file_stat="\${${CUSTOM_MODULE}_timestamp_file_stat:-}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# If we should skip this repo, continue to the next.
|
# If we should skip this repo, continue to the next.
|
||||||
if ((${repo_skip:-0})); then
|
if ((${repo_skip:-0})); then
|
||||||
|
Loading…
Reference in New Issue
Block a user