packetradio-guide/docs/static/files/setup.sh

60 lines
3.1 KiB
Bash
Raw Normal View History

2024-06-19 00:58:06 +01:00
#!/bin/bash
pid=$$
name=$(cat -A /proc/$pid/cmdline | tr '^@' ' ' | awk '{print $2}')
[ "`id -u`" -ne 0 ] && echo -e "\033[31mYou are not running this as a user with elevated privileges.\033[0m Please either \033[32mlog in as root and re-run this script\033[0m, or run \033[32msudo $name\033[0m. This script will now terminate." && exit
echo "Checking operating system version..."
osstr=`hostnamectl |grep "Operating System" |awk '{$1=""; $2=""; print $0}'`
echo "Detected operating system as:"
echo -e "\033[32m$osstr\033[0m"
osname=`echo "$osstr" |awk '{print $1}'`
osver=`echo "$osstr" |sed 's/GNU\/Linux//g'`
2024-09-25 01:10:13 +01:00
echo -e "$osver Detected"
apt update && apt install curl
2024-06-19 00:58:06 +01:00
case `echo $osver` in
2024-09-25 01:10:13 +01:00
"Debian trixie/sid"*)
echo "Installing Repo, please wait..."
2024-11-23 00:58:46 +00:00
curl https://repo.hibbian.org/packetrepo/pool/main/h/hibbian-archive-keyring/hibbian-archive-keyring_20240924~packetrepo~TRIXIE+3_all.deb | tee /tmp/hibbian-archive-keyring.deb
2024-09-25 01:10:13 +01:00
apt install /tmp/hibbian-archive-keyring.deb
2024-06-19 00:58:06 +01:00
echo -e "\033[32mRepository added correctly.\033[0m"
;;
"Debian 12"*)
2024-09-25 01:10:13 +01:00
echo "Installing Repo, please wait..."
2024-11-23 00:58:46 +00:00
curl https://repo.hibbian.org/packetrepo/pool/main/h/hibbian-archive-keyring/hibbian-archive-keyring_20240924~packetrepo12+3_all.deb | tee /tmp/hibbian-archive-keyring.deb
2024-09-25 01:10:13 +01:00
apt install /tmp/hibbian-archive-keyring.deb
2024-06-19 00:58:06 +01:00
echo -e "\033[32mRepository added correctly.\033[0m"
;;
"Raspbian 12"*)
2024-09-25 01:10:13 +01:00
echo "Installing Repo, please wait..."
2024-11-23 00:58:46 +00:00
curl https://repo.hibbian.org/packetrepo/pool/main/h/hibbian-archive-keyring/hibbian-archive-keyring_20240924~packetrepo12+3_all.deb | tee /tmp/hibbian-archive-keyring.deb
2024-09-25 01:10:13 +01:00
apt install /tmp/hibbian-archive-keyring.deb
2024-06-19 00:58:06 +01:00
echo -e "\033[32mRepository added correctly.\033[0m"
;;
"Raspbian 11"*)
2024-09-25 01:10:13 +01:00
echo "Installing Repo, please wait..."
2024-11-23 00:58:46 +00:00
curl https://repo.hibbian.org/packetrepo/pool/main/h/hibbian-archive-keyring/hibbian-archive-keyring_20240924~packetrepo11+3_all.deb | tee /tmp/hibbian-archive-keyring.deb
2024-09-25 01:10:13 +01:00
apt install /tmp/hibbian-archive-keyring.deb
2024-06-19 00:58:06 +01:00
echo -e "\033[32mRepository added correctly.\033[0m"
;;
"Debian 11"*)
2024-09-25 01:10:13 +01:00
echo "Installing Repo, please wait..."
2024-11-23 00:58:46 +00:00
curl https://repo.hibbian.org/packetrepo/pool/main/h/hibbian-archive-keyring/hibbian-archive-keyring_20240924~packetrepo11+3_all.deb | tee /tmp/hibbian-archive-keyring.deb
2024-09-25 01:10:13 +01:00
apt install /tmp/hibbian-archive-keyring.deb
2024-06-19 00:58:06 +01:00
echo -e "\033[32mRepository added correctly.\033[0m"
;;
*)
2024-09-25 01:10:13 +01:00
echo "No repository to add - check you are running a compatible operating system. Please see https://www.hibbian.org for more information" && exit
2024-06-19 00:58:06 +01:00
;;
esac
echo "Updating your package lists..."
apt update
echo -e "\033[32mPackage list update complete\033[0m"
echo -e "This script will now exit. You can install packages from the new repository by running:"
echo ""
echo -e "\033[32msudo apt install <packagename>\033[0m"
echo ""
echo "Or if you are logged in as root already:"
echo ""
echo -e "\033[32mapt install <packagename>\033[0m"
echo ""
exit