Upgrade Function

The Function

This is a function to upgrade the various packages. It might, perhaps be better as an abbreviation…

function upgrade --description "Upgrade packages."

Bold Blue

This is a helper function to set lines (specifically headlines in this case) to be bold and blue. If this gets done enough maybe it should be a standalone function, but for now it's embedded in the upgrade function.

function boldblue
    set_color --bold blue
    echo $argv
    set_color normal
end

Apt Calls

These are calls to update the debian-based packages.

Update

These calls update the database and then show us what is upgradable.

boldblue Checking apt
sudo apt-fast update --yes
sudo apt-get --just-print upgrade

I was initially using apt to list the upgradable packages, but installing more as a pager causes its output to get piped to it, stopping progress until I quit it. Looking into how to get around it I read that apt is a front-end to other packages to make them easier to use, and that apt-get is better for non-interactive use (and is one of the things that apt is using behind the scenes anyway).

Upgrade and Autoremove

Now we run the upgrade. upgrade will upgrade installed packages and install any dependencies that are needed, but not uninstall any already installed packages. If upgrading needs to a removal it won't do the upgrade. full-upgrade will do what upgrade does but will remove any installed packages if needed to upgrade an installed package. So, we're going with full-upgrade.

I'm also auto-removing any packages that get orphaned as dependencies by an upgrade.

boldblue Upgrading apt
sudo apt-fast full-upgrade --yes
sudo apt-get autoremove --yes

Snap

Snaps should update themselves. But let's see what happens if we do it.

boldblue Updating snaps
sudo snap refresh

Flatpak

Update

boldblue Updating flatpak
flatpak update --assumeyes

Note: I was running this with --noninteractive but for some reason this still emitted messages that something needed to be fixed but suppressed the message telling me which package needed to be fixed, so it seems better not to use that option.

Uninstall

boldblue Uninstalling unused flatpaks
flatpak uninstall --unused --assumeyes

Some Messages

Phased Updates

The following upgrades have been deferred due to phasing:
  alsa-ucm-conf

This message is referring to Phased Updating. That is, there is an update that is being rolled out in stages to see if it is stable before it's given out to everybody. So the update exists, but you won't get it until the developers decide it's okay to roll it out to everybody.