Pi-Hole/Config/OScheck.sh
2024-04-27 23:37:48 +02:00

29 lines
799 B
Bash

#!/bin/bash
##---------------##
# Static Vars #
##---------------##
dist=$(grep --color=never -Po "^ID=\K.*" "/etc/os-release")
dist_ver=$(grep --color=never -Po "^VERSION_ID=\K.*" "/etc/os-release")
dist_ver="${dist_ver//\"}"
##-----------##
# Check OS #
##-----------##
if [[ $dist != debian ]] && [[ $dist != raspbian ]] && [[ $dist != alpine ]]; then
echo $dist
whiptail --title "Error" --msgbox "Only Debian/Raspbian or Alpine are supported!" 8 78
clear
exit
else
dist=$(echo $dist | cut -c1 | tr a-z A-Z)$(echo $dist | cut -c2-)
if (whiptail --title "Info" --yesno "This script is tested on Debian 11 and Alpine 3.18.X, use it on your own risk!\nYou're currently running: $dist $dist_ver. \n\nContinue anyway?" 11 82); then
echo ""
else
clear
exit
fi
fi