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"