gen-apt-conf: add repository selection and validation

parent 84ff9835
...@@ -62,14 +62,22 @@ LOCAL_BASE="file:/var/ftp/pub" ...@@ -62,14 +62,22 @@ LOCAL_BASE="file:/var/ftp/pub"
# тип|путь относительно базы # тип|путь относительно базы
declare -A REPO_DEFS=( declare -A REPO_DEFS=(
[sisyphus]="classic|ALTLinux Sisyphus"
[deferred]="classic|Etersoft Sisyphus/Deferred" [deferred]="classic|Etersoft Sisyphus/Deferred"
[deferred-beta]="classic|Etersoft Sisyphus/Deferred_BETA" [deferred-beta]="classic|Etersoft Sisyphus/Deferred_BETA"
[deferred-devel]="classic|Etersoft Sisyphus/Deferred_DEVEL"
[ximper-additives]="addon|Etersoft/XimperLinux/Current Additives" [ximper-additives]="addon|Etersoft/XimperLinux/Current Additives"
[ximper-additives-devel]="addon|Etersoft/XimperLinux/Devel Additives" [ximper-additives-devel]="addon|Etersoft/XimperLinux/Devel Additives"
[ximper-substrates]="addon|Etersoft/XimperLinux/Current Substrates" [ximper-substrates]="addon|Etersoft/XimperLinux/Current Substrates"
[ximper-substrates-devel]="addon|Etersoft/XimperLinux/Devel Substrates" [ximper-substrates-devel]="addon|Etersoft/XimperLinux/Devel Substrates"
) )
check_hasher_repo() {
local path="/tmp/.private/$USER/hasher-sisyphus-64/repo/x86_64/RPMS.hasher"
[ -d "$path" ] || print_error "Локальный репозиторий 'hasher' не найден: $path"
}
add_repo() { add_repo() {
local type=$1 path=$2 repo_path local type=$1 path=$2 repo_path
...@@ -94,17 +102,18 @@ EOF ...@@ -94,17 +102,18 @@ EOF
} }
gen_sources() { gen_sources() {
local repo local repo def type path
for repo in $REPOS; do for repo in $REPOS; do
if [ "$repo" == "hasher" ]; then if [ "$repo" == "hasher" ]; then
check_hasher_repo
cat <<EOF >> "$SOURCES" 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 continue
fi fi
local def="${REPO_DEFS[$repo]-}" def="${REPO_DEFS[$repo]-}"
[ -n "$def" ] || print_error "Неизвестный репозиторий: $repo. Используйте -h для справки." [ -n "$def" ] || print_error "Неизвестный репозиторий: $repo. Используйте -h для справки."
IFS='|' read -r type path <<< "$def" IFS='|' read -r type path <<< "$def"
......
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