Update Distro
This commit is contained in:
parent
3b852c17b6
commit
1202f32d9a
1 changed files with 24 additions and 0 deletions
24
script.sh
Normal file
24
script.sh
Normal file
|
|
@ -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
|
||||||
Loading…
Reference in a new issue