77 lines
3.7 KiB
Bash
Executable File
77 lines
3.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# 9001-wallpaper.hook.chroot — generate /usr/share/bee/wallpaper.png inside chroot
|
|
set -e
|
|
echo "=== generating bee wallpaper ==="
|
|
mkdir -p /usr/share/bee
|
|
|
|
python3 - <<'PYEOF'
|
|
from PIL import Image, ImageDraw, ImageFont
|
|
import os
|
|
|
|
W, H = 1920, 1080
|
|
|
|
LOGO = """\
|
|
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u255a\u2588\u2588\u2557 \u2588\u2588\u2554\u255d \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d
|
|
\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u255a\u2588\u2588\u2588\u2588\u2554\u255d \u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557
|
|
\u2588\u2588\u2554\u2550\u2550\u255d \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u255a\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u255a\u2588\u2588\u2554\u255d \u255a\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u255d \u2588\u2588\u2554\u2550\u2550\u255d
|
|
\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d \u255a\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d
|
|
Hardware Audit LiveCD"""
|
|
|
|
# Find a monospace font that supports box-drawing characters
|
|
FONT_CANDIDATES = [
|
|
'/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf',
|
|
'/usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf',
|
|
'/usr/share/fonts/truetype/freefont/FreeMono.ttf',
|
|
'/usr/share/fonts/truetype/noto/NotoMono-Regular.ttf',
|
|
]
|
|
|
|
font_path = None
|
|
for p in FONT_CANDIDATES:
|
|
if os.path.exists(p):
|
|
font_path = p
|
|
break
|
|
|
|
SIZE = 22
|
|
if font_path:
|
|
font_logo = ImageFont.truetype(font_path, SIZE)
|
|
font_sub = ImageFont.truetype(font_path, SIZE)
|
|
else:
|
|
font_logo = ImageFont.load_default()
|
|
font_sub = font_logo
|
|
|
|
img = Image.new('RGB', (W, H), (0, 0, 0))
|
|
draw = ImageDraw.Draw(img)
|
|
|
|
# Measure logo block line by line to avoid font ascender offset
|
|
lines = LOGO.split('\n')
|
|
logo_lines = lines[:6]
|
|
sub_line = lines[6] if len(lines) > 6 else ''
|
|
|
|
line_h = SIZE + 2
|
|
block_h = len(logo_lines) * line_h + 8 + (SIZE if sub_line else 0)
|
|
|
|
# Width: measure the widest logo line
|
|
max_w = 0
|
|
for line in logo_lines:
|
|
bb = draw.textbbox((0, 0), line, font=font_logo)
|
|
max_w = max(max_w, bb[2] - bb[0])
|
|
|
|
x = (W - max_w) // 2
|
|
y = (H - block_h) // 2
|
|
|
|
cy = y
|
|
for line in logo_lines:
|
|
draw.text((x, cy), line, font=font_logo, fill=(0xf6, 0xc9, 0x0e))
|
|
cy += line_h
|
|
cy += 8
|
|
if sub_line:
|
|
draw.text((x, cy), sub_line, font=font_sub, fill=(0x80, 0x68, 0x18))
|
|
|
|
img.save('/usr/share/bee/wallpaper.png', optimize=True)
|
|
print('wallpaper written: /usr/share/bee/wallpaper.png')
|
|
PYEOF
|
|
|
|
echo "=== wallpaper done ==="
|