Repository navigation
Expand file tree
/
Copy pathbundle-theme.sh
More file actions
executable file
·103 lines (93 loc) · 5.09 KB
/
Copy pathbundle-theme.sh
File metadata and controls
executable file
·103 lines (93 loc) · 5.09 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
# Bundle this fork's theme into a rockbox.zip produced by `make zip`, and make
# scrim the first-boot default via a shipped default-config.cfg (applied before
# any compiled DEFAULT_WPSNAME / DEFAULT_SBSNAME fallback takes effect).
#
# Scrim is the only theme the firmware zip carries. The others in themes/ are
# published as their own download by release.sh, so a player takes only the
# theme it starts with and picks up the rest if it wants them.
#
# This lives here rather than in tools/buildzip.pl so that file stays as close
# to upstream as possible. `make zip` alone produces a themeless zip;
# every path that ships a build must run this afterwards.
#
# Usage: run from inside a build dir, or pass the build dir as an argument.
set -e
ROOT="$(cd "$(dirname "$0")" && pwd)"
BUILDDIR="$(cd "${1:-.}" && pwd)"
ZIP="$BUILDDIR/rockbox.zip"
if [ ! -f "$ZIP" ]; then
echo "bundle-theme.sh: no rockbox.zip in $BUILDDIR -- run 'make zip' first" >&2
exit 1
fi
# themes/<name>/.rockbox already has the on-device layout, so it merges on copy.
# Named rather than globbed, or a `git merge rockbox/master` would quietly start
# shipping stock themes that were never converted. Trap: two themes shipping
# different files under one name resolve to whichever copies last -- check for
# filename collisions before adding a second one here.
THEMES="scrim"
#
# default-config.cfg is the build's first-boot config, not part of any theme,
# so it sits beside them rather than inside one.
STAGE="$(mktemp -d)"
trap 'rm -rf "$STAGE"' EXIT
mkdir -p "$STAGE/.rockbox"
for theme in $THEMES; do
if [ ! -d "$ROOT/themes/$theme/.rockbox" ]; then
echo "bundle-theme.sh: themes/$theme/.rockbox is missing" >&2
exit 1
fi
cp -R "$ROOT/themes/$theme/.rockbox/." "$STAGE/.rockbox/"
done
# The firmware reads this only when the player has no config.cfg of its own,
# so shipping it never takes an existing player's settings with it. Never
# ship config.cfg itself: that file is the device's, and an install that
# overwrites or deletes it resets the player.
cp "$ROOT/themes/default-config.cfg" "$STAGE/.rockbox/default-config.cfg"
# Faces the firmware itself needs, which is not the same as the ones a theme
# brings.
mkdir -p "$STAGE/.rockbox/fonts"
cp "$ROOT/apps-ipod/fonts/"*.fnt "$STAGE/.rockbox/fonts/"
# The licence texts go with them: scrim ships copies of both, so a theme
# change that dropped them would take the only copy on the player with it.
cp "$ROOT/apps-ipod/fonts/"LICENSE-*.txt "$STAGE/.rockbox/fonts/"
# The other faces the core names by path live in scrim's folder rather than
# beside the binary, so each is named here as well as arriving with the theme
# above: shipped only as part of scrim, one would leave the device the moment
# the theme stopped using it, and the screen that named it falls back to the
# system font without saying so. The check makes that a build failure instead.
CORE_FONTS="26-noto-sans-medium.fnt 18-noto-sans-bold.fnt 18-noto-sans.fnt
12-noto-sans.fnt 14-noto-sans.fnt 24x24-icons.fnt 24-seven-fifteen.fnt"
for font in $CORE_FONTS; do
if [ ! -f "$ROOT/themes/scrim/.rockbox/fonts/$font" ]; then
echo "bundle-theme.sh: the core loads $font; scrim dropped it" >&2
exit 1
fi
cp "$ROOT/themes/scrim/.rockbox/fonts/$font" "$STAGE/.rockbox/fonts/"
done
# The default iconset. buildzip.pl creates icons/ but copies nothing into it,
# so DEFAULT_ICONSET ("tango_icons.16x16", settings_list.c) pointed at a file
# that was never on the device. load_icons() fails silently and every icon
# falls back to the compiled-in bm_default_icons, which is 6x8 -- a blob at
# 320x240. The viewers set goes with it for the same reason.
mkdir -p "$STAGE/.rockbox/icons"
cp "$ROOT/icons/tango_icons.16x16.bmp" "$STAGE/.rockbox/icons/"
cp "$ROOT/icons/tango_icons_viewers.16x16.bmp" "$STAGE/.rockbox/icons/"
(cd "$STAGE" && zip -qr "$ZIP" .rockbox)
# Upstream buildzip.pl copies the classic_statusbar theme straight out of
# wps/ rather than going through WPSLIST, so it lands in the zip even though
# it is not one of the themes above. Drop the directory and the two loose .sbs
# files it writes alongside (the trailing slash pattern does not match those).
zip -qd "$ZIP" '.rockbox/wps/classic_statusbar/*' >/dev/null 2>&1 || true
zip -qd "$ZIP" '.rockbox/wps/classic_statusbar.sbs' \
'.rockbox/wps/classic_statusbar.rsbs' >/dev/null 2>&1 || true
# Same problem, different directory: buildzip.pl reads the plugin data files
# from $ROOT/apps/plugins by a hardcoded path, ignoring --appsdir. This fork
# has no plugin system, but it keeps upstream's apps/ tree so that merges from
# Rockbox apply cleanly -- so buildzip still finds ~380 KB of Lua scripts,
# level files and viewer config and ships them for a loader that is not there.
# viewers.config goes the same way: filetypes.c compiles the extension-to-
# viewer mapping in, and nothing reads the file any more.
zip -qd "$ZIP" '.rockbox/rocks/*' '.rockbox/rocks/' >/dev/null 2>&1 || true
zip -qd "$ZIP" '.rockbox/viewers.config' >/dev/null 2>&1 || true
echo "bundled$(for t in $THEMES; do printf ' %s' "$t"; done) + default-config.cfg into $ZIP"