You are not logged in.
Pages: 1
I want to emulate how bl_apt_update_check works, but I can't figure out how it is being run. I don't see it anywhere in cron.
So question #1) how, when and how often does bl_apt_update_check run?
Question #2) if I wanted to alter how it runs... I want to add an option to automatically run apt update && apt upgrade. I figure I can add a second test case where it asks for Q to quit, so add U to update. But if I make that change, how would I protect it from being overwritten if for some reason you update it upstream?
Thanks,
David
Offline
Hi David,
it's a bit complicated, but if you want to get deep into it, we had this discussion in 2023:
https://forums.bunsenlabs.org/viewtopic.php?id=8472
and the package code is here:
https://github.com/BunsenLabs/bunsen-apt-update-checker
But your questions might be easily answered:
1) See README on that gIthub page (there's also 'man bl-apt-update-check').
The check is run 10 min after login, and every 24 hrs subsequently.
The check is also triggered by dpkg or apt activity.
The timer uses systemd, but the package will still function using
the apt triggers only, so systemd is a Recommends, not a hard dependency.
2) Package version info is automatically updated by apt because of this file which is installed to /etc/apt.conf.d:
https://github.com/BunsenLabs/bunsen-ap … tes-bunsen
The same file enables triggers to our script:
// This should be enabled by default anyway.
APT::Periodic::Enable "1";
// Do "apt-get update" automatically every n-days (0=disable)
APT::Periodic::Update-Package-Lists "1";
// This option would require the package unattended-upgrades.
APT::Periodic::Unattended-Upgrade "0";
// THESE COMMANDS ARE USED TO TRIGGER bl-apt-update-check
// WHENEVER UPDATE INFO MIGHT HAVE CHANGED
// Whenever dpkg is called we might have different updates
// i.e. if an user removes a package that had an update
DPkg::Post-Invoke {
"/usr/bin/test -x /usr/sbin/bl-run-broadcast && /usr/bin/test -x /usr/bin/bl-apt-update-check && /usr/sbin/bl-run-broadcast bl-apt-update-check || true";
};
// When Apt's cache is updated (i.e. apt-cache update)
APT::Update::Post-Invoke-Success {
"/usr/bin/test -x /usr/sbin/bl-run-broadcast && /usr/bin/test -x /usr/bin/bl-apt-update-check && /usr/sbin/bl-run-broadcast bl-apt-update-check || true";
};This option updates apt once a day:
APT::Periodic::Update-Package-Lists "1";
But if you want to automatically run upgrades too, then you don't need bunsen-apt-update-checker at all. Remove that and install the Debian package unattended upgrades instead. You can probably configure it to behave the way you want (see the docs).
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
But if you want to automatically run upgrades too, then you don't need bunsen-apt-update-checker at all. Remove that and install the Debian package unattended upgrades instead. You can probably configure it to behave the way you want (see the docs).
Thanks for the answer.
It sounds like you are using systemd and built in functionality of apt.
Much too complicated for the script I want to creat, so I will likely just use cron to launch my script.
As for the changes I wanted to make to the apt update checker, I DO NOT want it to automatically upgrade anything. I want it to show me that upgrades are available (as it currently does), then instead of hitting Enter, then typing in 'sudo apt upgrade', I wanted to have an option to just type U and have it run that command. Even my scripting skills are good enough to do that. I was just wondering if there is a way/best practice to deal with a future upgrade eliminating my changes. I imagine that the chances of you updating that small package are vanishingly small, so I shalln't worry about it.
Again Thanks, my questions are answered.
David
Offline
I want to add an option to automatically run apt update && apt upgrade
I DO NOT want it to automatically upgrade anything
![]()
Actually, we considered adding an "upgrade" option after the update notification, but eventually decided there were so many possible actions users might want to take at that point that it was best just to give them a terminal and leave it at that.
Personally I have an alias 'aug' which runs 'sudo apt update && sudo apt upgrade' so I just hit Enter and type 'aug'.
(But there is an occasional issue: if the repos got updated again between when the notification was generated and when aug is run, the script crashes and has to be run again. Some day I'll try and debug that.)
PS systemd is just for the timer and it's not essential - the dpkg and apt triggers are enough really.
Last edited by johnraff (Today 04:03:17)
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
I imagine that the chances of you updating that small package are vanishingly small, so I shalln't worry about it.
But not zero - if I find that bug it'll get an upgrade.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
Pages: 1