[HOW TO] UPDATE AND UPGRADE SCRIPT - update & upgrade your whole system using this bash script I wrote

I wrote an update script to update and upgrade the whole system including flatpaks with the option to reboot the system at the end. Dependencies is neofetch and flatpaks perfect for Pro editions but can be used for non Pro.

Just comment out # what you don't need in the script. To use copy over to your home folder and run sudo bash update.sh in ther terminal but make sure file is marked as executable. I have attatched images below.

I hope this helps others as much as it helps me :grinning:
https://drive.google.com/file/d/1f6_nm7iVgYzUsnBVopeoDjfhB4Tkik5L/view?usp=sharing






1 Like

If anyone has any problems feel free to let me know :grinning:
If urgent twitter is your best bet at https://twitter.com/justincroser

I think it would be nice if you could share the script over GitHub or similar. That way we can examine the script without having to download anything.

You can view the script in a default text editor on the OS once downloaded if you don't want to run it. I may create a GitHub account if I make more scripts as I only have the one so far

1 Like

Agreed, it's a habit for me to not download random stuff from the internet without at least having the chance to examine it before hand. I really think more people should familiarize themselves with that, as it's one of the most common forms to download malware in your computer. Not to mention the privacy aspect.

In this case though, I was asking mostly for the source code out of convenience. It's just a lot easier to read and find the code when it's posted online.

I just have this function in my .zshrc that does the exact same thing:

function update(){
sudo apt update
sudo apt upgrade
flatpak update
}

You can copy paste the above code in your .bashrc file.

Then, it's a simple command: update in your terminal to update flatpaks and apt packages.

Seeing as everyone has a problem this is the full script

#!/bin/bash

#Assumes you have Neofetch / Flatpaks / Piholes installed. Comment out whats not needed

#Don't forget to CHMOD + x this file to make it executable but I should've already done that for you'.

#Made by Justin Croser https://justincroser.net I am not responsible for any breakages use at your own risk however I doubt it will be a problem with the script except an distribution update / dependancy issue' 

#Debian based servers
apt update
apt upgrade -y
#I like a clean system, but these may or may not be helpful.
apt autoclean -y
apt autoremove -y

#Fedora/Redhat machines
#dnf update -y

#Updates Flatpaks
flatpak update -y

#Updates Pihole if you have one
#pihole -up

#Ask if user wants to reboot the systm? Useful for home servers
read -r -p "Reboot? [Y/n] " input
case $input in
	[yY][eE][sS]|[yY])
		echo "You have opted to reboot!"
			systemctl reboot -i
			;;
	[nN][oO]|[nN])
		echo "You will not reboot right now!"
		neofetch
			exit 1
			;;
	*)
		echo "Invalid input..."
		neofetch
		exit 1
		;;
esac

I will not help in the future. - Justin

It is understandable that different views on how to approach file sharing can be frustrating at times.
That is a great script, @justinc - thanks for sharing.

Exploring the control at your disposal with scripting is great development and practice.
Please keep in mind that it is a helpful suggestion to provide a means of reviewing scripts prior to downloading.

3 Likes

Justin - I think that is a bit of an overreaction to what I read as constructive comment. I hope you will reconsider as your contribitions are appreciated.

6 Likes

I second this sentiment. :slight_smile:
We all feel unappreciated from time to time.

3 Likes

I third that.

When I make my icon themes I always include link to github so people can examine my work, so don't take offense off it. See it as a people are interested in it :slight_smile:

4 Likes

I am only starting out in scripting so I didn't see the need for a github page. I do however see the issue I just got the vibe that I was trying to install or have users do things to their system which they don't want to do. (hence my issue with snaps so I don't use them)

There is no malice intended or in the script, a small disclaimer is because I'm not responsible for developers packages or the OS itself. Even on arch we are somewhat responsible on what we install and how we use but if a package breaks the system we must diagnose or fix it ourselves until a update fixing said bug comes in.

2 Likes

Added on to this I now have the code over on my GitHub page for all to see justincroser (Justin) ยท GitHub

1 Like

Very clean looking.

1 Like

Thanks for the advice. I have created a new version of the script itself for most linux based systems, ubuntu, debian, arch, fedora, redhat etc... I will make 3 new paths for the actual type of operating systems so it's ready to go for noobs and power users alike.