#!/bin/bash

# Корень зеркала
MIRROR_ROOT="/srv/ubuntu/mirror/mirror.yandex.ru/ubuntu"

# Список релизов Ubuntu
RELEASES=("bionic" "focal" "jammy" "noble")

# Секции репозиториев
SECTIONS=("main" "restricted" "universe" "multiverse")

# Типы обновлений
TYPES=("" "-updates" "-security" "-backports")

# Размеры иконок dep11
ICON_SIZES=("64x64" "128x128")

# Базовый URL зеркала
BASE_URL="https://mirror.yandex.ru/ubuntu/dists"

for RELEASE in "${RELEASES[@]}"; do
    for TYPE in "${TYPES[@]}"; do
        for SECTION in "${SECTIONS[@]}"; do
            for SIZE in "${ICON_SIZES[@]}"; do
                FILE="icons-$SIZE@2.tar.gz"
                URL="$BASE_URL/$RELEASE$TYPE/$SECTION/dep11/$FILE"
                DEST_DIR="$MIRROR_ROOT/dists/$RELEASE$TYPE/$SECTION/dep11"
                mkdir -p "$DEST_DIR"
                echo "Downloading $URL to $DEST_DIR"
                wget -c "$URL" -O "$DEST_DIR/$FILE"
            done
        done
    done
done

echo "Все dep11 файлы скачаны."
