plc-checkweigher 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/logo.png +0 -0
- package/package.json +3 -2
- package/setup.sh +87 -6
package/assets/logo.png
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plc-checkweigher",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "One-command installer for the PLC Check-Weigher system on Raspberry Pi (PREEMPT_RT kernel, Python stack, WiFi, SMB, systemd RT services)",
|
|
5
5
|
"bin": {
|
|
6
6
|
"plc-checkweigher": "bin/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"bin/",
|
|
10
|
-
"setup.sh"
|
|
10
|
+
"setup.sh",
|
|
11
|
+
"assets/"
|
|
11
12
|
],
|
|
12
13
|
"keywords": [
|
|
13
14
|
"plc",
|
package/setup.sh
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# =============================================================================
|
|
3
|
-
# PLC Check-Weigher — Full Stack Installer v1.
|
|
3
|
+
# PLC Check-Weigher — Full Stack Installer v1.3
|
|
4
4
|
# =============================================================================
|
|
5
5
|
# Run on any fresh Raspberry Pi:
|
|
6
6
|
#
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
# 7. SMB — enter host IP, share name, credentials → smb_config.py
|
|
17
17
|
# 8. NetworkManager-wait-online
|
|
18
18
|
# 9. systemd services (plc_watcher + plc_web)
|
|
19
|
-
# 10.
|
|
20
|
-
# 11.
|
|
19
|
+
# 10. Boot logo — Plymouth theme with logo.png + "SAI SAMARTH ENGG"
|
|
20
|
+
# 11. PREEMPT_RT kernel ← installed last so only one reboot is needed
|
|
21
|
+
# 12. REBOOT
|
|
21
22
|
# =============================================================================
|
|
22
23
|
|
|
23
24
|
set -euo pipefail
|
|
@@ -364,7 +365,86 @@ EOF
|
|
|
364
365
|
chown "${PI_USER}:${PI_USER}" "${INSTALL_DIR}/plc_watcher.service"
|
|
365
366
|
}
|
|
366
367
|
|
|
367
|
-
# ──
|
|
368
|
+
# ── 10. Boot splash — Plymouth theme with logo + company name ────────────────
|
|
369
|
+
setup_boot_logo() {
|
|
370
|
+
step "Boot splash screen ..."
|
|
371
|
+
|
|
372
|
+
# Install Plymouth + font support (safe to run even if already installed)
|
|
373
|
+
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \
|
|
374
|
+
plymouth plymouth-themes fonts-freefont-ttf
|
|
375
|
+
|
|
376
|
+
THEME_DIR="/usr/share/plymouth/themes/saismruth"
|
|
377
|
+
mkdir -p "${THEME_DIR}"
|
|
378
|
+
|
|
379
|
+
# ── Logo: resize assets/logo.png to 256×256 and copy into theme ──────────
|
|
380
|
+
LOGO_SRC="${INSTALL_DIR}/assets/logo.png"
|
|
381
|
+
if [[ -f "${LOGO_SRC}" ]]; then
|
|
382
|
+
"${VENV_DIR}/bin/python3" - << PYEOF
|
|
383
|
+
from PIL import Image
|
|
384
|
+
img = Image.open("${LOGO_SRC}").convert("RGBA")
|
|
385
|
+
img.thumbnail((256, 256), Image.LANCZOS)
|
|
386
|
+
img.save("${THEME_DIR}/logo.png", "PNG")
|
|
387
|
+
PYEOF
|
|
388
|
+
ok "Logo installed (256×256) → ${THEME_DIR}/logo.png"
|
|
389
|
+
else
|
|
390
|
+
warn "assets/logo.png not found — splash will show text only"
|
|
391
|
+
fi
|
|
392
|
+
|
|
393
|
+
# ── Theme config file ─────────────────────────────────────────────────────
|
|
394
|
+
cat > "${THEME_DIR}/saismruth.plymouth" << 'EOF'
|
|
395
|
+
[Plymouth Theme]
|
|
396
|
+
Name=SAI SAMARTH ENGG
|
|
397
|
+
Description=PLC Check-Weigher Boot Screen — SAI SAMARTH ENGG
|
|
398
|
+
ModuleName=script
|
|
399
|
+
|
|
400
|
+
[script]
|
|
401
|
+
ImageDir=/usr/share/plymouth/themes/saismruth
|
|
402
|
+
ScriptFile=/usr/share/plymouth/themes/saismruth/saismruth.script
|
|
403
|
+
EOF
|
|
404
|
+
|
|
405
|
+
# ── Plymouth script: logo centred, text below ─────────────────────────────
|
|
406
|
+
cat > "${THEME_DIR}/saismruth.script" << 'EOF'
|
|
407
|
+
# ── SAI SAMARTH ENGG — Boot Splash ────────────────────────────────────────────
|
|
408
|
+
Window.SetBackgroundTopColor(0.0, 0.0, 0.0);
|
|
409
|
+
Window.SetBackgroundBottomColor(0.0, 0.0, 0.0);
|
|
410
|
+
|
|
411
|
+
screen_w = Window.GetWidth();
|
|
412
|
+
screen_h = Window.GetHeight();
|
|
413
|
+
|
|
414
|
+
# ── Logo (centred, slightly above middle to leave room for text) ──────────────
|
|
415
|
+
logo_img = Image("logo.png");
|
|
416
|
+
logo_w = logo_img.GetWidth();
|
|
417
|
+
logo_h = logo_img.GetHeight();
|
|
418
|
+
logo_x = (screen_w - logo_w) / 2;
|
|
419
|
+
logo_y = (screen_h - logo_h) / 2 - 40;
|
|
420
|
+
|
|
421
|
+
logo_sprite = Sprite(logo_img);
|
|
422
|
+
logo_sprite.SetPosition(logo_x, logo_y, 0);
|
|
423
|
+
|
|
424
|
+
# ── Company name centred below logo ───────────────────────────────────────────
|
|
425
|
+
text_img = Image.Text("SAI SAMARTH ENGG", 1.0, 1.0, 1.0, 1.0, "Sans Bold 20");
|
|
426
|
+
text_w = text_img.GetWidth();
|
|
427
|
+
text_x = (screen_w - text_w) / 2;
|
|
428
|
+
text_y = logo_y + logo_h + 22;
|
|
429
|
+
|
|
430
|
+
text_sprite = Sprite(text_img);
|
|
431
|
+
text_sprite.SetPosition(text_x, text_y, 1);
|
|
432
|
+
EOF
|
|
433
|
+
|
|
434
|
+
# ── Activate theme ────────────────────────────────────────────────────────
|
|
435
|
+
plymouth-set-default-theme saismruth
|
|
436
|
+
ok "Plymouth theme set → saismruth"
|
|
437
|
+
|
|
438
|
+
# Rebuild current initramfs so Plymouth is included.
|
|
439
|
+
# The RT kernel's post-install will create its own initramfs with Plymouth
|
|
440
|
+
# already installed, so initramfs8-rt will also carry the theme.
|
|
441
|
+
echo -n " Rebuilding initramfs (may take ~30 s) ..."
|
|
442
|
+
update-initramfs -u > /tmp/initramfs.log 2>&1 \
|
|
443
|
+
&& echo "" && ok "initramfs rebuilt" \
|
|
444
|
+
|| { echo ""; warn "initramfs warnings — see /tmp/initramfs.log"; }
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
# ── 11. RT kernel — installed LAST so only one reboot is needed ───────────────
|
|
368
448
|
install_rt_kernel() {
|
|
369
449
|
step "PREEMPT_RT kernel (final step before reboot) ..."
|
|
370
450
|
|
|
@@ -462,8 +542,9 @@ main() {
|
|
|
462
542
|
setup_smb # 6 — interactive SMB config → smb_config.py
|
|
463
543
|
setup_network_online # 7
|
|
464
544
|
install_services # 8
|
|
465
|
-
|
|
466
|
-
|
|
545
|
+
setup_boot_logo # 9 — Plymouth: logo + "SAI SAMARTH ENGG"
|
|
546
|
+
install_rt_kernel # 10 — LAST, so only one reboot needed
|
|
547
|
+
do_reboot # 11 — single reboot applies everything
|
|
467
548
|
}
|
|
468
549
|
|
|
469
550
|
main "$@"
|