Here’s a tiny terminal based EndeavourOS software updater for those that are a bit unsure how it should be done.
It updates packages from Arch and EndeavourOS repos, and AUR packages.
It also checks that you have an internet connection.
The script
#!/bin/bash
#
# EndeavourOS software tiny updater.
# - Verifies internet connection.
# - Installs official updates.
# - If no official updates, installs AUR updates.
#
DIE() { echo "Error: $1" >&2 ; exit 1 ; }
Main() {
echo "Connection check..."
eos-connection-checker || DIE "internet connection problem!"
echo "Official updates..."
checkupdates && { sudo pacman -Syu ; return ; }
echo "AUR updates..."
local aurHelper=yay
[ -x /usr/bin/paru ] && aurHelper=paru # for 'paru' users!
local updates=$($aurHelper -Qua)
[ -n "$updates" ] && $aurHelper -Sua
}
Main
Install
Simply copy the script above e.g. into file /usr/local/bin/U and make it executable (all under sudo or su):
sudo nano /usr/local/bin/U # may use another editor as well
sudo chmod +x /usr/local/bin/U
Usage
To update your system in terminal, give command: U
Some details
Note that it separates “official” and AUR updates. So if there are official updates, you’ll have to run U another time for updating your AUR packages.
AUR updates are handled by an AUR helper called yay. However, another AUR helper paru will be used if you have it installed.
I use topgrade, and it works really well other than if there’s a bunch of updates and walk away while updating, must if the time i come back to find it stopped at some point to ask for my password again and didn’t finish. I usually have to run it at least two, maybe 3x before I’m done. It is nice it checks firmware though.
I like the general idea, but it does look like the implementation’s end result is no different to just running yay or paru ?
For example:
This runs checkupdates, and if there are no updates skips an update, otherwise run an update if there are updates. This is the same end result as just running pacman -Syu.
Same thing again, but for the AUR helper: run an update if there are updates.
Taken together, running yay will end up with the same end result: update packages if there are updates available.
I believe @manuel is simply supplying new users (and those not that script savy) a way of updating all via a simple input of a U. It also uses the proper way of checking for updates via checkupdates. This may also encourage new users to examine the script, see how it works, and then apply what they have learned to writing their own scripts for such purposes.
I agree yay will return very similar results. As far as topgrade is concerned I would rather run a simple script then load in yet another aur package I would have to check the pkbuild of to see if I want it on my system.
The only thing I would say is that using checkupdates is only useful if you want to check without running updates. If you are going to immediately follow it with updating the system I am not sure it is doing anything except consuming bandwidth.
using checkupdates in this context is not more correct than just running pacman -Syu.
checkupdates is there to check for updates without altering the package list. Immediately following it with pacman -Syu means there is no reason for using checkupdates; that is, if you update as soon as there are updates then there’s no reason to use checkupdates to check for updates!
Once topgrade is invoked, it will perform the following tasks one by one depending upon the OS you use. You will be asked to enter root/sudo user password wherever necessary.
On Linux:
Run your Linux system’s package manager and do the following operations:
No (unless I made a typo…). If official updates are available, it installs them and stops. In that case updating AUR packages needs another run of U.
Almost, but this implementation does not ask for password if there are no updates available.
If you run sudo pacman -Syu or yay or paru, it will usually ask for password.
This only avoids some extra output when there are no updates available. One could run only
$aurHelper -Sua
as well if the extra output doesn’t bother in case when no updates are available.
Out of curiosity, why would anyone want that behavior?
It can create some really odd situations where you have to run it a variable number of times to actually get all your packages updated.
You could run updates and when you try to run it again there could be additional updates so the second run wouldn’t update the AUR packages but the repo packages again.
Basically, when you run it, you don’t actually know what it is going to do until runtime.
Because updating official packages fully before updating (potentially unsafe) AUR stuff helps keeping system in order.
I don’t think there would ever be more than two consecutive runs. First the official packages (and possible reboot), then the AUR packages (if you have any).
Even if that would happen, what’s the problem? Always official packages first.
That would be true even if you did them one after another in the same run.
It will be more than two if additional updates come in while the first set of updates are running. Given that Arch updates aren’t really batched together this isn’t an unthinkable scenario.
Basically, before you run it you don’t know if it will update repo packages or AUR packages.
I would say simply typing yay is both more efficient and far simpler for a new user.
Having to put in your password even if there are no updates seems like a small price to pay in return. Especially on a system which will likely have updates every day.
I never questioned your understanding. So what you are saying is a package included in the base arch install is not intuitive. Neither is the wiki welcome to arch