Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

get-latest-devuan-keyring.sh (Source)

#!/bin/sh
# Startdate: 2024-04-14-1 14:01
# Purpose: Get latest devuan keyring
# Dependencies: already have wget, running as root
# Project: preseed
set -x
test -z "${MIRROR}" && MIRROR=server3
echo "${MIRROR}" | grep -qE "https?:\/\/" && MIRROR="http://${MIRROR}"
fn="$( curl -L --silent "${MIRROR}/mirror/devuan/pool/DEVUAN/main/d/devuan-keyring/" | awk -F'"' "/devuan-keyring_[^ ]+_all.deb/{print \$8}" | tail -n 1 )"
test -z "${fn}" && {
   echo "Fatal! Failed to find latest devuan-keyring.deb from ${MIRROR}. Aborted."
   exit 1
}
echo "Using ${fn}"
wget "${MIRROR}/mirror/devuan/pool/DEVUAN/main/d/devuan-keyring/${fn}"
apt-get -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install ./"${fn%%.deb}.deb"