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

parent d9ca7494
......@@ -58,96 +58,56 @@ done
APTCONF="$buildertmp/apt.conf.ximper"
SOURCES="$buildertmp/sources.list.ximper"
gen_sources() {
for repo in $REPOS; do
case "$repo" in
deferred)
base_url="https://download.etersoft.ru/pub/Etersoft Sisyphus/Deferred"
local_path="file:/var/ftp/pub/Etersoft Sisyphus/Deferred"
if [ "$NETWORK" == "true" ]; then
repo_path="$base_url"
else
repo_path="$local_path"
fi
cat <<EOF >> "$SOURCES"
rpm [alt] $repo_path/x86_64 classic
rpm [alt] $repo_path/x86_64-i586 classic
rpm [alt] $repo_path/noarch classic
EOF
;;
deferred-beta)
base_url="https://download.etersoft.ru/pub/Etersoft Sisyphus/Deferred_BETA"
local_path="file:/var/ftp/pub/Etersoft Sisyphus/Deferred_BETA"
if [ "$NETWORK" == "true" ]; then
repo_path="$base_url"
else
repo_path="$local_path"
fi
cat <<EOF >> "$SOURCES"
NET_BASE="https://download.etersoft.ru/pub"
LOCAL_BASE="file:/var/ftp/pub"
# тип|путь относительно базы
declare -A REPO_DEFS=(
[deferred]="classic|Etersoft Sisyphus/Deferred"
[deferred-beta]="classic|Etersoft Sisyphus/Deferred_BETA"
[ximper-additives]="addon|Etersoft/XimperLinux/Current Additives"
[ximper-additives-devel]="addon|Etersoft/XimperLinux/Devel Additives"
[ximper-substrates]="addon|Etersoft/XimperLinux/Current Substrates"
[ximper-substrates-devel]="addon|Etersoft/XimperLinux/Devel Substrates"
)
add_repo() {
local type=$1 path=$2 repo_path
if [ "$NETWORK" == "true" ]; then
repo_path="$NET_BASE/$path"
else
repo_path="$LOCAL_BASE/$path"
fi
if [ "$type" == "classic" ]; then
cat <<EOF >> "$SOURCES"
rpm [alt] $repo_path/x86_64 classic
rpm [alt] $repo_path/x86_64-i586 classic
rpm [alt] $repo_path/noarch classic
EOF
;;
ximper-additives)
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"
else
cat <<EOF >> "$SOURCES"
rpm $repo_path/x86_64 addon
rpm $repo_path/noarch addon
EOF
;;
fi
}
*hasher*)
cat <<EOF >> "$SOURCES"
gen_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
EOF
;;
esac
continue
fi
local def="${REPO_DEFS[$repo]}"
[ -z "$def" ] && continue
IFS='|' read -r type path <<< "$def"
add_repo "$type" "$path"
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