GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — SampleBoot/tools/make_release.py at main · pxcm/SampleBoot

Expand file tree

/

make_release.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
74 lines (68 loc) · 3.66 KB
/

make_release.py

Copy path

File metadata and controls

74 lines (68 loc) · 3.66 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python3
"""Assembles dist/SampleBoot-<version>/ and its zip:
a ready-to-copy, signed "autorun" folder plus README and helper.
Run "make" first to build build/sampleboot-ui."""
import hashlib, json, re, shutil, sys, zipfile
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
VERSION = re.search(r'#define VERSION "([^"]+)"', (ROOT / "src/sampleboot-ui.c").read_text()).group(1)
# The firmware runs autorun/autorun.sh only when autorun.check equals
# sha256(autorun.json + autorun.sh + this salt) (found by mpc-sample-plugins,
# also used by sample-base/Melodee).
SALT = b"f7bed1c9-7e90-4731-9194-c996666b4331"
STUB = """#!/bin/sh
# SAMPLEBOOT
# SampleBoot, boot selector for the Akai MPC Sample. The start-up script is
# sampleboot/sampleboot.sh, the alternative OSes are in mods/<name>/. Runs
# once per power-on (the marker in /run is gone after a reboot).
# This file is signed by autorun.check: do not edit.
D=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
[ -e /run/sampleboot.started ] && exit 0
: > /run/sampleboot.started
cp "$D/sampleboot/sampleboot.sh" /run/sampleboot.sh 2>/dev/null || exit 0
if command -v systemd-run >/dev/null 2>&1; then
systemd-run --unit=sampleboot --no-block --property=Type=oneshot \\
--property=RemainAfterExit=yes --property=TimeoutStartSec=infinity \\
/bin/sh /run/sampleboot.sh "$D" > /dev/null 2>&1 && exit 0
fi
setsid /bin/sh /run/sampleboot.sh "$D" > /dev/null 2>&1 &
"""
MANIFEST = json.dumps({"value0": {"scripts": [{
"path": "autorun.sh", "askQuestion": False, "message": "SampleBoot",
"yesButtonText": "Start", "noButtonText": "Cancel"}], "files": []}}, indent=2) + "\n"
def main():
binary = ROOT / "build" / "sampleboot-ui"
if not binary.exists():
sys.exit("build/sampleboot-ui missing: run make first")
name = f"SampleBoot-{VERSION}"
out = ROOT / "dist" / name
shutil.rmtree(out, ignore_errors=True)
ar = out / "autorun"
(ar / "sampleboot").mkdir(parents=True)
(out / "tools").mkdir()
(ar / "mods").mkdir()
(ar / "autorun.sh").write_bytes(STUB.encode())
(ar / "autorun.json").write_bytes(MANIFEST.encode())
# Firmware 1.4 starts only an autorun.sh at the top of the card (Developer Mode).
shutil.copyfile(ROOT / "card" / "autorun-top.sh", out / "autorun.sh")
(ar / "autorun.check").write_text(hashlib.sha256(MANIFEST.encode() + STUB.encode() + SALT).hexdigest())
shutil.copyfile(binary, ar / "sampleboot" / "sampleboot-ui")
(ar / "sampleboot" / "sampleboot-ui").chmod(0o755)
for f in ("sampleboot.sh", "sampleboot.conf", "firmware.txt", "splash-dark.png", "splash-light.png"):
shutil.copyfile(ROOT / "card" / f, ar / "sampleboot" / f)
shutil.copyfile(ROOT / "card" / "sampleboot.conf", ar / "sampleboot" / "sampleboot.original.conf")
shutil.copyfile(ROOT / "tools" / "theme-editor.html", out / "tools" / "theme-editor.html") if (ROOT / "tools" / "theme-editor.html").exists() else None
shutil.copyfile(ROOT / "card" / "mods-README.txt", ar / "mods" / "README.txt")
shutil.copytree(ROOT / "card" / "_template", ar / "mods" / "_template")
shutil.copyfile(ROOT / "tools" / "add_mod.py", out / "tools" / "add_mod.py")
shutil.copyfile(ROOT / "README.md", out / "README.md")
shutil.copyfile(ROOT / "LICENSE", out / "LICENSE")
shutil.copyfile(ROOT / "CHANGELOG.md", out / "CHANGELOG.md")
shutil.copyfile(ROOT / "fonts" / "LICENSE-DejaVu.txt", out / "LICENSE-DejaVu.txt")
z = out.parent / (name + ".zip")
with zipfile.ZipFile(z, "w", zipfile.ZIP_DEFLATED) as zf:
for p in sorted(out.rglob("*")):
zf.write(p, p.relative_to(out.parent))
print(f"{out}\n{z}")
if __name__ == "__main__":
main()
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.