plc-checkweigher 1.28.2 → 1.29.1
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/bin/plc_checkweigher +10 -8
- package/package.json +1 -1
- package/setup.sh +26 -12
package/bin/plc_checkweigher
CHANGED
|
@@ -1450,27 +1450,29 @@ PYEOF
|
|
|
1450
1450
|
ulog "CONFIG: journal OK"
|
|
1451
1451
|
fi
|
|
1452
1452
|
|
|
1453
|
-
# 9b. Web maintenance sudoers rule (dashboard
|
|
1453
|
+
# 9b. Web maintenance sudoers rule (dashboard terminal)
|
|
1454
1454
|
spin_start "Web maintenance sudoers rule"
|
|
1455
1455
|
_SUDOERS_F="/etc/sudoers.d/010_plc-web-fix"
|
|
1456
|
-
if
|
|
1456
|
+
# Content-aware: rewrite if missing OR still the old fix-only version
|
|
1457
|
+
if [[ ! -f "$_SUDOERS_F" ]] \
|
|
1458
|
+
|| ! sudo grep -q "plc_checkweigher update" "$_SUDOERS_F" 2>/dev/null; then
|
|
1457
1459
|
cat > /tmp/010_plc-web-fix << 'SUDOEOF'
|
|
1458
|
-
# Web dashboard maintenance
|
|
1459
|
-
# to run
|
|
1460
|
-
pi ALL=(root) NOPASSWD: /usr/local/bin/plc_checkweigher fix, /usr/local/bin/plc_checkweigher fix
|
|
1460
|
+
# Web dashboard maintenance terminal — allows the locked, root-owned CLI
|
|
1461
|
+
# to run whitelisted maintenance subcommands from plc_web (User=pi).
|
|
1462
|
+
pi ALL=(root) NOPASSWD: /usr/local/bin/plc_checkweigher fix, /usr/local/bin/plc_checkweigher fix *, /usr/local/bin/plc_checkweigher status, /usr/local/bin/plc_checkweigher restart, /usr/local/bin/plc_checkweigher start, /usr/local/bin/plc_checkweigher stop, /usr/local/bin/plc_checkweigher update
|
|
1461
1463
|
SUDOEOF
|
|
1462
1464
|
if sudo visudo -c -f /tmp/010_plc-web-fix &>/dev/null; then
|
|
1463
1465
|
sudo cp /tmp/010_plc-web-fix "$_SUDOERS_F"
|
|
1464
1466
|
sudo chmod 440 "$_SUDOERS_F"
|
|
1465
|
-
spin_ok "Sudoers rule installed (web
|
|
1466
|
-
ulog "FIXED: web maintenance sudoers rule installed"
|
|
1467
|
+
spin_ok "Sudoers rule installed/upgraded (web terminal enabled)"
|
|
1468
|
+
ulog "FIXED: web maintenance sudoers rule installed/upgraded"
|
|
1467
1469
|
else
|
|
1468
1470
|
spin_warn "Sudoers rule failed validation — skipped"
|
|
1469
1471
|
ulog "WARN: sudoers rule validation failed"
|
|
1470
1472
|
fi
|
|
1471
1473
|
rm -f /tmp/010_plc-web-fix
|
|
1472
1474
|
else
|
|
1473
|
-
spin_ok "Sudoers rule
|
|
1475
|
+
spin_ok "Sudoers rule current"
|
|
1474
1476
|
ulog "CONFIG: web sudoers OK"
|
|
1475
1477
|
fi
|
|
1476
1478
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plc-checkweigher",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.1",
|
|
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
|
"scripts": {
|
|
6
6
|
"postinstall": "node bin/cli.js"
|
package/setup.sh
CHANGED
|
@@ -169,19 +169,21 @@ install_cli() {
|
|
|
169
169
|
warn "bin/plc_checkweigher not found — skipping CLI install"
|
|
170
170
|
fi
|
|
171
171
|
|
|
172
|
-
# Scoped sudoers rule: web
|
|
173
|
-
# locked root-owned CLI
|
|
172
|
+
# Scoped sudoers rule: web maintenance terminal can run whitelisted
|
|
173
|
+
# subcommands of the locked root-owned CLI — and nothing else.
|
|
174
|
+
# Interactive/destructive subcommands (wifi, smb-config, uninstall,
|
|
175
|
+
# hotspot) are deliberately NOT listed.
|
|
174
176
|
cat > /tmp/010_plc-web-fix << 'EOF'
|
|
175
|
-
# Web dashboard maintenance
|
|
176
|
-
# to run
|
|
177
|
-
pi ALL=(root) NOPASSWD: /usr/local/bin/plc_checkweigher fix, /usr/local/bin/plc_checkweigher fix
|
|
177
|
+
# Web dashboard maintenance terminal — allows the locked, root-owned CLI
|
|
178
|
+
# to run whitelisted maintenance subcommands from plc_web (User=pi).
|
|
179
|
+
pi ALL=(root) NOPASSWD: /usr/local/bin/plc_checkweigher fix, /usr/local/bin/plc_checkweigher fix *, /usr/local/bin/plc_checkweigher status, /usr/local/bin/plc_checkweigher restart, /usr/local/bin/plc_checkweigher start, /usr/local/bin/plc_checkweigher stop, /usr/local/bin/plc_checkweigher update
|
|
178
180
|
EOF
|
|
179
181
|
if visudo -c -f /tmp/010_plc-web-fix &>/dev/null; then
|
|
180
182
|
cp /tmp/010_plc-web-fix /etc/sudoers.d/010_plc-web-fix
|
|
181
183
|
chmod 440 /etc/sudoers.d/010_plc-web-fix
|
|
182
|
-
ok "Web maintenance sudoers rule installed (
|
|
184
|
+
ok "Web maintenance sudoers rule installed (whitelisted subcommands)"
|
|
183
185
|
else
|
|
184
|
-
warn "sudoers rule failed validation — web
|
|
186
|
+
warn "sudoers rule failed validation — web maintenance terminal limited"
|
|
185
187
|
fi
|
|
186
188
|
rm -f /tmp/010_plc-web-fix
|
|
187
189
|
}
|
|
@@ -622,15 +624,27 @@ setup_vscode_priority() {
|
|
|
622
624
|
|
|
623
625
|
cat > /usr/local/bin/vscode-priority-daemon << 'DAEMON'
|
|
624
626
|
#!/usr/bin/env bash
|
|
625
|
-
# Apply CPU affinity (cores 0-2) and Nice=-5 to
|
|
627
|
+
# Apply CPU affinity (cores 0-2) and Nice=-5 to remote-dev processes:
|
|
628
|
+
# - VS Code server + all its extensions (extension host, Claude Code,
|
|
629
|
+
# GitHub, language servers — anything under ~/.vscode-server)
|
|
630
|
+
# - standalone claude CLI sessions (run outside VS Code)
|
|
631
|
+
# - sshd listener + active SSH sessions
|
|
626
632
|
# Core 3 is reserved exclusively for the SCHED_FIFO PLC process.
|
|
627
|
-
# Runs every 60s so newly-spawned
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
for pid in "
|
|
633
|
+
# Runs every 60s so newly-spawned processes are caught promptly.
|
|
634
|
+
prioritize() {
|
|
635
|
+
local pid
|
|
636
|
+
for pid in "$@"; do
|
|
631
637
|
taskset -cp 0-2 "$pid" >/dev/null 2>&1 || true
|
|
632
638
|
renice -n -5 -p "$pid" >/dev/null 2>&1 || true
|
|
633
639
|
done
|
|
640
|
+
}
|
|
641
|
+
while true; do
|
|
642
|
+
# VS Code server tree — extension binaries live under .vscode-server/extensions/
|
|
643
|
+
prioritize $(pgrep -u pi -f '\.vscode-server' 2>/dev/null)
|
|
644
|
+
# Standalone claude CLI (plain terminal, outside the VS Code tree)
|
|
645
|
+
prioritize $(pgrep -u pi -x claude 2>/dev/null)
|
|
646
|
+
# SSH — listener and per-session processes (keep off the RT core)
|
|
647
|
+
prioritize $(pgrep -x sshd 2>/dev/null) $(pgrep -x sshd-session 2>/dev/null)
|
|
634
648
|
sleep 60
|
|
635
649
|
done
|
|
636
650
|
DAEMON
|