Running apt update through UI

Hey everyone,

I want to implement apt update through the UI. I know how to set up a switch that actually runs apt update, but I was wondering if anyone ever tried to show available updates as a list somewhere in the UI. To be more precise: How do you run sudo apt update and print the output of sudo apt list --upgradable somewhere in the UI?

Thanks,
Florian

Ouch. You should not be doing that, it’s an artificial creation of dependencies between application (openHAB) and OS (which is what apt belongs to) and a bad idea.
Leave OS administration to the OS admin tools (such as openhabian-config) and keep that separated from the application.

I don’t think this is that big of deal. OP is just wanting a notification that there are packages that can be upgraded, not to actually perform the upgrade itself.

However, I agree that openHAB is probably a poor choice to be notified of this.

If you want some sort of notification that upgrades are available, I believe that monit will do that job for you. It can send you an email when there are packages ready to upgrade. FireMotD, which openHABian comes configured with will show you how many packages have upgrades available when you log in. You could even set up a cron job to email the results of the call to sudo apt list --upgradable if that’s easier than setting up Monit. If you have an email service already configured on your machine (I use msmtp to send email through Gmail) the output of cron jobs is already automatically emailed after it runs.

The biggest problem you’ll have on openHAB is there really is no good way to display multi-line text output. You’ll also need to configure openHAB in sudors to give it permission to run the apt update. You can drive in a screw with a hammer with enough force and effort. But a screw driver will do a better job. For an IT function like this openHAB is a hammer. Use a screw driver instead.