docs: add claude.md and avoid dashes

This commit is contained in:
Felitendo committed 2026-09-21 14:00:02 +02:00
1 parent dbdbfe5cd5
commit c40dfe0238
22 files changed
+205 -158

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
# CLAUDE.md
## Style
- Use simple English: short sentences, common words.
- Avoid em dashes (—). Do not just swap them for "-" either. Rewrite the sentence instead, for
example with a comma, a colon, brackets or two sentences.
+5 -5
View File
@@ -1,4 +1,4 @@
# cachy-auto-update - build and install # cachy-auto-update: build and install
# #
# Everything here is plain shell; "building" only means compiling the gettext # Everything here is plain shell; "building" only means compiling the gettext
# catalogs and rendering the man page. Both are optional in the sense that the # catalogs and rendering the man page. Both are optional in the sense that the
@@ -43,14 +43,14 @@ po/%.mo: po/%.po
ifdef MSGFMT ifdef MSGFMT
$(MSGFMT) --check --output-file=$@ $< $(MSGFMT) --check --output-file=$@ $<
else else
@echo "msgfmt not found - skipping $@" @echo "msgfmt not found, skipping $@"
endif endif
$(MANPAGE): doc/cachy-auto-update.1.scd $(MANPAGE): doc/cachy-auto-update.1.scd
ifdef SCDOC ifdef SCDOC
$(SCDOC) < $< > $@ $(SCDOC) < $< > $@
else else
@echo "scdoc not found - skipping $@" @echo "scdoc not found, skipping $@"
endif endif
# Syntax-check every shell file, and run shellcheck when it is available. # Syntax-check every shell file, and run shellcheck when it is available.
@@ -62,14 +62,14 @@ check:
shellcheck -x -e SC1090,SC1091 src/cachy-auto-update src/cachy-auto-update-run $(LIBS); \ shellcheck -x -e SC1090,SC1091 src/cachy-auto-update src/cachy-auto-update-run $(LIBS); \
echo "ok shellcheck"; \ echo "ok shellcheck"; \
else \ else \
echo "shellcheck not found - skipped"; \ echo "shellcheck not found, skipped"; \
fi fi
@if command -v python3 >/dev/null 2>&1; then \ @if command -v python3 >/dev/null 2>&1; then \
python3 -m py_compile src/cachy-auto-update-progress \ python3 -m py_compile src/cachy-auto-update-progress \
&& echo "ok src/cachy-auto-update-progress"; \ && echo "ok src/cachy-auto-update-progress"; \
rm -rf src/__pycache__; \ rm -rf src/__pycache__; \
else \ else \
echo "python3 not found - skipped"; \ echo "python3 not found, skipped"; \
fi fi
@if command -v visudo >/dev/null 2>&1; then \ @if command -v visudo >/dev/null 2>&1; then \
visudo -cf res/sudoers/cachy-auto-update >/dev/null && echo "ok sudoers"; \ visudo -cf res/sudoers/cachy-auto-update >/dev/null && echo "ok sudoers"; \
+18 -18
View File
@@ -15,7 +15,7 @@ think about it: repository packages, AUR packages, Flatpaks and AppImages are
updated in the background, with no password prompt and no terminal. updated in the background, with no password prompt and no terminal.
Run without a command it opens a small interactive menu with the two switches Run without a command it opens a small interactive menu with the two switches
that matter - automatic updates on/off and notifications on/off - plus the that matter (automatic updates on/off and notifications on/off), plus the
current status, and a settings screen covering every remaining option so the current status, and a settings screen covering every remaining option so the
configuration file never has to be edited by hand. In the settings screen the configuration file never has to be edited by hand. In the settings screen the
arrow keys select, Space or Right changes a value, and _q_ goes back; every arrow keys select, Space or Right changes a value, and _q_ goes back; every
@@ -23,8 +23,8 @@ change is written out immediately.
The actual work is done by a systemd system service. The timer ticks hourly; The actual work is done by a systemd system service. The timer ticks hourly;
whether a tick does anything is decided by _UpdateInterval_ (daily by default). whether a tick does anything is decided by _UpdateInterval_ (daily by default).
A run that is postponed - low battery, a game running, somebody else using A run that is postponed (low battery, a game running, somebody else using
pacman - is simply retried at the next tick. pacman) is simply retried at the next tick.
# COMMANDS # COMMANDS
@@ -64,7 +64,7 @@ Before anything is installed, a run is postponed when:
- the battery is below _MinBatteryPercent_ (ignored on mains power, and on - the battery is below _MinBatteryPercent_ (ignored on mains power, and on
machines without a battery); machines without a battery);
- _RequireAC_ is set and the machine is not plugged in; - _RequireAC_ is set and the machine is not plugged in;
- a game is running - detected via GameMode, a list of known game processes, or - a game is running, detected via GameMode, a list of known game processes, or
an application holding a blocking idle inhibitor; an application holding a blocking idle inhibitor;
- pacman's database is locked, or pacman, yay, paru, pamac or a similar tool is - pacman's database is locked, or pacman, yay, paru, pamac or a similar tool is
running. running.
@@ -84,13 +84,13 @@ A package that has to replace another one is handled silently. If pacman would
stop to ask whether a conflicting package may be removed, the transaction is stop to ask whether a conflicting package may be removed, the transaction is
retried once with that question answered affirmatively, unless retried once with that question answered affirmatively, unless
_AutoResolveConflicts_ is turned off. Files on disk that collide with a package _AutoResolveConflicts_ is turned off. Files on disk that collide with a package
are *not* forced - that stays a human decision. A signature failure triggers one are *not* forced. That stays a human decision. A signature failure triggers one
keyring refresh and one retry. keyring refresh and one retry.
AUR packages are built and installed as the locked *cachy-auto-update* system AUR packages are built and installed as the locked *cachy-auto-update* system
account, because *makepkg*(8) refuses to run as root. That account has no account, because *makepkg*(8) refuses to run as root. That account has no
password and no shell, and is allowed - through _/etc/sudoers.d/cachy-auto-update_ password and no shell. Through _/etc/sudoers.d/cachy-auto-update_ it is allowed
- to invoke *pacman* without one. No user password is ever stored anywhere. to invoke *pacman* without one. No user password is ever stored anywhere.
A failed AUR build is not reported the first time it happens; only a failure A failed AUR build is not reported the first time it happens; only a failure
that repeats is worth waking somebody up for. that repeats is worth waking somebody up for.
@@ -113,7 +113,7 @@ For as long as a run is working, the notification area carries a live progress
entry: the step being performed, how many items it has got through, an overall entry: the step being performed, how many items it has got through, an overall
percentage, and the package currently being unpacked under "Details". This is a percentage, and the package currently being unpacked under "Details". This is a
job in the sense of *org.kde.JobViewServer*, the same mechanism a file manager job in the sense of *org.kde.JobViewServer*, the same mechanism a file manager
uses while copying, rather than a notification - which is what makes it a bar uses while copying, rather than a notification. That is what makes it a bar
instead of a line of text. instead of a line of text.
The desktop withdraws a job as soon as the D-Bus connection that requested it The desktop withdraws a job as soon as the D-Bus connection that requested it
@@ -134,8 +134,8 @@ for minutes at a time looking stuck.
Expanding "Details" shows the last five lines of the run log as they are Expanding "Details" shows the last five lines of the run log as they are
written, alongside the package currently being worked on. The percentage says written, alongside the package currently being worked on. The percentage says
the update is alive; these lines say what it is alive doing, which matters most the update is alive; these lines say what it is alive doing, which matters most
during the stretches that have nothing countable to report - an AUR package during the stretches that have nothing countable to report, above all an AUR
being compiled, above all. The job interface carries exactly two description package being compiled. The job interface carries exactly two description
fields, so those are the two things shown. fields, so those are the two things shown.
A step that turns out to have no work is dropped from the bar instead of being A step that turns out to have no work is dropped from the bar instead of being
@@ -147,17 +147,17 @@ with nothing pending, or a machine with no Flatpaks installed.
Neither counted phase gets a counter from pacman on an unattended run, so both Neither counted phase gets a counter from pacman on an unattended run, so both
are counted here, a line at a time: "foo-1.2-1-x86_64 downloading..." for the are counted here, a line at a time: "foo-1.2-1-x86_64 downloading..." for the
first, "upgrading foo..." for the second. pacman's output is line-buffered first, "upgrading foo..." for the second. pacman's output is line-buffered
through *stdbuf*(1) so those lines arrive as they happen - writing to a log through *stdbuf*(1) so those lines arrive as they happen. Writing to a log
rather than a terminal, libc would otherwise release them in 4KB blocks, around rather than a terminal, libc would otherwise release them in 4KB blocks, around
a hundred and sixty packages at a time. pacman's other (n/m) sequences - a hundred and sixty packages at a time. pacman's other (n/m) sequences
checking keys, package integrity, loading package files - each count up to the (checking keys, package integrity, loading package files) each count up to the
same total and are deliberately ignored. same total and are deliberately ignored.
# HOW LONG NOTIFICATIONS STAY # HOW LONG NOTIFICATIONS STAY
A message that reports the machine still needing a person - an update that A message that reports the machine still needing a person stays on screen
failed, a package database left locked, packages that had to be held back - until it is dismissed. For example: an update that failed, a package database
stays on screen until it is dismissed. A message like that is only worth left locked, or packages that had to be held back. A message like that is only worth
sending if it is still there when somebody comes back to the machine. sending if it is still there when somebody comes back to the machine.
Everything else times out by itself, an update that simply worked included. Everything else times out by itself, an update that simply worked included.
@@ -188,10 +188,10 @@ _org.freedesktop.login1.power-off-ignore-inhibit_, which is _auth_admin_keep_,
so the desktop presents an administrator password prompt reading "Power off the so the desktop presents an administrator password prompt reading "Power off the
system while an application is inhibiting this". That string is shipped system while an application is inhibiting this". That string is shipped
untranslated by systemd and does not mention updates, and no KDE dialog untranslated by systemd and does not mention updates, and no KDE dialog
explains the situation either - only *systemctl*(1) names the inhibitor and its explains the situation either. Only *systemctl*(1) names the inhibitor and its
reason. Hence the notification. reason. Hence the notification.
A hard power-off - holding the power button, or losing mains power - is not A hard power-off (holding the power button, or losing mains power) is not
preventable. On the next run a leftover _/var/lib/pacman/db.lck_ is removed if preventable. On the next run a leftover _/var/lib/pacman/db.lck_ is removed if
it is older than the current boot, since no process able to hold it can still it is older than the current boot, since no process able to hold it can still
exist; the upgrade is then repeated and pacman reinstalls whatever was caught exist; the upgrade is then repeated and pacman reinstalls whatever was caught
+23 -11
View File
@@ -5,7 +5,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: cachy-auto-update 1.0.0\n" "Project-Id-Version: cachy-auto-update 1.0.0\n"
"Report-Msgid-Bugs-To: https://github.com/LoonixTools/cachy-auto-update/issues\n" "Report-Msgid-Bugs-To: https://github.com/LoonixTools/cachy-auto-update/"
"issues\n"
"POT-Creation-Date: 2026-08-08 00:00+0200\n" "POT-Creation-Date: 2026-08-08 00:00+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -65,7 +66,7 @@ msgstr ""
msgid "%d days ago" msgid "%d days ago"
msgstr "" msgstr ""
msgid "The last run reported a problem - see 'cachy-auto-update log'." msgid "The last run reported a problem. See 'cachy-auto-update log'."
msgstr "" msgstr ""
msgid "A restart is recommended to finish a kernel update." msgid "A restart is recommended to finish a kernel update."
@@ -162,19 +163,23 @@ msgstr ""
msgid "/etc/sudoers.d/cachy-auto-update is invalid; refusing to enable." msgid "/etc/sudoers.d/cachy-auto-update is invalid; refusing to enable."
msgstr "" msgstr ""
msgid "No AUR helper found - install paru or yay for AUR updates." msgid "No AUR helper found. Install paru or yay for AUR updates."
msgstr "" msgstr ""
msgid "base-devel is missing - AUR packages cannot be built without it." msgid "base-devel is missing, so AUR packages cannot be built."
msgstr "" msgstr ""
msgid "cachy-update also notifies about available updates. Turn its notifications off? [Y/n]" msgid ""
"cachy-update also notifies about available updates. Turn its notifications "
"off? [Y/n]"
msgstr "" msgstr ""
msgid "cachy-update's update check has been disabled." msgid "cachy-update's update check has been disabled."
msgstr "" msgstr ""
msgid "CachyOS shows a \"Reboot recommended\" notification while an update is still running. Turn it off? [Y/n]" msgid ""
"CachyOS shows a \"Reboot recommended\" notification while an update is still "
"running. Turn it off? [Y/n]"
msgstr "" msgstr ""
#, c-format #, c-format
@@ -278,13 +283,16 @@ msgstr ""
msgid "Update failed" msgid "Update failed"
msgstr "" msgstr ""
msgid "Something went wrong while updating. Run 'cachy-auto-update log' for details." msgid ""
"Something went wrong while updating. Run 'cachy-auto-update log' for details."
msgstr "" msgstr ""
msgid "Package database locked" msgid "Package database locked"
msgstr "" msgstr ""
msgid "pacman's lock file looks left over from an interrupted update. Updates are paused until it is cleared." msgid ""
"pacman's lock file looks left over from an interrupted update. Updates are "
"paused until it is cleared."
msgstr "" msgstr ""
msgid "Some packages were held back" msgid "Some packages were held back"
@@ -304,13 +312,17 @@ msgstr ""
msgid "Finishing an interrupted update" msgid "Finishing an interrupted update"
msgstr "" msgstr ""
msgid "The last update was cut short, most likely because the machine was switched off. It is being finished now." msgid ""
"The last update was cut short, most likely because the machine was switched "
"off. It is being finished now."
msgstr "" msgstr ""
msgid "Installing updates" msgid "Installing updates"
msgstr "" msgstr ""
msgid "%d packages are being updated. Please leave the computer switched on until this is done." msgid ""
"%d packages are being updated. Please leave the computer switched on until "
"this is done."
msgstr "" msgstr ""
msgid "Settings" msgid "Settings"
@@ -319,7 +331,7 @@ msgstr ""
msgid "(none)" msgid "(none)"
msgstr "" msgstr ""
msgid "Up/Down select - Space or Right changes - q goes back" msgid "Up/Down: select, Space or Right: change, q: back"
msgstr "" msgstr ""
msgid "Package names separated by spaces, empty to clear:" msgid "Package names separated by spaces, empty to clear:"
+52 -24
View File
@@ -5,7 +5,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: cachy-auto-update 1.0.0\n" "Project-Id-Version: cachy-auto-update 1.0.0\n"
"Report-Msgid-Bugs-To: https://github.com/LoonixTools/cachy-auto-update/issues\n" "Report-Msgid-Bugs-To: https://github.com/LoonixTools/cachy-auto-update/"
"issues\n"
"POT-Creation-Date: 2026-08-08 00:00+0200\n" "POT-Creation-Date: 2026-08-08 00:00+0200\n"
"PO-Revision-Date: 2026-08-08 00:00+0200\n" "PO-Revision-Date: 2026-08-08 00:00+0200\n"
"Last-Translator: Felitendo\n" "Last-Translator: Felitendo\n"
@@ -66,8 +67,8 @@ msgstr "vor %d Stunden"
msgid "%d days ago" msgid "%d days ago"
msgstr "vor %d Tagen" msgstr "vor %d Tagen"
msgid "The last run reported a problem - see 'cachy-auto-update log'." msgid "The last run reported a problem. See 'cachy-auto-update log'."
msgstr "Beim letzten Lauf gab es ein Problem – siehe „cachy-auto-update log“." msgstr "Beim letzten Lauf gab es ein Problem. Siehe „cachy-auto-update log“."
msgid "A restart is recommended to finish a kernel update." msgid "A restart is recommended to finish a kernel update."
msgstr "Ein Neustart wird empfohlen, um ein Kernel-Update abzuschließen." msgstr "Ein Neustart wird empfohlen, um ein Kernel-Update abzuschließen."
@@ -161,26 +162,37 @@ msgid "Could not enable the systemd timer."
msgstr "Der systemd-Timer konnte nicht aktiviert werden." msgstr "Der systemd-Timer konnte nicht aktiviert werden."
msgid "/etc/sudoers.d/cachy-auto-update is invalid; refusing to enable." msgid "/etc/sudoers.d/cachy-auto-update is invalid; refusing to enable."
msgstr "/etc/sudoers.d/cachy-auto-update ist fehlerhaft – wird nicht aktiviert." msgstr ""
"/etc/sudoers.d/cachy-auto-update ist fehlerhaft und wird nicht aktiviert."
msgid "No AUR helper found - install paru or yay for AUR updates." msgid "No AUR helper found. Install paru or yay for AUR updates."
msgstr "Kein AUR-Helper gefunden – für AUR-Updates paru oder yay installieren." msgstr "Kein AUR-Helper gefunden. Für AUR-Updates paru oder yay installieren."
msgid "base-devel is missing - AUR packages cannot be built without it." msgid "base-devel is missing, so AUR packages cannot be built."
msgstr "base-devel fehlt – ohne das lassen sich AUR-Pakete nicht bauen." msgstr "base-devel fehlt, daher lassen sich keine AUR-Pakete bauen."
msgid "cachy-update also notifies about available updates. Turn its notifications off? [Y/n]" msgid ""
msgstr "cachy-update benachrichtigt ebenfalls über verfügbare Updates. Dessen Benachrichtigungen abschalten? [J/n]" "cachy-update also notifies about available updates. Turn its notifications "
"off? [Y/n]"
msgstr ""
"cachy-update benachrichtigt ebenfalls über verfügbare Updates. Dessen "
"Benachrichtigungen abschalten? [J/n]"
msgid "cachy-update's update check has been disabled." msgid "cachy-update's update check has been disabled."
msgstr "Die Update-Prüfung von cachy-update wurde abgeschaltet." msgstr "Die Update-Prüfung von cachy-update wurde abgeschaltet."
msgid "CachyOS shows a \"Reboot recommended\" notification while an update is still running. Turn it off? [Y/n]" msgid ""
msgstr "CachyOS zeigt eine Benachrichtigung \"Neustart empfohlen\", während ein Update noch läuft. Abschalten? [J/n]" "CachyOS shows a \"Reboot recommended\" notification while an update is still "
"running. Turn it off? [Y/n]"
msgstr ""
"CachyOS zeigt eine Benachrichtigung \"Neustart empfohlen\", während ein "
"Update noch läuft. Abschalten? [J/n]"
#, c-format #, c-format
msgid "The reboot notification has been turned off. Undo it by deleting %s." msgid "The reboot notification has been turned off. Undo it by deleting %s."
msgstr "Die Neustart-Benachrichtigung wurde abgeschaltet. Rückgängig durch Löschen von %s." msgstr ""
"Die Neustart-Benachrichtigung wurde abgeschaltet. Rückgängig durch Löschen "
"von %s."
#, c-format #, c-format
msgid "Could not write %s." msgid "Could not write %s."
@@ -279,21 +291,29 @@ msgstr "%d Updates wurden installiert."
msgid "Update failed" msgid "Update failed"
msgstr "Update fehlgeschlagen" msgstr "Update fehlgeschlagen"
msgid "Something went wrong while updating. Run 'cachy-auto-update log' for details." msgid ""
msgstr "Beim Update ist etwas schiefgelaufen. Details mit „cachy-auto-update log“." "Something went wrong while updating. Run 'cachy-auto-update log' for details."
msgstr ""
"Beim Update ist etwas schiefgelaufen. Details mit „cachy-auto-update log“."
msgid "Package database locked" msgid "Package database locked"
msgstr "Paketdatenbank gesperrt" msgstr "Paketdatenbank gesperrt"
msgid "pacman's lock file looks left over from an interrupted update. Updates are paused until it is cleared." msgid ""
msgstr "Die Sperrdatei von pacman scheint von einem abgebrochenen Update übrig zu sein. Bis sie entfernt ist, pausieren die Updates." "pacman's lock file looks left over from an interrupted update. Updates are "
"paused until it is cleared."
msgstr ""
"Die Sperrdatei von pacman scheint von einem abgebrochenen Update übrig zu "
"sein. Bis sie entfernt ist, pausieren die Updates."
msgid "Some packages were held back" msgid "Some packages were held back"
msgstr "Einige Pakete wurden zurückgehalten" msgstr "Einige Pakete wurden zurückgehalten"
#, c-format #, c-format
msgid "%s could not be updated and was skipped. Everything else is up to date." msgid "%s could not be updated and was skipped. Everything else is up to date."
msgstr "%s konnte nicht aktualisiert werden und wurde übersprungen. Alles andere ist aktuell." msgstr ""
"%s konnte nicht aktualisiert werden und wurde übersprungen. Alles andere ist "
"aktuell."
#, c-format #, c-format
msgid "Held back: %s" msgid "Held back: %s"
@@ -305,15 +325,23 @@ msgstr "Der letzte Lauf wurde abgebrochen, bevor er fertig war."
msgid "Finishing an interrupted update" msgid "Finishing an interrupted update"
msgstr "Abgebrochenes Update wird beendet" msgstr "Abgebrochenes Update wird beendet"
msgid "The last update was cut short, most likely because the machine was switched off. It is being finished now." msgid ""
msgstr "Das letzte Update wurde unterbrochen, vermutlich weil der Rechner ausgeschaltet wurde. Es wird jetzt zu Ende geführt." "The last update was cut short, most likely because the machine was switched "
"off. It is being finished now."
msgstr ""
"Das letzte Update wurde unterbrochen, vermutlich weil der Rechner "
"ausgeschaltet wurde. Es wird jetzt zu Ende geführt."
msgid "Installing updates" msgid "Installing updates"
msgstr "Updates werden installiert" msgstr "Updates werden installiert"
#, c-format #, c-format
msgid "%d packages are being updated. Please leave the computer switched on until this is done." msgid ""
msgstr "%d Pakete werden gerade aktualisiert. Bitte den Rechner so lange eingeschaltet lassen." "%d packages are being updated. Please leave the computer switched on until "
"this is done."
msgstr ""
"%d Pakete werden gerade aktualisiert. Bitte den Rechner so lange "
"eingeschaltet lassen."
msgid "Settings" msgid "Settings"
msgstr "Einstellungen" msgstr "Einstellungen"
@@ -321,8 +349,8 @@ msgstr "Einstellungen"
msgid "(none)" msgid "(none)"
msgstr "(keine)" msgstr "(keine)"
msgid "Up/Down select - Space or Right changes - q goes back" msgid "Up/Down: select, Space or Right: change, q: back"
msgstr "Hoch/Runter wählen – Leertaste oder Rechts ändert – q zurück" msgstr "Hoch/Runter: wählen, Leertaste oder Rechts: ändern, q: zurück"
msgid "Package names separated by spaces, empty to clear:" msgid "Package names separated by spaces, empty to clear:"
msgstr "Paketnamen mit Leerzeichen getrennt, leer zum Löschen:" msgstr "Paketnamen mit Leerzeichen getrennt, leer zum Löschen:"
+1 -1
View File
@@ -1,5 +1,5 @@
[Desktop Entry] [Desktop Entry]
# Not here to put an entry in the application menu - hence NoDisplay. This is # Not here to put an entry in the application menu, hence NoDisplay. This is
# how the desktop learns what to call the update while it runs: the progress # how the desktop learns what to call the update while it runs: the progress
# bar in the notification area is labelled from the desktop entry named in the # bar in the notification area is labelled from the desktop entry named in the
# job request, and without one the job is filed under whatever the helper # job request, and without one the job is filed under whatever the helper
+4 -4
View File
@@ -7,7 +7,7 @@
# Documentation: man cachy-auto-update # Documentation: man cachy-auto-update
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Main switches - normally set through `cachy-auto-update enable/disable` # Main switches, normally set through `cachy-auto-update enable/disable`
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Apply updates automatically in the background. # Apply updates automatically in the background.
@@ -73,7 +73,7 @@ IgnorePkg=
# installed packages, and every cached version of packages that are no longer # installed packages, and every cached version of packages that are no longer
# installed. Nothing that is currently installed is ever touched, so this only # installed. Nothing that is currently installed is ever touched, so this only
# costs the ability to downgrade further back than KeepOldPackages. # costs the ability to downgrade further back than KeepOldPackages.
# Without it /var/cache/pacman/pkg grows forever - tens of gigabytes on a # Without it /var/cache/pacman/pkg grows forever: tens of gigabytes on a
# machine with a few large packages. # machine with a few large packages.
CleanCache=yes CleanCache=yes
@@ -97,8 +97,8 @@ RemoveOrphans=no
# #
# How long a message stays on screen is not configurable, because it follows # How long a message stays on screen is not configurable, because it follows
# from what the message is for: anything reporting that the machine still needs # from what the message is for: anything reporting that the machine still needs
# a person - a failed update, a paused package queue, a package that had to be # a person (a failed update, a paused package queue, a package that had to be
# skipped - waits until it is dismissed, since a message like that is only ever # skipped) waits until it is dismissed, since a message like that is only ever
# useful if it is still there when somebody comes back. Everything else, an # useful if it is still there when somebody comes back. Everything else, an
# update that simply worked included, times out on its own. # update that simply worked included, times out on its own.
+2 -2
View File
@@ -28,8 +28,8 @@ TimeoutStartSec=4h
# Deliberately *not* sandboxed the way paccache.service is: this unit installs # Deliberately *not* sandboxed the way paccache.service is: this unit installs
# packages across the whole filesystem and downloads them over the network, so # packages across the whole filesystem and downloads them over the network, so
# ProtectSystem=, PrivateNetwork= and friends would break it. NoNewPrivileges # ProtectSystem=, PrivateNetwork= and friends would break it. NoNewPrivileges
# in particular has to stay off - the AUR step relies on the build account # in particular has to stay off, because the AUR step relies on the build
# calling sudo. # account calling sudo.
NoNewPrivileges=no NoNewPrivileges=no
ProtectHostname=yes ProtectHostname=yes
+1 -1
View File
@@ -5,7 +5,7 @@ Documentation=man:cachy-auto-update(1)
[Timer] [Timer]
# The tick is hourly, but an actual update only happens once per # The tick is hourly, but an actual update only happens once per
# UpdateInterval (default: daily). That combination is what makes a postponed # UpdateInterval (default: daily). That combination is what makes a postponed
# run - low battery, a game running, somebody else using pacman - retry by # run (low battery, a game running, somebody else using pacman) retry by
# itself an hour later without any backoff bookkeeping. # itself an hour later without any backoff bookkeeping.
OnBootSec=15min OnBootSec=15min
OnCalendar=hourly OnCalendar=hourly
+6 -6
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# cachy-auto-update - unattended updates for CachyOS # cachy-auto-update: unattended updates for CachyOS
# #
# The command line front end. Everything it does is either flipping a switch in # The command line front end. Everything it does is either flipping a switch in
# /etc/cachy-auto-update/cachy-auto-update.conf, driving the systemd timer, or # /etc/cachy-auto-update/cachy-auto-update.conf, driving the systemd timer, or
@@ -77,10 +77,10 @@ cau_do_enable() {
cau_config_load cau_config_load
if [[ $CFG_AUR == yes ]] && ! cau_aur_detect_quiet; then if [[ $CFG_AUR == yes ]] && ! cau_aur_detect_quiet; then
cau_note "$(cau_msg "No AUR helper found - install paru or yay for AUR updates.")" cau_note "$(cau_msg "No AUR helper found. Install paru or yay for AUR updates.")"
fi fi
if [[ $CFG_AUR == yes ]] && ! cau_have makepkg; then if [[ $CFG_AUR == yes ]] && ! cau_have makepkg; then
cau_note "$(cau_msg "base-devel is missing - AUR packages cannot be built without it.")" cau_note "$(cau_msg "base-devel is missing, so AUR packages cannot be built.")"
fi fi
cau_offer_disable_cachy_update cau_offer_disable_cachy_update
@@ -89,7 +89,7 @@ cau_do_enable() {
# CachyOS ships a pacman hook that pops up "Reboot recommended!" the moment a # CachyOS ships a pacman hook that pops up "Reboot recommended!" the moment a
# kernel, driver or systemd package is unpacked. During a manual upgrade that # kernel, driver or systemd package is unpacked. During a manual upgrade that
# is fine - the transaction is the last thing happening. During an unattended # is fine, because the transaction is the last thing happening. During an unattended
# one it lands in the middle: the run still has AUR packages to build and # one it lands in the middle: the run still has AUR packages to build and
# Flatpaks to pull, and a notification asking for a restart right then is an # Flatpaks to pull, and a notification asking for a restart right then is an
# invitation to cut the update in half. # invitation to cut the update in half.
@@ -141,7 +141,7 @@ cau_aur_detect_quiet() {
# cachy-update ships an enabled user timer that only ever says "N updates # cachy-update ships an enabled user timer that only ever says "N updates
# available". Once updates apply themselves that notification is pure noise, # available". Once updates apply themselves that notification is pure noise,
# so offer to silence it - but only ask, never decide. # so offer to silence it. But only ask, never decide.
cau_offer_disable_cachy_update() { cau_offer_disable_cachy_update() {
local user uid answer found=0 local user uid answer found=0
@@ -163,7 +163,7 @@ cau_offer_disable_cachy_update() {
read -r answer || return 0 read -r answer || return 0
# Defaults to yes: once updates install themselves, cachy-update's "N # Defaults to yes: once updates install themselves, cachy-update's "N
# updates available" is purely noise. "j" is accepted too - the prompt is # updates available" is purely noise. "j" is accepted too: the prompt is
# translated, so a German user types the German letter and used to have # translated, so a German user types the German letter and used to have
# that silently read as "no". # that silently read as "no".
case "${answer,,}" in case "${answer,,}" in
+6 -6
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# #
# cachy-auto-update-progress - the update's progress bar on the desktop # cachy-auto-update-progress: the update's progress bar on the desktop
# #
# Started by the update runner, once per logged-in user, inside that user's # Started by the update runner, once per logged-in user, inside that user's
# session. Reads one instruction per line on stdin and turns it into the same # session. Reads one instruction per line on stdin and turns it into the same
@@ -16,7 +16,7 @@
# #
# Why a separate process at all: the desktop ties the progress entry to the # Why a separate process at all: the desktop ties the progress entry to the
# D-Bus connection that asked for it and withdraws the entry the moment that # D-Bus connection that asked for it and withdraws the entry the moment that
# connection goes away. One-shot callers - gdbus, busctl, dbus-send - therefore # connection goes away. One-shot callers (gdbus, busctl, dbus-send) therefore
# cannot drive one, because each invocation is its own connection that closes # cannot drive one, because each invocation is its own connection that closes
# again immediately. So something has to sit there and hold the connection open # again immediately. So something has to sit there and hold the connection open
# for as long as the update takes, and read its orders from somewhere else. # for as long as the update takes, and read its orders from somewhere else.
@@ -54,7 +54,7 @@ class Job:
reply = self.bus.call_sync( reply = self.bus.call_sync(
JOB_SERVICE, JOB_PATH, "org.kde.JobViewServerV2", "requestView", JOB_SERVICE, JOB_PATH, "org.kde.JobViewServerV2", "requestView",
# capabilities 0: no cancel and no pause button. Neither can be # capabilities 0: no cancel and no pause button. Neither can be
# honoured - pacman's commit phase is not interruptible - and a # honoured, because pacman's commit phase is not interruptible. A
# button that does nothing is worse than no button. # button that does nothing is worse than no button.
GLib.Variant("(sia{sv})", (DESKTOP_ENTRY, 0, {})), GLib.Variant("(sia{sv})", (DESKTOP_ENTRY, 0, {})),
GLib.VariantType("(o)"), Gio.DBusCallFlags.NONE, -1, None) GLib.VariantType("(o)"), Gio.DBusCallFlags.NONE, -1, None)
@@ -68,8 +68,8 @@ class Job:
JOB_SERVICE, self.path, "org.kde.JobViewV2", method, variant, JOB_SERVICE, self.path, "org.kde.JobViewV2", method, variant,
None, Gio.DBusCallFlags.NONE, -1, None) None, Gio.DBusCallFlags.NONE, -1, None)
except GLib.Error: except GLib.Error:
# The desktop went away mid-update - a logout, or a plasmashell # The desktop went away mid-update (a logout, or a plasmashell
# restart. The update carries on without a bar. # restart). The update carries on without a bar.
self.path = None self.path = None
def close(self, message=""): def close(self, message=""):
@@ -96,7 +96,7 @@ def main():
try: try:
job.open() job.open()
except GLib.Error: except GLib.Error:
# No job server on this desktop - anything that is not Plasma. Same # No job server on this desktop (anything that is not Plasma). Same
# deal as a missing binding: drain stdin, stay out of the way. # deal as a missing binding: drain stdin, stay out of the way.
for _ in sys.stdin: for _ in sys.stdin:
pass pass
+6 -6
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# cachy-auto-update-run - one unattended update pass # cachy-auto-update-run: one unattended update pass
# #
# Started by cachy-auto-update.service as root. The timer fires hourly and this # Started by cachy-auto-update.service as root. The timer fires hourly and this
# decides whether anything should happen; that is what makes deferrals free. # decides whether anything should happen; that is what makes deferrals free.
@@ -43,7 +43,7 @@ fi
# Force a neutral locale here rather than relying on the unit's Environment=, # Force a neutral locale here rather than relying on the unit's Environment=,
# so a run started by hand behaves exactly like one started by the timer. # so a run started by hand behaves exactly like one started by the timer.
# pacman failures are classified by matching its output, and on a German system # pacman failures are classified by matching its output, and on a German system
# that output is German. Text aimed at a person does not come through here - a # that output is German. Text aimed at a person does not come through here: a
# notification is rendered in the recipient's own locale by cau_msg_in. # notification is rendered in the recipient's own locale by cau_msg_in.
export LC_ALL=C LANGUAGE= export LC_ALL=C LANGUAGE=
@@ -65,7 +65,7 @@ cau_log_open
# Record an interruption rather than leaving the previous run's verdict behind. # Record an interruption rather than leaving the previous run's verdict behind.
# Without this, killing an interactive run leaves last_result at whatever it was # Without this, killing an interactive run leaves last_result at whatever it was
# before - so the menu can keep reporting a problem from hours ago while the # before. Then the menu can keep reporting a problem from hours ago while the
# machine is in fact fully up to date, which is worse than saying nothing. # machine is in fact fully up to date, which is worse than saying nothing.
# pacman makes the commit phase itself uninterruptible, so the packages either # pacman makes the commit phase itself uninterruptible, so the packages either
# all landed or none did; only our own bookkeeping is at risk here. # all landed or none did; only our own bookkeeping is at risk here.
@@ -193,8 +193,8 @@ progress_steps+=(cleanup)
cau_progress_begin "${progress_steps[@]}" cau_progress_begin "${progress_steps[@]}"
# And carry the run log's last lines along with it, so "Details" shows what the # And carry the run log's last lines along with it, so "Details" shows what the
# update is doing during the stretches that have nothing to count - an AUR # update is doing during the stretches that have nothing to count. Most of all
# package building for a quarter of an hour, most of all. # an AUR package building for a quarter of an hour.
cau_progress_tail_start "$CAU_RUNLOG" cau_progress_tail_start "$CAU_RUNLOG"
if ! cau_pacman_update; then if ! cau_pacman_update; then
@@ -273,7 +273,7 @@ fi
# Recorded, deliberately not announced. The running kernel loses its module # Recorded, deliberately not announced. The running kernel loses its module
# tree the moment pacman unpacks the new one, so this turns true partway # tree the moment pacman unpacks the new one, so this turns true partway
# through a run that still has AUR builds and Flatpaks ahead of it - and a # through a run that still has AUR builds and Flatpaks ahead of it. A
# "restart recommended" bubble arriving then reads as an invitation to restart # "restart recommended" bubble arriving then reads as an invitation to restart
# while the update is still going. `cachy-auto-update status` and the menu say # while the update is still going. `cachy-auto-update status` and the menu say
# so instead, where nobody is being interrupted mid-transaction. # so instead, where nobody is being interrupted mid-transaction.
+7 -7
View File
@@ -49,8 +49,8 @@ export TEXTDOMAINDIR="${CAU_LOCALEDIR}"
# #
# Standard POSIX precedence, deliberately: LC_ALL wins outright, and LC_ALL=C # Standard POSIX precedence, deliberately: LC_ALL wins outright, and LC_ALL=C
# really does mean English. The service sets LC_ALL=C so that pacman and upower # really does mean English. The service sets LC_ALL=C so that pacman and upower
# stay parseable, which makes the log English - correct, since the log is a # stay parseable, which makes the log English. That is correct, since the log
# technical artefact. Anything aimed at a person (a desktop notification) does # is a technical artefact. Anything aimed at a person (a desktop notification) does
# not go through here at all; it names the recipient's own locale explicitly # not go through here at all; it names the recipient's own locale explicitly
# via cau_msg_in and cau_user_locale. # via cau_msg_in and cau_user_locale.
cau_ui_locale() { cau_ui_locale() {
@@ -117,8 +117,8 @@ cau_msg_in() {
fi fi
# With no arguments the message is plain text, not a format string. Feeding # With no arguments the message is plain text, not a format string. Feeding
# it to printf anyway turns any literal percent sign in it - "Battery (%)", # it to printf anyway turns any literal percent sign in it (like
# "100 % done" - into an invalid conversion, and that is a trap every # "Battery (%)" or "100 % done") into an invalid conversion, and that is a trap every
# translator would eventually walk into. # translator would eventually walk into.
if (( $# == 0 )); then if (( $# == 0 )); then
printf '%s' "$translated" printf '%s' "$translated"
@@ -184,7 +184,7 @@ cau_log_open() {
# Runs a command, capturing its combined output in the run log. Returns the # Runs a command, capturing its combined output in the run log. Returns the
# command's exit status. # command's exit status.
# #
# When a person is watching - `cachy-auto-update run` from a terminal - the # When a person is watching (`cachy-auto-update run` from a terminal), the
# output is shown as well. Building an AUR package or pulling a few hundred # output is shown as well. Building an AUR package or pulling a few hundred
# megabytes of Flatpak can take minutes, and silence for that long is # megabytes of Flatpak can take minutes, and silence for that long is
# indistinguishable from a hang. # indistinguishable from a hang.
@@ -207,8 +207,8 @@ cau_run_logged() {
# Set by cau_bad and cau_note. The menu redraws immediately after an action, # Set by cau_bad and cau_note. The menu redraws immediately after an action,
# which would wipe the screen; this marks that something was printed that the # which would wipe the screen; this marks that something was printed that the
# user still has to read, so only those cases wait for a keypress. A plain # user still has to read, so only those cases wait for a keypress. A plain
# success needs no acknowledgement - the status block at the top of the menu # success needs no acknowledgement, because the status block at the top of the
# already shows the new state. # menu already shows the new state.
CAU_UI_NEEDS_ACK='' CAU_UI_NEEDS_ACK=''
cau_say() { printf '%s\n' "$*"; } cau_say() { printf '%s\n' "$*"; }
+4 -4
View File
@@ -16,7 +16,7 @@ CAU_SKIP_REASON=''
# cau_on_ac # cau_on_ac
# True when running on mains power. systemd-ac-power also returns success when # True when running on mains power. systemd-ac-power also returns success when
# the machine has neither a battery nor an adapter, which is exactly right for # the machine has neither a battery nor an adapter, which is exactly right for
# desktops - hand-rolled sysfs globbing gets that case wrong. # desktops. Hand-rolled sysfs globbing gets that case wrong.
cau_on_ac() { cau_on_ac() {
if cau_have systemd-ac-power; then if cau_have systemd-ac-power; then
systemd-ac-power > /dev/null 2>&1 systemd-ac-power > /dev/null 2>&1
@@ -41,8 +41,8 @@ cau_on_ac() {
# cau_battery_percent # cau_battery_percent
# Average charge across the system batteries, or failure when the machine has # Average charge across the system batteries, or failure when the machine has
# none. Peripheral batteries (mice, headsets) advertise type=Battery too and # none. Peripheral batteries (mice, headsets) advertise type=Battery too and
# are filtered out via the scope attribute; when scope is missing entirely - # are filtered out via the scope attribute. When scope is missing entirely (as
# as on many laptops - the device counts as a system battery. # on many laptops), the device counts as a system battery.
cau_battery_percent() { cau_battery_percent() {
local ps sum=0 count=0 cap local ps sum=0 count=0 cap
@@ -139,7 +139,7 @@ cau_gamemode_active() {
while read -r user uid; do while read -r user uid; do
[[ -n $user ]] || continue [[ -n $user ]] || continue
# timeout runs inside the runuser call because it has to be a real # timeout runs inside the runuser call because it has to be a real
# binary there - it cannot wrap a shell function from out here. # binary there. It cannot wrap a shell function from out here.
out="$(cau_as_user "$user" "$uid" timeout 5 busctl --user --json=short \ out="$(cau_as_user "$user" "$uid" timeout 5 busctl --user --json=short \
get-property com.feralinteractive.GameMode \ get-property com.feralinteractive.GameMode \
/com/feralinteractive/GameMode \ /com/feralinteractive/GameMode \
+6 -6
View File
@@ -4,8 +4,8 @@
# #
# The contract this file implements: the machine's owner may run any package # The contract this file implements: the machine's owner may run any package
# manager at any time and must never see a lock error caused by us. We can only # manager at any time and must never see a lock error caused by us. We can only
# guarantee that in one direction - by never *starting* while somebody else is # guarantee that in one direction: by never *starting* while somebody else is
# mid-transaction - so the checks here run before anything is touched, and a # mid-transaction. So the checks here run before anything is touched, and a
# refusal simply defers the run to the next hourly tick. # refusal simply defers the run to the next hourly tick.
# Package managers that take /var/lib/pacman/db.lck. checkupdates is absent on # Package managers that take /var/lib/pacman/db.lck. checkupdates is absent on
@@ -65,7 +65,7 @@ cau_package_manager_busy() {
# #
# The rigorous test is the boot time: no process that existed before the # The rigorous test is the boot time: no process that existed before the
# current boot can still be running, so a db.lck older than boot is abandoned # current boot can still be running, so a db.lck older than boot is abandoned
# by definition - which is exactly what a power cut during an update leaves # by definition. That is exactly what a power cut during an update leaves
# behind. A lock that is merely unheld *within* this boot is not provable in # behind. A lock that is merely unheld *within* this boot is not provable in
# the same way, so it is only reported (see cau_track_stale_lock) and never # the same way, so it is only reported (see cau_track_stale_lock) and never
# removed; guessing wrong there would corrupt a live transaction. # removed; guessing wrong there would corrupt a live transaction.
@@ -90,12 +90,12 @@ cau_pacman_lock_is_stale() {
# cau_recover_stale_lock # cau_recover_stale_lock
# Clears a provably abandoned lock so an interrupted update can be finished on # Clears a provably abandoned lock so an interrupted update can be finished on
# the next run. Without this, one power cut during an update stops every future # the next run. Without this, one power cut during an update stops every future
# update permanently and silently - the worst possible outcome for a machine # update permanently and silently. That is the worst possible outcome for a
# nobody is watching. # machine nobody is watching.
cau_recover_stale_lock() { cau_recover_stale_lock() {
cau_pacman_lock_is_stale || return 1 cau_pacman_lock_is_stale || return 1
cau_warn "Found a pacman lock older than this boot - an update was cut short" cau_warn "Found a pacman lock older than this boot. An update was cut short"
rm -f "$CAU_PACMAN_LOCK" 2>/dev/null || { rm -f "$CAU_PACMAN_LOCK" 2>/dev/null || {
cau_error "Could not remove the stale pacman lock" cau_error "Could not remove the stale pacman lock"
return 1 return 1
+8 -8
View File
@@ -32,7 +32,7 @@ cau_ui_term_restore() {
} }
# Runs an action with the terminal handed back to normal line mode, so anything # Runs an action with the terminal handed back to normal line mode, so anything
# it prints - or prompts for - behaves the way a program expects. # it prints or prompts for behaves the way a program expects.
cau_ui_cooked() { cau_ui_cooked() {
cau_ui_term_restore cau_ui_term_restore
"$@" "$@"
@@ -213,8 +213,8 @@ _cau_setting_cycle() {
# A cursor list rather than a numbered menu: there are eighteen settings, and # A cursor list rather than a numbered menu: there are eighteen settings, and
# numbering them would run out of digits and force paging. # numbering them would run out of digits and force paging.
# #
# The frame is assembled in memory and written once. Everything constant - the # The frame is assembled in memory and written once. Everything constant (the
# specs, the translated labels, the clear sequence - is resolved before the # specs, the translated labels, the clear sequence) is resolved before the
# loop, and the values are re-read only after something actually changes. # loop, and the values are re-read only after something actually changes.
# Drawing the naive way cost a command substitution per label per frame, which # Drawing the naive way cost a command substitution per label per frame, which
# measured 435 ms per keypress: arrow keys felt like the console was reloading, # measured 435 ms per keypress: arrow keys felt like the console was reloading,
@@ -239,7 +239,7 @@ cau_ui_settings() {
local title hint local title hint
cau_msg_into "$locale" "Settings"; title="$CAU_MSG_RESULT" cau_msg_into "$locale" "Settings"; title="$CAU_MSG_RESULT"
cau_msg_into "$locale" "Up/Down select - Space or Right changes - q goes back" cau_msg_into "$locale" "Up/Down: select, Space or Right: change, q: back"
hint="$CAU_MSG_RESULT" hint="$CAU_MSG_RESULT"
# the terminfo clear string, fetched once instead of forking per frame # the terminfo clear string, fetched once instead of forking per frame
@@ -320,8 +320,8 @@ cau_ui_edit_text() {
# _cau_row <label> <value> # _cau_row <label> <value>
# printf's %-28s pads by bytes, so a label containing "ü" comes out one column # printf's %-28s pads by bytes, so a label containing "ü" comes out one column
# short. ${#s} counts characters in a UTF-8 locale, so the padding is computed # short. ${#s} counts characters in a UTF-8 locale, so the padding is computed
# here instead - and applied inline, because command substitution would eat the # here instead. It is applied inline, because command substitution would eat
# trailing spaces again. # the trailing spaces again.
_cau_row() { _cau_row() {
local label="$1" value="$2" pad local label="$1" value="$2" pad
pad=$(( 28 - ${#label} )) pad=$(( 28 - ${#label} ))
@@ -389,7 +389,7 @@ cau_ui_status() {
if [[ $result == failed ]]; then if [[ $result == failed ]]; then
printf '\n %s%s%s\n' "$CAU_C_YELLOW" \ printf '\n %s%s%s\n' "$CAU_C_YELLOW" \
"$(cau_msg "The last run reported a problem - see 'cachy-auto-update log'.")" \ "$(cau_msg "The last run reported a problem. See 'cachy-auto-update log'.")" \
"$CAU_C_RESET" "$CAU_C_RESET"
elif [[ $result == interrupted ]]; then elif [[ $result == interrupted ]]; then
printf '\n %s%s%s\n' "$CAU_C_YELLOW" \ printf '\n %s%s%s\n' "$CAU_C_YELLOW" \
@@ -510,7 +510,7 @@ cau_ui_menu() {
5) cau_ui_status_conditions; cau_pause ;; 5) cau_ui_status_conditions; cau_pause ;;
6) cau_ui_settings ;; 6) cau_ui_settings ;;
q|Q) cau_ui_term_restore; trap - EXIT INT TERM; return 0 ;; q|Q) cau_ui_term_restore; trap - EXIT INT TERM; return 0 ;;
# Anything else - Enter, arrow keys, stray characters - just # Anything else (Enter, arrow keys, stray characters) just
# redraws. Escape is deliberately not a quit key, so a mistyped # redraws. Escape is deliberately not a quit key, so a mistyped
# arrow key cannot close the menu. # arrow key cannot close the menu.
*) ;; *) ;;
+7 -7
View File
@@ -3,10 +3,10 @@
# Desktop notifications from a root system service. # Desktop notifications from a root system service.
# #
# Two paths exist: # Two paths exist:
# * live - somebody has a graphical session, so notify-send is run inside # * live: somebody has a graphical session, so notify-send is run inside
# it via runuser with the session bus address set; # it via runuser with the session bus address set;
# * queued - nobody is logged in, so the message is appended to a spool that # * queued: nobody is logged in, so the message is appended to a spool that
# the XDG autostart entry replays at the next login. # the XDG autostart entry replays at the next login.
# #
# Messages travel as a msgid plus printf arguments rather than as finished # Messages travel as a msgid plus printf arguments rather than as finished
# text, so a notification queued at 04:00 is still rendered in whatever locale # text, so a notification queued at 04:00 is still rendered in whatever locale
@@ -44,8 +44,8 @@ cau_notify_close() {
# had to be skipped is only ever seen if it waits. # had to be skipped is only ever seen if it waits.
# #
# Set explicitly rather than left to the server. Notification daemons do keep # Set explicitly rather than left to the server. Notification daemons do keep
# critical-urgency messages up - the spec asks them to, and Plasma obliges - # critical-urgency messages up (the spec asks them to, and Plasma obliges).
# but that is a "should", it says nothing about the normal-urgency messages # But that is a "should", it says nothing about the normal-urgency messages
# here that still need somebody to act, and urgency separately controls sound # here that still need somebody to act, and urgency separately controls sound
# and whether do-not-disturb is overridden. Those are not the same question. # and whether do-not-disturb is overridden. Those are not the same question.
# #
@@ -136,7 +136,7 @@ cau_notify_enqueue() {
printf '%s\n' "$record" >> "$CAU_NOTIFY_QUEUE" 2>/dev/null || return 0 printf '%s\n' "$record" >> "$CAU_NOTIFY_QUEUE" 2>/dev/null || return 0
# keep the spool bounded - nobody wants three weeks of backlog at login # keep the spool bounded: nobody wants three weeks of backlog at login
if (( $(wc -l < "$CAU_NOTIFY_QUEUE" 2>/dev/null || echo 0) > CAU_NOTIFY_QUEUE_MAX )); then if (( $(wc -l < "$CAU_NOTIFY_QUEUE" 2>/dev/null || echo 0) > CAU_NOTIFY_QUEUE_MAX )); then
tmp="$(mktemp "${CAU_NOTIFY_QUEUE}.XXXXXX")" || return 0 tmp="$(mktemp "${CAU_NOTIFY_QUEUE}.XXXXXX")" || return 0
tail -n "$CAU_NOTIFY_QUEUE_MAX" "$CAU_NOTIFY_QUEUE" > "$tmp" tail -n "$CAU_NOTIFY_QUEUE_MAX" "$CAU_NOTIFY_QUEUE" > "$tmp"
+3 -3
View File
@@ -4,14 +4,14 @@
# #
# AppImages have no package manager of their own; Gear Lever is what tracks # AppImages have no package manager of their own; Gear Lever is what tracks
# where each one came from and how to fetch a new build. Its CLI is a first # where each one came from and how to fetch a new build. Its CLI is a first
# class interface - `--update --all -y` is exactly the unattended entry point # class interface: `--update --all -y` is exactly the unattended entry point
# we need, and it skips AppImages whose application is currently running rather # we need, and it skips AppImages whose application is currently running rather
# than pulling the file out from under it (we deliberately do not pass # than pulling the file out from under it (we deliberately do not pass
# --force). # --force).
# #
# This only runs for users with a live graphical session: Gear Lever is a # This only runs for users with a live graphical session: Gear Lever is a
# Flatpak GTK application and needs the session's runtime directory. Nothing is # Flatpak GTK application and needs the session's runtime directory. Nothing is
# lost by waiting - the next hourly tick will catch it once they log in. # lost by waiting, because the next hourly tick will catch it once they log in.
CAU_APPIMAGE_ID="it.mijorus.gearlever" CAU_APPIMAGE_ID="it.mijorus.gearlever"
CAU_APPIMAGE_COUNT=0 CAU_APPIMAGE_COUNT=0
@@ -45,7 +45,7 @@ cau_appimage_update() {
# Is there a Gear Lever on this machine at all? Asked before the step is # Is there a Gear Lever on this machine at all? Asked before the step is
# announced rather than discovered inside the loop: on a machine without # announced rather than discovered inside the loop: on a machine without
# one - the common case, it is an optional dependency - a step that exists # one (the common case, it is an optional dependency), a step that exists
# only to hand its share of the bar straight to the next one is a jump the # only to hand its share of the bar straight to the next one is a jump the
# bar does not need. Stops at the first user who has it, so the extra probe # bar does not need. Stops at the first user who has it, so the extra probe
# costs anything only in the case it is there to remove. # costs anything only in the case it is there to remove.
+3 -3
View File
@@ -2,15 +2,15 @@
# #
# AUR packages. # AUR packages.
# #
# makepkg - and therefore paru and yay - refuse to run as root, so this is the # makepkg (and therefore paru and yay) refuse to run as root, so this is the
# one part of the run that cannot happen in the service's own context. It is # one part of the run that cannot happen in the service's own context. It is
# executed as the locked "cachy-auto-update" system account instead, which # executed as the locked "cachy-auto-update" system account instead, which
# sysusers.d creates with no password and no shell. That account is granted # sysusers.d creates with no password and no shell. That account is granted
# NOPASSWD access to /usr/bin/pacman through /etc/sudoers.d/cachy-auto-update, # NOPASSWD access to /usr/bin/pacman through /etc/sudoers.d/cachy-auto-update,
# which is what lets the helper install what it built without a human present. # which is what lets the helper install what it built without a human present.
# #
# The alternative - stashing the user's password somewhere the daemon can read # The alternative (stashing the user's password somewhere the daemon can read
# it - buys nothing: whatever can decrypt it is exactly what an attacker would # it) buys nothing: whatever can decrypt it is exactly what an attacker would
# already have. # already have.
CAU_AUR_COUNT=0 CAU_AUR_COUNT=0
+2 -2
View File
@@ -5,7 +5,7 @@
# System-wide installations are updated directly as root. That side-steps a # System-wide installations are updated directly as root. That side-steps a
# real obstacle: the shipped polkit rule for Flatpak only grants install and # real obstacle: the shipped polkit rule for Flatpak only grants install and
# uninstall, and only to a subject that is active, local and in the wheel # uninstall, and only to a subject that is active, local and in the wheel
# group - none of which is true for an unattended service. Being root means # group. None of that is true for an unattended service. Being root means
# polkit is never consulted in the first place. # polkit is never consulted in the first place.
# #
# Per-user installations live in the user's home and are updated inside their # Per-user installations live in the user's home and are updated inside their
@@ -77,7 +77,7 @@ cau_flatpak_update() {
fi fi
done < <(cau_human_users) done < <(cau_human_users)
# Unused runtimes are the Flatpak equivalent of orphaned packages - this is # Unused runtimes are the Flatpak equivalent of orphaned packages. This is
# removal of installed software, not cache trimming, so it belongs behind # removal of installed software, not cache trimming, so it belongs behind
# RemoveOrphans rather than CleanCache. # RemoveOrphans rather than CleanCache.
if [[ $CFG_REMOVE_ORPHANS == yes ]]; then if [[ $CFG_REMOVE_ORPHANS == yes ]]; then
+10 -10
View File
@@ -39,7 +39,7 @@ CAU_PACMAN_OP_RE='^(\([[:space:]]*[0-9]+/[0-9]+\) )?(upgrading|installing|reinst
# #
# glibc-2.44+r24+g16be1518495f-1-x86_64_v3 downloading... # glibc-2.44+r24+g16be1518495f-1-x86_64_v3 downloading...
# #
# and nothing else - no counter, no total - so the position here is counted the # and nothing else: no counter, no total. So the position here is counted the
# same way the transaction is. # same way the transaction is.
# #
# The database sync a few lines earlier prints the very same shape (" core # The database sync a few lines earlier prints the very same shape (" core
@@ -55,7 +55,7 @@ CAU_PACMAN_DL_AWK='
# Feeds the desktop's progress bar by watching pacman work, through the three # Feeds the desktop's progress bar by watching pacman work, through the three
# phases a pacman run has: first it works out what the upgrade consists of, # phases a pacman run has: first it works out what the upgrade consists of,
# then everything is fetched, then everything is unpacked. Three steps on the # then everything is fetched, then everything is unpacked. Three steps on the
# bar rather than one, because they are three stretches to sit through - and # bar rather than one, because they are three stretches to sit through. And
# each one is silent in its own way. # each one is silent in its own way.
# #
# The first is the one that used to look like a hang. Between "starting full # The first is the one that used to look like a hang. Between "starting full
@@ -73,7 +73,7 @@ CAU_PACMAN_DL_AWK='
# #
# Only the second carries a counter, and the unattended runs that this bar # Only the second carries a counter, and the unattended runs that this bar
# exists for are exactly the ones that do not get it. So the position is # exists for are exactly the ones that do not get it. So the position is
# counted here instead - one line per package - and the total taken from the # counted here instead (one line per package), and the total taken from the
# "Package (218)" header pacman prints before it starts. That header is the # "Package (218)" header pacman prints before it starts. That header is the
# better number anyway: checkupdates counts packages with an update available # better number anyway: checkupdates counts packages with an update available
# and knows nothing about the new dependencies pulled in alongside them. # and knows nothing about the new dependencies pulled in alongside them.
@@ -104,9 +104,9 @@ _cau_pacman_progress_watch() {
if [[ -n $line ]]; then if [[ -n $line ]]; then
# Unpacking has started, so whatever came before it is over. If # Unpacking has started, so whatever came before it is over. If
# nothing was ever retrieved - every package already sitting in the # nothing was ever retrieved (every package already sitting in the
# cache, which is the ordinary state of affairs after a run that was # cache, which is normal after a run that was interrupted once
# interrupted once already - then the download step never happened, # already), then the download step never happened,
# and it is dropped rather than handed its whole share of the bar in # and it is dropped rather than handed its whole share of the bar in
# exchange for no work at all. # exchange for no work at all.
if [[ $phase != install ]]; then if [[ $phase != install ]]; then
@@ -189,7 +189,7 @@ _cau_pacman_exec() {
fi fi
# Line-buffered on purpose. pacman writes to a file or through a pipe here, # Line-buffered on purpose. pacman writes to a file or through a pipe here,
# never to a terminal, so libc buffers it in 4KB blocks - and 4KB of # never to a terminal, so libc buffers it in 4KB blocks. And 4KB of
# "upgrading foo..." is on the order of a hundred and sixty packages. The # "upgrading foo..." is on the order of a hundred and sixty packages. The
# watcher would see nothing at all, then a hundred and sixty lines at once, # watcher would see nothing at all, then a hundred and sixty lines at once,
# which is exactly how a bar comes to sit still and then leap to the end. # which is exactly how a bar comes to sit still and then leap to the end.
@@ -321,7 +321,7 @@ cau_pacman_update() {
# #
# While an upgrade runs, a shutdown request is refused by logind and the # While an upgrade runs, a shutdown request is refused by logind and the
# desktop answers with a polkit password prompt reading "Power off the # desktop answers with a polkit password prompt reading "Power off the
# system while an application is inhibiting this" - which never mentions # system while an application is inhibiting this". That never mentions
# updates and, on a German system, is not even translated. Somebody who was # updates and, on a German system, is not even translated. Somebody who was
# simply told beforehand does not end up staring at that. # simply told beforehand does not end up staring at that.
if [[ $CFG_NOTIFY_START == yes ]]; then if [[ $CFG_NOTIFY_START == yes ]]; then
@@ -393,7 +393,7 @@ cau_pacman_update() {
dependency) dependency)
# Something installed still depends on a package the repos want # Something installed still depends on a package the repos want
# to drop or replace - almost always an AUR package that has not # to drop or replace, almost always an AUR package that has not
# caught up yet. Nothing here can fix that, and it is not worth # caught up yet. Nothing here can fix that, and it is not worth
# failing over: letting one stuck package block every other # failing over: letting one stuck package block every other
# update indefinitely is far worse on an unattended machine. # update indefinitely is far worse on an unattended machine.
@@ -468,7 +468,7 @@ cau_pacman_cleanup() {
reclaim="$( { paccache -d --nocolor -k"$CFG_KEEP_OLD"; paccache -du --nocolor -k0; } 2>&1 \ reclaim="$( { paccache -d --nocolor -k"$CFG_KEEP_OLD"; paccache -du --nocolor -k0; } 2>&1 \
| grep -oE 'disk space saved: [^)]*' | paste -sd', ' -)" | grep -oE 'disk space saved: [^)]*' | paste -sd', ' -)"
cau_info "Trimming the package cache (keeping $CFG_KEEP_OLD old version(s))${reclaim:+ - $reclaim}" cau_info "Trimming the package cache (keeping $CFG_KEEP_OLD old version(s))${reclaim:+: $reclaim}"
cau_run_logged paccache -r --nocolor -k"$CFG_KEEP_OLD" || cau_warn "paccache -r failed" cau_run_logged paccache -r --nocolor -k"$CFG_KEEP_OLD" || cau_warn "paccache -r failed"
cau_run_logged paccache -ru --nocolor -k0 || cau_warn "paccache -ru failed" cau_run_logged paccache -ru --nocolor -k0 || cau_warn "paccache -ru failed"
fi fi
+24 -24
View File
@@ -3,8 +3,8 @@
# The update's progress bar on the desktop. # The update's progress bar on the desktop.
# #
# An unattended upgrade can take twenty minutes, and for most of that a user is # An unattended upgrade can take twenty minutes, and for most of that a user is
# told only that "an update is running". This drives the desktop's job list - # told only that "an update is running". This drives the desktop's job list
# the same widget that shows a bar while Dolphin copies files - so how far # (the same widget that shows a bar while Dolphin copies files), so how far
# along the run is stays visible the whole time. # along the run is stays visible the whole time.
# #
# The desktop ends the progress entry as soon as the D-Bus connection that # The desktop ends the progress entry as soon as the D-Bus connection that
@@ -14,8 +14,8 @@
# of those pipes, plus the arithmetic that turns "package 120 of 260 in the # of those pipes, plus the arithmetic that turns "package 120 of 260 in the
# repository step" into one number for the bar. # repository step" into one number for the bar.
# #
# Absent anywhere along the way - no session, no Plasma, no Python bindings - # If anything is missing along the way (no session, no Plasma, no Python
# this does nothing at all and the update proceeds exactly as before. # bindings), this does nothing at all and the update proceeds exactly as before.
CAU_PROGRESS_HELPER="${CAU_LIBEXECDIR}/cachy-auto-update-progress" CAU_PROGRESS_HELPER="${CAU_LIBEXECDIR}/cachy-auto-update-progress"
@@ -26,14 +26,14 @@ CAU_PROGRESS_FIFOS=()
CAU_PROGRESS_LOCALES=() CAU_PROGRESS_LOCALES=()
# What each step is worth on the bar. Rough shares of a typical run rather than # What each step is worth on the bar. Rough shares of a typical run rather than
# anything measured: the repositories dominate - fetching them and unpacking # anything measured: the repositories dominate (fetching them and unpacking
# them about equally, on a domestic line - and the cleanup is a rounding error. # them about equally, on a domestic line), and the cleanup is a rounding error.
# They do not have to add up to 100 - only the steps a given run will actually # They do not have to add up to 100. Only the steps a given run will actually
# perform are counted, and the total is normalised against those. # perform are counted, and the total is normalised against those.
# #
# "resolve" is everything pacman does before it has a transaction: syncing the # "resolve" is everything pacman does before it has a transaction: syncing the
# databases and working out what the upgrade actually consists of. It is # databases and working out what the upgrade actually consists of. It is
# usually seconds, which is why it is worth so little - but on a large backlog # usually seconds, which is why it is worth so little. But on a large backlog
# it is minutes, and those minutes used to be spent looking at a bar that had # it is minutes, and those minutes used to be spent looking at a bar that had
# not moved yet. # not moved yet.
declare -A CAU_PROGRESS_WEIGHTS=( declare -A CAU_PROGRESS_WEIGHTS=(
@@ -147,7 +147,7 @@ cau_progress_active() {
# turns up while it runs: nothing to download because every package was already # turns up while it runs: nothing to download because every package was already
# in the cache, no AUR updates pending, no Flatpaks installed. A step like that # in the cache, no AUR updates pending, no Flatpaks installed. A step like that
# keeps its whole share of the bar and then hands it over in a single jump the # keeps its whole share of the bar and then hands it over in a single jump the
# moment the next one starts - which is precisely the stutter this is here to # moment the next one starts. That is precisely the stutter this is here to
# remove. Dropping it hands its share to the steps that do have work instead, # remove. Dropping it hands its share to the steps that do have work instead,
# so the bar advances at a steady pace rather than leaping across the gaps. # so the bar advances at a steady pace rather than leaping across the gaps.
# #
@@ -243,7 +243,7 @@ _cau_progress_pct() {
# Never backwards. Two honest things can ask for that: dropping a step # Never backwards. Two honest things can ask for that: dropping a step
# rescales the run against a smaller total, and the conflict-recovery loop # rescales the run against a smaller total, and the conflict-recovery loop
# restarts pacman - and with it the item tally - from the top. Both are # restarts pacman (and with it the item tally) from the top. Both are
# real, neither is a reason to show somebody a bar that retreats. # real, neither is a reason to show somebody a bar that retreats.
(( pct < CAU_PROGRESS_SHOWN )) && pct=$CAU_PROGRESS_SHOWN (( pct < CAU_PROGRESS_SHOWN )) && pct=$CAU_PROGRESS_SHOWN
@@ -282,16 +282,16 @@ cau_progress_item() {
# whatsoever between "starting full system upgrade" and the transaction it # whatsoever between "starting full system upgrade" and the transaction it
# eventually prepares; an AUR helper compiling a package prints plenty, none of # eventually prepares; an AUR helper compiling a package prints plenty, none of
# it countable. On a large backlog either is minutes. There is no honest number # it countable. On a large backlog either is minutes. There is no honest number
# to show for that - but a bar that has not moved since it appeared is read as # to show for that. But a bar that has not moved since it appeared is read as
# a hang, and somebody who reads it that way reaches for the power button in # a hang, and somebody who reads it that way reaches for the power button in
# the middle of an update. That is the failure this is here to prevent. # the middle of an update. That is the failure this is here to prevent.
# #
# So it creeps, along a curve that approaches the end of the step without ever # So it creeps, along a curve that approaches the end of the step without ever
# reaching it: half the step's share after HALFLIFE seconds, three quarters # reaching it: half the step's share after HALFLIFE seconds, three quarters
# after three times that, the whole of it never. Nothing is claimed that is not # after three times that, the whole of it never. Nothing is claimed that is not
# known - the item counter stays empty throughout, which is the field that # known: the item counter stays empty throughout, and it is the field that
# would be lying if it moved - and the step still finishes the instant real # would be lying if it moved. The step still finishes the instant real work
# work reports in, because every real report is further along than the creep. # reports in, because every real report is further along than the creep.
# #
# Confined to the step's own span, so a creep can never overtake the step that # Confined to the step's own span, so a creep can never overtake the step that
# comes after it however long it is left running. # comes after it however long it is left running.
@@ -324,8 +324,8 @@ cau_progress_creep_start() {
# reason cau_progress_begin opens its fifo read-write: a pipe held open # reason cau_progress_begin opens its fifo read-write: a pipe held open
# at both ends never reports end-of-file, so a timed read on it blocks # at both ends never reports end-of-file, so a timed read on it blocks
# for exactly the timeout and nothing else. A forked sleep would also # for exactly the timeout and nothing else. A forked sleep would also
# survive the kill below - it is a child of this subshell, not this # survive the kill below (it is a child of this subshell, not this
# subshell - and inherit the fifo's write end, which would keep the # subshell) and inherit the fifo's write end, which would keep the
# helper from seeing the end of its input until the sleep ran out. # helper from seeing the end of its input until the sleep ran out.
local nap local nap
exec {nap}<> <(:) exec {nap}<> <(:)
@@ -345,15 +345,15 @@ cau_progress_creep_stop() {
# The ticker moved the bar from inside a subshell, so this side never saw # The ticker moved the bar from inside a subshell, so this side never saw
# it happen and still believes the bar is where it was left. Catching up # it happen and still believes the bar is where it was left. Catching up
# costs one recomputation - the curve is a function of elapsed time and # costs one recomputation, since the curve is a function of elapsed time and
# nothing else - and without it the next ordinary report from here would be # nothing else. Without it the next ordinary report from here would be
# measured against a stale percentage and send the bar backwards. # measured against a stale percentage and send the bar backwards.
cau_progress_creep $(( SECONDS - CAU_PROGRESS_CREEP_T0 )) cau_progress_creep $(( SECONDS - CAU_PROGRESS_CREEP_T0 ))
} }
# cau_progress_detail <label-msgid> <value> # cau_progress_detail <label-msgid> <value>
# A labelled line under the entry's "Details" - which package is being unpacked # A labelled line under the entry's "Details", for example which package is
# right now, say. # being unpacked right now.
cau_progress_detail() { cau_progress_detail() {
local label="$1" value="$2" i fd local label="$1" value="$2" i fd
@@ -383,7 +383,7 @@ CAU_PROGRESS_TAIL_PID=0
# #
# The protocol is one instruction per line, so the tail travels tab separated # The protocol is one instruction per line, so the tail travels tab separated
# and is put back together on the other side. Tabs inside a log line would # and is put back together on the other side. Tabs inside a log line would
# split it in two on the way, so they become spaces first - the job view # split it in two on the way, so they become spaces first. The job view
# renders either as whitespace, and a line broken in half renders as nonsense. # renders either as whitespace, and a line broken in half renders as nonsense.
cau_progress_log() { cau_progress_log() {
local label="$1" text="$2" i fd local label="$1" text="$2" i fd
@@ -465,12 +465,12 @@ cau_progress_end() {
# Before the descriptors go: anything still running in the background holds # Before the descriptors go: anything still running in the background holds
# its own copy of them, so the helper would not see the end of its input # its own copy of them, so the helper would not see the end of its input
# until it exited - and it is about to be waited on. # until it exited. And it is about to be waited on.
cau_progress_creep_stop cau_progress_creep_stop
cau_progress_tail_stop cau_progress_tail_stop
# The last step never consumes its own share - nothing reports items for # The last step never consumes its own share (nothing reports items for
# the cleanup - so the bar would stop a few percent short of the end and # the cleanup), so the bar would stop a few percent short of the end and
# vanish there. Only on the way out of a run that actually worked, though: # vanish there. Only on the way out of a run that actually worked, though:
# filling the bar for a failed update says the opposite of what happened. # filling the bar for a failed update says the opposite of what happened.
[[ $outcome == ok ]] && _cau_progress_line 'percent\t100' [[ $outcome == ok ]] && _cau_progress_line 'percent\t100'