Raspberry Pi Zero 2 W image builder; Power off/Restart buttons
pi/build-image.sh makes a ready-to-flash card: Raspberry Pi OS Lite 2026-10-06 + the Gyre software as a service on http://gyre.local (port 80), first-boot setup through cloud-init (user, SSH key, Wi-Fi, packages from the card), USB host mode on the Zero 2's data port. No root: mtools for the boot partition, debugfs for the root filesystem. Wi-Fi and credentials stay in the work dir. Web page: Power off / Restart links when GYRE_POWER_BUTTONS=1 (set by the Pi service); thumbnails keyed by file contents so pre-made ones ship on the card; stale thumbnails pruned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
97ebae93b2
commit
8a377af116
9 files changed
+336
-6
No files matched your search
@@ -64,6 +64,15 @@ class TestLibrary(unittest.TestCase):
|
||||
self.assertTrue(os.path.getsize(png) > 1000)
|
||||
self.assertGreater(self.lib.items()[1]['est'], 0) # running time known once the thumbnail is made
|
||||
|
||||
def test_thumb_key_follows_contents_not_dates(self):
|
||||
k1 = self.lib._key('spirals/tiny.thr')
|
||||
p = self.lib.path('spirals/tiny.thr')
|
||||
os.utime(p, (1, 1)) # same contents, other date
|
||||
self.assertEqual(self.lib._key('spirals/tiny.thr'), k1)
|
||||
with open(p, 'a') as f:
|
||||
f.write('0 0\n')
|
||||
self.assertNotEqual(self.lib._key('spirals/tiny.thr'), k1)
|
||||
|
||||
def test_refuses_paths_outside(self):
|
||||
for bad in ('../cache/index.json', '../../tiny.thr', '/etc/passwd', 'spirals/../../x.thr', 'spirals/nope.thr'):
|
||||
with self.assertRaises(KeyError):
|
||||
@@ -264,6 +273,8 @@ class TestHttp(unittest.TestCase):
|
||||
self.assertFalse(self.post('play', {'ids': ['../../etc/passwd']})['ok'])
|
||||
up = self.post('upload?name=new.thr', raw=b'0 0\n6.28 1\n')
|
||||
self.assertEqual(up['msg'], 'uploads/new.thr')
|
||||
self.assertFalse(json.loads(self.get('/api/status'))['power_buttons']) # off unless on the Pi
|
||||
self.assertFalse(self.post('poweroff')['ok'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in new issue
Block a user