Keep the powerprofilesctl shebang fix applied across daemon upgrades (#11031) - #11097
Open
sandmor wants to merge 2 commits into
Open
Keep the powerprofilesctl shebang fix applied across daemon upgrades (#11031)#11097sandmor wants to merge 2 commits into
sandmor wants to merge 2 commits into
Conversation
agent-usage scanner tests import collectors via SourceFileLoader, which writes a stray bin/__pycache__ next to the collector. That cache then makes locate-test fail when it reads bin/, install/, and migrations/ as UTF-8. Stop the loaders from writing bytecode, and make the locate scan skip __pycache__ and undecodable files so a stray cache can never break it again.
The install-time rewrite of /usr/bin/powerprofilesctl to #!/bin/python3 ran once and every power-profiles-daemon upgrade restored the packaged #!/usr/bin/env python3 shebang, so each upgrade silently undid it. Where mise supplies python3 on PATH, the CLI then dies with ImportError inside Omarchy's power profile callers. Ship an ALPM hook that re-applies the fix on Install/Upgrade of power-profiles-daemon, wire a migration for installs whose upgrade already reverted the fix, and keep the single source of truth in the install script that now skips elevation for already-fixed clients. Closes omacom#11031
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11031.
Problem
install/config/fix-powerprofilesctl-shebang.shrewrote/usr/bin/powerprofilesctl's shebang to#!/bin/python3exactly once at install time. Everypower-profiles-daemonupgrade restored the packaged#!/usr/bin/env python3and silently undid the fix. On a PATH wheremisesuppliespython3, the CLI then dies withImportErrorinside Omarchy's power profile callers (omarchy-powerprofiles-set,omarchy-powerprofiles-list, the Quickshell menu and battery service).Fix
default/libalpm/hooks/70-omarchy-powerprofilesctl-shebang.hook— a new ALPM post-transaction hook firing on Install/Upgrade ofpower-profiles-daemon(noAbortOnFail), Execs the packaged fix script. The fix is durable from this point forward.install/config/fix-powerprofilesctl-shebang.sh— still the single source of truth; now guards on the exact packaged shebang so an already-fixed client costs nothing and needs no elevation, and usessudoonly when not already root.migrations/1789023127.sh— repairs installs whose upgrade already reverted the fix (the hook alone only helps future upgrades). Idempotent: a second user re-runs it without a prompt once the machine is fixed.Companion PR: omacom/omarchy-pkgs ships the new hook file in the
omarchyandomarchy-devPKGBUILDs (config-test.shasserts that pairing once theomarchy-pkgscheckout resolves).Tests
test/shell.d/powerprofiles-shebang-hook-test.sh(8 ok): hook trigger/shape perpacman-hooks(5), rewrite, idempotency, foreign shebang preserved, missing file tolerated, elevation stubbed end-to-end.agent-usage-*collector loaders stopped writingbin/__pycache__, andlocate-test.shtolerates such caches when scanningbin/install/migrations(separate commit, same PR)../test/shell→ 237/237,./test/cli→ 112/112.