first commit
This commit is contained in:
47
roles/base/repo.sh
Executable file
47
roles/base/repo.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
# Configure les dépôts Debian de base
|
||||
source "$PROJECT_DIR/lib.sh"
|
||||
enable_strict_mode
|
||||
|
||||
cat <<'EOM'
|
||||
|
||||
=> Base APT configuration
|
||||
|
||||
EOM
|
||||
|
||||
KEY_URL="https://ftp-master.debian.org/keys/archive-key-12.asc"
|
||||
KEYRING="/usr/share/keyrings/debian-archive-keyring.pgp"
|
||||
SOURCES="/etc/apt/sources.list.d/debian.sources"
|
||||
|
||||
read -r -d '' CONTENT <<EOM || true
|
||||
Types: deb
|
||||
URIs: https://deb.debian.org/debian
|
||||
Suites: trixie trixie-updates
|
||||
Components: main non-free-firmware contrib
|
||||
Signed-By: $KEYRING
|
||||
|
||||
Types: deb
|
||||
URIs: https://security.debian.org/debian-security
|
||||
Suites: trixie-security
|
||||
Components: main non-free-firmware contrib
|
||||
Signed-By: $KEYRING
|
||||
EOM
|
||||
|
||||
[[ -f /etc/apt/sources.list ]] && rm -f /etc/apt/sources.list && echo "Old /etc/apt/sources.list removed."
|
||||
|
||||
if [[ ! -f "$KEYRING" ]]; then
|
||||
if ! add_apt_key_from_url "$KEY_URL" "$KEYRING"; then
|
||||
echo "Warning: failed to add key from $KEY_URL" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -f "$SOURCES" ]] || ! printf '%s\n' "$CONTENT" | cmp -s - "$SOURCES"; then
|
||||
add_apt_sources_file "$CONTENT" "$SOURCES" || {
|
||||
echo "Failed to write $SOURCES" >&2
|
||||
exit 1
|
||||
}
|
||||
apt-get update
|
||||
echo "File $SOURCES written"
|
||||
else
|
||||
echo "File $SOURCES unchanged"
|
||||
fi
|
||||
Reference in New Issue
Block a user