gen-apt-conf: deduplicate repo definitions with REPO_DEFS table

parent d9ca7494
...@@ -58,96 +58,56 @@ done ...@@ -58,96 +58,56 @@ done
APTCONF="$buildertmp/apt.conf.ximper" APTCONF="$buildertmp/apt.conf.ximper"
SOURCES="$buildertmp/sources.list.ximper" SOURCES="$buildertmp/sources.list.ximper"
gen_sources() { NET_BASE="https://download.etersoft.ru/pub"
for repo in $REPOS; do LOCAL_BASE="file:/var/ftp/pub"
case "$repo" in
deferred) # тип|путь относительно базы
base_url="https://download.etersoft.ru/pub/Etersoft Sisyphus/Deferred" declare -A REPO_DEFS=(
local_path="file:/var/ftp/pub/Etersoft Sisyphus/Deferred" [deferred]="classic|Etersoft Sisyphus/Deferred"
if [ "$NETWORK" == "true" ]; then [deferred-beta]="classic|Etersoft Sisyphus/Deferred_BETA"
repo_path="$base_url" [ximper-additives]="addon|Etersoft/XimperLinux/Current Additives"
else [ximper-additives-devel]="addon|Etersoft/XimperLinux/Devel Additives"
repo_path="$local_path" [ximper-substrates]="addon|Etersoft/XimperLinux/Current Substrates"
fi [ximper-substrates-devel]="addon|Etersoft/XimperLinux/Devel Substrates"
cat <<EOF >> "$SOURCES" )
rpm [alt] $repo_path/x86_64 classic
rpm [alt] $repo_path/x86_64-i586 classic add_repo() {
rpm [alt] $repo_path/noarch classic local type=$1 path=$2 repo_path
EOF
;; if [ "$NETWORK" == "true" ]; then
deferred-beta) repo_path="$NET_BASE/$path"
base_url="https://download.etersoft.ru/pub/Etersoft Sisyphus/Deferred_BETA" else
local_path="file:/var/ftp/pub/Etersoft Sisyphus/Deferred_BETA" repo_path="$LOCAL_BASE/$path"
if [ "$NETWORK" == "true" ]; then fi
repo_path="$base_url"
else if [ "$type" == "classic" ]; then
repo_path="$local_path" cat <<EOF >> "$SOURCES"
fi
cat <<EOF >> "$SOURCES"
rpm [alt] $repo_path/x86_64 classic rpm [alt] $repo_path/x86_64 classic
rpm [alt] $repo_path/x86_64-i586 classic rpm [alt] $repo_path/x86_64-i586 classic
rpm [alt] $repo_path/noarch classic rpm [alt] $repo_path/noarch classic
EOF EOF
;; else
ximper-additives) cat <<EOF >> "$SOURCES"
base_url="https://download.etersoft.ru/pub/Etersoft/XimperLinux/Current Additives"
local_path="file:/var/ftp/pub/Etersoft/XimperLinux/Current Additives"
if [ "$NETWORK" == "true" ]; then
repo_path="$base_url"
else
repo_path="$local_path"
fi
cat <<EOF >> "$SOURCES"
rpm $repo_path/x86_64 addon
rpm $repo_path/noarch addon
EOF
;;
ximper-additives-devel)
base_url="https://download.etersoft.ru/pub/Etersoft/XimperLinux/Devel Additives"
local_path="file:/var/ftp/pub/Etersoft/XimperLinux/Devel Additives"
if [ "$NETWORK" == "true" ]; then
repo_path="$base_url"
else
repo_path="$local_path"
fi
cat <<EOF >> "$SOURCES"
rpm $repo_path/x86_64 addon
rpm $repo_path/noarch addon
EOF
;;
ximper-substrates)
base_url="https://download.etersoft.ru/pub/Etersoft/XimperLinux/Current Substrates"
local_path="file:/var/ftp/pub/Etersoft/XimperLinux/Current Substrates"
if [ "$NETWORK" == "true" ]; then
repo_path="$base_url"
else
repo_path="$local_path"
fi
cat <<EOF >> "$SOURCES"
rpm $repo_path/x86_64 addon
rpm $repo_path/noarch addon
EOF
;;
ximper-substrates-devel)
base_url="https://download.etersoft.ru/pub/Etersoft/XimperLinux/Devel Substrates"
local_path="file:/var/ftp/pub/Etersoft/XimperLinux/Devel Substrates"
if [ "$NETWORK" == "true" ]; then
repo_path="$base_url"
else
repo_path="$local_path"
fi
cat <<EOF >> "$SOURCES"
rpm $repo_path/x86_64 addon rpm $repo_path/x86_64 addon
rpm $repo_path/noarch addon rpm $repo_path/noarch addon
EOF EOF
;; fi
}
*hasher*) gen_sources() {
cat <<EOF >> "$SOURCES" for repo in $REPOS; do
if [[ "$repo" == *hasher* ]]; then
cat <<EOF >> "$SOURCES"
rpm-dir file:/tmp/.private/$USER/hasher-sisyphus-64/ repo/x86_64 hasher rpm-dir file:/tmp/.private/$USER/hasher-sisyphus-64/ repo/x86_64 hasher
EOF EOF
;; continue
esac fi
local def="${REPO_DEFS[$repo]}"
[ -z "$def" ] && continue
IFS='|' read -r type path <<< "$def"
add_repo "$type" "$path"
done done
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment