Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ release is checked here and released on by hand.
the on-screen keyboard stays above the control center until it is put
away, instead of being covered by it where it couldn't be dismissed.

- Update Firmware ends on Done when there is nothing to update, instead of
showing "Failed (2)".

## [0.4.8] - 2026-12-03

### Desktop
Expand Down
26 changes: 26 additions & 0 deletions desktop/shell/bin/omarchy-update-firmware
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# omarchy:summary=Update system firmware using fwupd. Ensures the fwupd EFI binary is installed
# omarchy:requires-sudo=true

# Upstream Omarchy's, except that "nothing to update" is not a failure.
set -e
echo -e "\e[32mUpdate Firmware\e[0m"

if omarchy-cmd-missing fwupdmgr; then
omarchy-pkg-add fwupd
fi

if [[ -d /sys/firmware/efi ]] && [[ -f /usr/lib/fwupd/efi/fwupdx64.efi ]]; then
sudo install -D /usr/lib/fwupd/efi/fwupdx64.efi /boot/EFI/arch/fwupdx64.efi
fi

fwupdmgr refresh --force

# fwupdmgr exits 2 when it has nothing to do: "No updatable devices", the
# usual answer on these boards. That is a result, not a failure, so the
# floating terminal ends on Done instead of "Failed (2)" (#252).
status=0
sudo fwupdmgr update || status=$?
(( status == 2 )) && exit 0
exit "$status"
3 changes: 3 additions & 0 deletions docs/upstream.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ gum), `omarchy-dev-add-migration`, `omarchy-toggle-bar`,
`omarchy-launch-browser` and `omarchy-launch-webapp` (Firefox; upstream's web
apps need Chromium).

**Upstream's with one change:** `omarchy-update-firmware` ends well when
fwupd has nothing to update (its exit status 2).

**Taken unchanged** for the launcher's Uninstall: `omarchy-remove-launcher-entry`.

**Changed for touch and the tablet in the shell.**
Expand Down
47 changes: 47 additions & 0 deletions tests/test_update_firmware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""Update Firmware: "nothing to update" is not a failure (#252)."""
from pathlib import Path
import os
import subprocess
import tempfile
import unittest

SCRIPT = Path(__file__).resolve().parents[1] / 'desktop/shell/bin/omarchy-update-firmware'


class UpdateFirmware(unittest.TestCase):
def run_with(self, update_status, refresh_status=0):
with tempfile.TemporaryDirectory() as stubs:
calls = Path(stubs) / 'calls'
for name, body in {
'omarchy-cmd-missing': 'exit 1\n',
'sudo': 'exec "$@"\n',
'fwupdmgr': f'echo "fwupdmgr $*" >> {calls}\n'
f'[ "$1" = refresh ] && exit {refresh_status}\n'
f'exit {update_status}\n',
}.items():
stub = Path(stubs) / name
stub.write_text('#!/bin/bash\n' + body)
stub.chmod(0o755)
env = dict(os.environ, PATH=f'{stubs}:{os.environ["PATH"]}')
result = subprocess.run(['bash', str(SCRIPT)], env=env, capture_output=True, text=True)
return result.returncode, calls.read_text().splitlines()

def test_nothing_to_update_ends_well(self):
status, calls = self.run_with(update_status=2)
self.assertEqual(status, 0)
self.assertEqual(calls, ['fwupdmgr refresh --force', 'fwupdmgr update'])

def test_an_update_that_fails_still_fails(self):
self.assertEqual(self.run_with(update_status=1)[0], 1)

def test_an_update_that_works_ends_well(self):
self.assertEqual(self.run_with(update_status=0)[0], 0)

def test_a_failed_refresh_stops_before_the_update(self):
status, calls = self.run_with(update_status=0, refresh_status=1)
self.assertEqual(status, 1)
self.assertEqual(calls, ['fwupdmgr refresh --force'])


if __name__ == '__main__':
unittest.main()