plc-checkweigher 1.37.2 → 1.37.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/setup.sh +37 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plc-checkweigher",
3
- "version": "1.37.2",
3
+ "version": "1.37.4",
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
@@ -277,6 +277,42 @@ setup_wifi() {
277
277
  fi
278
278
  }
279
279
 
280
+ # ── 5b. Ethernet — static IP for PLC communication ───────────────────────────
281
+ setup_eth0_static() {
282
+ step "Ethernet (eth0) — static IP for PLC"
283
+
284
+ local ETH_CON="plc-eth"
285
+ local ETH_IP="192.168.3.10"
286
+ local ETH_PREFIX="24" # 255.255.255.0
287
+
288
+ if ! ip link show eth0 &>/dev/null; then
289
+ warn "No eth0 found — skipping static IP setup."
290
+ return
291
+ fi
292
+
293
+ # Remove any existing managed connection on eth0 to start clean.
294
+ nmcli -t -f NAME,DEVICE con show \
295
+ | awk -F: '$2=="eth0"{print $1}' \
296
+ | while read -r CON; do
297
+ nmcli connection delete "$CON" 2>/dev/null || true
298
+ done
299
+
300
+ nmcli connection add \
301
+ type ethernet \
302
+ ifname eth0 \
303
+ con-name "${ETH_CON}" \
304
+ ipv4.method manual \
305
+ ipv4.addresses "${ETH_IP}/${ETH_PREFIX}" \
306
+ ipv4.gateway "" \
307
+ ipv4.dns "" \
308
+ ipv6.method disabled \
309
+ connection.autoconnect yes \
310
+ connection.autoconnect-priority 100 2>/dev/null
311
+
312
+ nmcli connection up "${ETH_CON}" 2>/dev/null || true
313
+ ok "eth0 → ${ETH_IP}/${ETH_PREFIX} (static, no gateway — PLC subnet only)"
314
+ }
315
+
280
316
  # ── 6b. Web maintenance terminal access code ─────────────────────────────────
281
317
  setup_console_passwd() {
282
318
  step "Maintenance console access code ..."
@@ -988,6 +1024,7 @@ main() {
988
1024
  setup_dirs # 4
989
1025
  install_cli # 5 — plc_checkweigher status command
990
1026
  setup_wifi # 6 — interactive WiFi picker
1027
+ setup_eth0_static # 6b — eth0 static 192.168.3.10/24 for PLC comms
991
1028
  setup_smb # 7 — interactive SMB config → smb_config.py
992
1029
  setup_console_passwd # 7b — web maintenance terminal access code
993
1030
  setup_network_online # 8