From 1202f32d9a0f2cd8257da1679f5e540b9e2ab73a Mon Sep 17 00:00:00 2001 From: joeri Date: Sat, 3 Aug 2024 13:02:52 +0200 Subject: [PATCH] Update Distro --- script.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 script.sh diff --git a/script.sh b/script.sh new file mode 100644 index 0000000..3e98645 --- /dev/null +++ b/script.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Check the Linux distro +distro=$(cat /etc/os-release | grep ^NAME | cut -d '=' -f2- | sed 's/"//g') + +# Update the OS +case $distro in + "Ubuntu" | "Linux Mint") + sudo apt update && sudo apt upgrade -y + ;; + "Fedora" | "CentOS" | "RHEL") + sudo dnf update -y + ;; + "openSUSE") + sudo zypper update -y + ;; + "Debian") + sudo apt update && sudo apt upgrade -y + ;; + *) + echo "Unsupported Linux distribution: $distro" + exit 1 + ;; +esac \ No newline at end of file