#!/usr/bin/env sh
set -eu

sources="/etc/apt/sources.list.d/debian.sources"

if [ ! -f "$sources" ]; then
    exit 0
fi

sed -i \
    -e 's|https\?://deb\.debian\.org/debian|http://mirror.arvancloud.ir/debian|g' \
    -e 's|https\?://security\.debian\.org/debian-security|http://mirror.arvancloud.ir/debian|g' \
    -e 's| bookworm-updates||g' \
    "$sources"

sed -i '/mirror\.arvancloud\.ir\/debian-security/d' "$sources"
