From 34090e5d1c855c5e0f9406cacb9afec246badcee Mon Sep 17 00:00:00 2001 From: "b.waal" Date: Thu, 31 Aug 2023 01:59:13 +0200 Subject: [PATCH] Add 'Config/OScheck.sh' --- Config/OScheck.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Config/OScheck.sh diff --git a/Config/OScheck.sh b/Config/OScheck.sh new file mode 100644 index 0000000..10ff92b --- /dev/null +++ b/Config/OScheck.sh @@ -0,0 +1,29 @@ +#!/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 != alpine ]]; then + echo $dist + whiptail --title "Error" --msgbox "Only Debian 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 \ No newline at end of file