From 1310e854bbef4c184d9a244a8ad0df2450ecee28 Mon Sep 17 00:00:00 2001 From: cyteen Date: Fri, 6 Mar 2026 00:16:59 +0000 Subject: [PATCH] Fixes and updates. --- 001_apt-sources.sh | 109 ++++++++++++++++++++++++++++++--------------- 1 file changed, 73 insertions(+), 36 deletions(-) diff --git a/001_apt-sources.sh b/001_apt-sources.sh index e6bb7c0..4ef54f1 100755 --- a/001_apt-sources.sh +++ b/001_apt-sources.sh @@ -1,17 +1,54 @@ #!/usr/bin/env bash # avoid duplicates set -x +set -euo pipefail + rm /etc/apt/sources.list rm /etc/apt/sources.list.d/devuan.list -sudo apt install -y apt-transport-tor apt-transport-https +# If you leave the update too long the keyring expires and your apt breaks. +install_devuan_keyring() { + local BASE_URL="https://pkgmaster.devuan.org/devuan/pool/main/d/devuan-keyring/" + local DEB_DIR="/tmp" -# https://www.devuan.org/os/packages -# FIXME: the mirror is now permenently on deb but: -# http://deb.devuan.org/merged -# is used for main, update, backports and security -# http://deb.devuan.org/devuan -# is used for experimental, proposed-updates + # Check for wget dependency + if ! command -v wget &>/dev/null; then + echo "Error: wget is not installed." >&2 + return 1 + fi + + echo "Searching for the latest devuan-keyring..." + + # Fetch directory listing, extract .deb links, filter, sort by version, take latest + local LATEST_DEB + LATEST_DEB=$(wget -q -O - "$BASE_URL" | + grep -oP 'devuan-keyring_\d{4}\.\d{2}\.\d{2}_all\.deb' | + sort -rV | + head -n 1) + + if [ -z "$LATEST_DEB" ]; then + echo "Error: Could not find any devuan-keyring_*.deb in listing" >&2 + return 1 + fi + + echo "Latest found: $LATEST_DEB" + local FULL_URL="${BASE_URL}${LATEST_DEB}" + local DEB_PATH="${DEB_DIR}/${LATEST_DEB}" + + echo "Downloading to $DEB_PATH..." + wget -q --show-progress -O "$DEB_PATH" "$FULL_URL" + + echo "Installing package..." + sudo dpkg -i "$DEB_PATH" + + # Clean up the downloaded file + rm "$DEB_PATH" + echo "Installation complete and cleanup finished." +} +install_devuan_keyring + +sudo apt install -y usrmerge +sudo apt install -y apt-transport-tor apt-transport-https TRANSPORT="https" #MIRROR=deb @@ -54,21 +91,21 @@ PROPOSED_LIST=('excalibur-proposed-updates') # Active (enabled) loop – all merged in your current choice for RELEASE in "${ACTIVE_LIST[@]}"; do echo "${RELEASE}" - bash -c "cat > ${AVAILABLE}/devuan_${RELEASE}.sources" <<-EOF + bash -c "cat > ${AVAILABLE}/devuan_${RELEASE}.sources" < ${AVAILABLE}/devuan_${RELEASE}.sources" <<-EOF + bash -c "cat > ${AVAILABLE}/devuan_${RELEASE}.sources" < ${AVAILABLE}/devuan_${RELEASE}.sources" <<-EOF - Enabled: yes - Types: deb deb-src - URIs: ${TRANSPORT}://${MIRROR}.devuan.org/devuan - Suites: ${RELEASE} - Components: main - Architectures: amd64 + bash -c "cat > ${AVAILABLE}/devuan_${RELEASE}.sources" < ${AVAILABLE}/devuan_${RELEASE}.sources" <<-EOF - Enabled: no - Types: deb deb-src - URIs: ${DEVUAN_URI} - Suites: ${RELEASE} - Components: ${SECTION_SPECIAL} - Architectures: amd64 - # Note: proposed-updates for upcoming point releases; not for production - EOF + bash -c "cat > ${AVAILABLE}/devuan_${RELEASE}.sources" < ${AVAILABLE}/devuan_${RELEASE}-onion.sources" <<-EOF - Enabled: no # change to yes if you run tor and want default onion - Types: deb deb-src - URIs: ${TOR_URI} - Suites: ${RELEASE} - Components: ${SECTION_USED} - Architectures: amd64 - # Tor / onion routing - requires apt-transport-tor installed and tor running - EOF + bash -c "cat > ${AVAILABLE}/devuan_${RELEASE}-onion.sources" <