From 7d6275fea817e751510a8eccc1995070221a5548 Mon Sep 17 00:00:00 2001 From: ua1zbe Date: Fri, 5 Aug 2022 17:30:15 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D0=BB(=D0=B0)=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20''?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buster.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 buster.sh diff --git a/buster.sh b/buster.sh new file mode 100644 index 0000000..2b679c6 --- /dev/null +++ b/buster.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +set -o errexit + +# N4IRS 10/25/2020 + +################################################# +# # +# Add DVSwitch Repository and gpg key # +# # +################################################# + +if [[ $(/usr/bin/id -u) -ne 0 ]]; then + echo "Not running as root" + echo "either run as root or with sudo" + exit +fi + +echo "" +echo "Starting DVSwitch repository install" + +distribution=buster + +# INSTALL gnupg needed for gpg.key +[ ! -x "/usr/bin/gpg" ] && apt-get install gnupg -y + +# Add the backport repository, if needed to install monit +if [ $(apt-cache policy monit | grep -c "Candidate: (none)") -eq 1 ] ; then + # add repository + printf "%s\n" "deb http://ftp.de.debian.org/debian buster-backports main" | tee /etc/apt/sources.list.d/buster-backports.list +fi + +# INSTALL netstat needed by dvswitch.sh +[ ! -x "/bin/netstat" ] && apt-get install net-tools -y + +# Check for rc.local and create if not found. +FILE="/etc/rc.local" + if [ ! -f "$FILE" ] ; then + echo '#!/bin/sh -e' > $FILE + echo '' >> $FILE + echo 'exit 0' >> $FILE + chmod +x $FILE + fi + +# Are the repos installed +# Should this test for buster too? +if [ -f /etc/apt/sources.list.d/dvswitch.list ] +then + echo "The Repository file already exists, exiting" + exit 0 +fi + +# Install the key and add the repo +echo "Adding DVSwitch repositories to existing system" +wget -O - http://dvswitch.org/DVSwitch_Repository/dvswitch.gpg.key 2>/dev/null | apt-key add - > /dev/null 2>&1 +# wget -O - http://dvswitch.org/DVSwitch_Repository/dvswitch.gpg.key | apt-key add - +echo "# Official DVSwitch repository" >/etc/apt/sources.list.d/dvswitch.list +echo "deb http://dvswitch.org/DVSwitch_Repository $distribution hamradio" >>/etc/apt/sources.list.d/dvswitch.list +echo "#" >>/etc/apt/sources.list.d/dvswitch.list + +echo "download package information from all configured sources" +apt-get update --allow-releaseinfo-change > /dev/null 2>&1 +apt-get update > /dev/null 2>&1 + +# print the installed repositories +echo "Installed repositories:" +apt-cache policy | grep http | awk '{print $2 $3}' | sort -u + +echo "" +echo "Finished DVSwitch repository install" +