Fix QFM repo configuration logic.
This commit is contained in:
parent
d99f3d310d
commit
e1a3a83f53
@ -263,6 +263,9 @@ And to check a module out, you can list the files with:
|
|||||||
rsync --list-only rsync://SERVER/MODULE
|
rsync --list-only rsync://SERVER/MODULE
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### repo
|
||||||
|
For the repo config, QFM requires the directory to be `$DOCROOT` which it'll then copy modules into. This is different from all other sync methods.
|
||||||
|
|
||||||
#### pre_hook
|
#### pre_hook
|
||||||
A hook to run prior to running QFM.
|
A hook to run prior to running QFM.
|
||||||
|
|
||||||
@ -308,7 +311,7 @@ For the trace file saving, this defines what type of repo is being synced. Optio
|
|||||||
#### Example
|
#### Example
|
||||||
```bash
|
```bash
|
||||||
example_sync_method=qfm
|
example_sync_method=qfm
|
||||||
example_repo='/home/mirror/http/example/'
|
example_repo='/home/mirror/http/'
|
||||||
example_timestamp='/home/mirror/timestamp/example'
|
example_timestamp='/home/mirror/timestamp/example'
|
||||||
example_source='rsync://mirrors.example.com'
|
example_source='rsync://mirrors.example.com'
|
||||||
example_modules=fedora-enchilada
|
example_modules=fedora-enchilada
|
||||||
|
@ -5,7 +5,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/mirror/.
|
|||||||
|
|
||||||
# Variables for trace generation.
|
# Variables for trace generation.
|
||||||
PROGRAM="mirror-sync"
|
PROGRAM="mirror-sync"
|
||||||
VERSION="20231107"
|
VERSION="20231114"
|
||||||
TRACEHOST=$(hostname -f)
|
TRACEHOST=$(hostname -f)
|
||||||
mirror_hostname=$(hostname -f)
|
mirror_hostname=$(hostname -f)
|
||||||
DATE_STARTED=$(LC_ALL=POSIX LANG=POSIX date -u -R)
|
DATE_STARTED=$(LC_ALL=POSIX LANG=POSIX date -u -R)
|
||||||
@ -827,7 +827,28 @@ rsync_sync() {
|
|||||||
quick_fedora_mirror_sync() {
|
quick_fedora_mirror_sync() {
|
||||||
MODULE=$1
|
MODULE=$1
|
||||||
acquire_lock "$MODULE"
|
acquire_lock "$MODULE"
|
||||||
|
|
||||||
|
# We need a mapping so we can know the final directory name.
|
||||||
|
MODULEMAPPING=(
|
||||||
|
fedora-alt alt
|
||||||
|
fedora-archive archive
|
||||||
|
fedora-enchilada fedora
|
||||||
|
fedora-epel epel
|
||||||
|
fedora-secondary fedora-secondary
|
||||||
|
)
|
||||||
|
|
||||||
|
# Helper function to map to dir name.
|
||||||
|
module_dir() {
|
||||||
|
for ((M=0; M<${#MODULEMAPPING[@]}; M++)); do
|
||||||
|
N=$((M+1))
|
||||||
|
if [[ "${MODULEMAPPING[$M]}" == "$1" ]]; then
|
||||||
|
echo "${MODULEMAPPING[$N]}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
M=$N
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Read the configuration for this module.
|
# Read the configuration for this module.
|
||||||
eval repo="\$${MODULE}_repo"
|
eval repo="\$${MODULE}_repo"
|
||||||
eval pre_hook="\$${MODULE}_pre_hook"
|
eval pre_hook="\$${MODULE}_pre_hook"
|
||||||
@ -856,8 +877,10 @@ quick_fedora_mirror_sync() {
|
|||||||
fi
|
fi
|
||||||
log_start_header
|
log_start_header
|
||||||
|
|
||||||
|
# Install QFM if not already installed.
|
||||||
quick_fedora_mirror_install
|
quick_fedora_mirror_install
|
||||||
|
|
||||||
|
# Build configuration file for QFM.
|
||||||
conf_path="${QFM_PATH}/${MODULE}_qfm.conf"
|
conf_path="${QFM_PATH}/${MODULE}_qfm.conf"
|
||||||
cat <<EOF > "$conf_path"
|
cat <<EOF > "$conf_path"
|
||||||
DESTD="$repo"
|
DESTD="$repo"
|
||||||
@ -874,6 +897,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
if [[ $module_mapping ]]; then
|
if [[ $module_mapping ]]; then
|
||||||
echo "MODULEMAPPING=($module_mapping)" >> "$conf_path"
|
echo "MODULEMAPPING=($module_mapping)" >> "$conf_path"
|
||||||
|
IFS=" " read -ra MODULEMAPPING < <(echo "$module_mapping")
|
||||||
fi
|
fi
|
||||||
if [[ $mirror_manager_mapping ]]; then
|
if [[ $mirror_manager_mapping ]]; then
|
||||||
echo "MIRRORMANAGERMAPPING=($mirror_manager_mapping)" >> "$conf_path"
|
echo "MIRRORMANAGERMAPPING=($mirror_manager_mapping)" >> "$conf_path"
|
||||||
@ -886,8 +910,10 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Create archive update file.
|
# Create archive update file.
|
||||||
mirror_update_file="${repo:?}/Archive-Update-in-Progress-${mirror_hostname:?}"
|
docroot=$repo
|
||||||
touch "$mirror_update_file"
|
for module in $modules; do
|
||||||
|
touch "$docroot$(module_dir "$module")/Archive-Update-in-Progress-${mirror_hostname:?}"
|
||||||
|
done
|
||||||
LOGFILE_SYNC="${LOGFILE}.sync"
|
LOGFILE_SYNC="${LOGFILE}.sync"
|
||||||
echo -n > "$LOGFILE_SYNC"
|
echo -n > "$LOGFILE_SYNC"
|
||||||
|
|
||||||
@ -928,12 +954,17 @@ EOF
|
|||||||
|
|
||||||
# Save trace information.
|
# Save trace information.
|
||||||
if [[ $repo_type ]]; then
|
if [[ $repo_type ]]; then
|
||||||
save_trace_file
|
for module in $modules; do
|
||||||
|
repo="$docroot$(module_dir "$module")"
|
||||||
|
save_trace_file
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
rm -f "$LOGFILE_SYNC"
|
rm -f "$LOGFILE_SYNC"
|
||||||
|
|
||||||
# Remove archive update file.
|
# Remove archive update file.
|
||||||
rm -f "$mirror_update_file"
|
for module in $modules; do
|
||||||
|
rm -f "$docroot$(module_dir "$module")/Archive-Update-in-Progress-${mirror_hostname:?}"
|
||||||
|
done
|
||||||
|
|
||||||
# If report mirror configuration file provided, run report mirror.
|
# If report mirror configuration file provided, run report mirror.
|
||||||
if [[ $report_mirror ]]; then
|
if [[ $report_mirror ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user