Created
April 5, 2023 00:19
-
-
Save suuhm/c48ec4005eb329232e4cb5cca5f81b62 to your computer and use it in GitHub Desktop.
openSuse Leap Update / Upgrade Helper Script for smart updating your new versions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Copyright 2023 - suuhmer | |
| # All rights reserved | |
| ################################## | |
| # Suse Upgrader - Easy version # | |
| # Version beta 0.1 # | |
| ################################## | |
| clear | |
| echo " _______ __ __ _______ _______ __ __ _______ _______ ______ _______ ______ _______ ______ "; | |
| echo "| || | | || || | | | | || || || _ | | _ || | | || _ | "; | |
| echo "| _____|| | | || _____|| ___| | | | || _ || ___|| | || | |_| || _ || ___|| | || "; | |
| echo "| |_____ | |_| || |_____ | |___ | |_| || |_| || | __ | |_||_ | || | | || |___ | |_||_ "; | |
| echo "|_____ || ||_____ || ___| | || ___|| || || __ || || |_| || ___|| __ |"; | |
| echo " _____| || | _____| || |___ | || | | |_| || | | || _ || || |___ | | | |"; | |
| echo "|_______||_______||_______||_______| |_______||___| |_______||___| |_||__| |__||______| |_______||___| |_|"; | |
| echo | |
| echo "Version beta 0.1 - (c) 2023 suuhmer"; echo | |
| # setting varibales | |
| RS=$(lsb_release -rs) | |
| AVER=$RS | |
| read -p "[*] Actually used Version is: $AVER - Please enter new Version: " NVERT | |
| NVER=$NVERT | |
| check_yn_or_exit() { | |
| if [ $1 != "y" ]; then | |
| echo "[!] Exit..."; exit 0 | |
| fi | |
| } | |
| # MAIN START | |
| # | |
| zypper ll | |
| echo "[?] No Kernel log?" | |
| echo ; sleep 2 | |
| echo -n "[*] OK? lets go? (y/n) " ; read yn | |
| check_yn_or_exit $yn | |
| #zypper clean; zypper ref && zypper up | |
| echo "[?] Update Repos..." | |
| zypper repos --uri | grep -i update | grep -i yes | |
| if [ $? -gt 0 ]; then | |
| echo "Need to enable repos update..." | |
| echo | |
| zypper modifyrepo --enable repo-update | |
| fi | |
| echo; echo "[?] Update Files Version from ${AVER} to ${NVER}" | |
| cat /etc/zypp/repos.d/*.repo | grep $AVER | |
| if [ $? -eq 0 ]; then | |
| echo "Need to set releasever ${AVER} to ${NVER} variable..." | |
| sleep 2 ; echo -n "continue? (y/n)" ; read yn | |
| check_yn_or_exit $yn | |
| echo | |
| sed -i "s/${AVER}/${NVER}/g" /etc/zypp/repos.d/*.repo | |
| fi | |
| #zypper --releasever=$NVER refresh | |
| echo && sleep 2 | |
| echo "[!!] Now starting the DUP Process.." | |
| echo -n "OK? (y/n) " ; read yn | |
| check_yn_or_exit $yn | |
| #kk lets go ... | |
| zypper --releasever=$NVER dup --download-in-advance | |
| echo; echo "*********************************************"; echo | |
| echo "Success., now reboot?" | |
| echo | |
| echo "Check with: cat /etc/*-release after reboot!" | |
| echo; echo "*********************************************"; echo | |
| echo -n "Reboot? (y/n) " ; read yn | |
| check_yn_or_exit $yn | |
| # Else reboot now | |
| echo "Now reboot in 2 Minutes / Cancel with shutdown -c" | |
| shutdown -r +2 | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment