From 205864cebc2b3506ec808326957b6ab20139ede2 Mon Sep 17 00:00:00 2001 From: pvincent Date: Fri, 9 Sep 2022 18:18:37 +0400 Subject: [PATCH] fix mithril.re repositories on fresh install --- src/main | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main b/src/main index f963016..7561599 100755 --- a/src/main +++ b/src/main @@ -64,17 +64,22 @@ REQUIRED_PACKAGES=( echo "# configure apt sources to the mithril's" echo "========================================" -echo "deb http://debian.mithril.re/debian bullseye main contrib non-free" | sudo tee /etc/apt/sources.list -echo "deb http://debian.mithril.re/debian bullseye-updates main contrib non-free" | sudo tee -a /etc/apt/sources.list -echo "deb http://debian.mithril.re/debian-security/ bullseye-security main contrib non-free" | sudo tee -a /etc/apt/sources.list -echo "# updating repositories" -echo "===================" -if [[ $(date --date='-12 hours' +%s) -gt $(date -d "$(stat -c %y /var/lib/apt/lists/partial)" +%s) ]]; then +if ! grep -q debian.mithril.re /etc/apt/sources.list; then + echo "deb http://debian.mithril.re/debian bullseye main contrib non-free" | sudo tee /etc/apt/sources.list + echo "deb http://debian.mithril.re/debian bullseye-updates main contrib non-free" | sudo tee -a /etc/apt/sources.list + echo "deb http://debian.mithril.re/debian-security/ bullseye-security main contrib non-free" | sudo tee -a /etc/apt/sources.list sudo apt update sudo apt autoremove -y else - echo "repositories recently updated!" + echo "# updating repositories" + echo "===================" + if [[ $(date --date='-12 hours' +%s) -gt $(date -d "$(stat -c %y /var/lib/apt/lists/partial)" +%s) ]]; then + sudo apt update + sudo apt autoremove -y + else + echo "repositories recently updated!" + fi fi echo "# required packages"