File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ if [[ -z $1 ]]; then
4+ echo " Update Nakamochi with locally built nd and ngui."
5+ echo " Usage: $( basename " $0 " ) nakamochi-ip [binaries-path]"
6+ echo " Where:"
7+ echo " nakamochi-ip IP address of the Nakamochi device"
8+ echo " binaries-path (Optional) Path to the directory containing 'nd' and 'ngui' binaries. Defaults to ./zig-out/bin."
9+ exit 1
10+ fi
11+
12+ NAKAMOCHI_IP=$1
13+ BINARIES_PATH=${2:- ./ zig-out/ bin}
14+
15+ if [[ ! -f " $BINARIES_PATH /nd" || ! -f " $BINARIES_PATH /ngui" ]]; then
16+ echo " Could not find nd/ngui binaries in the specified path: $BINARIES_PATH "
17+ exit 1
18+ fi
19+
20+ ssh_cmd=" ssh root@$NAKAMOCHI_IP "
21+
22+ nakamochi_nd_path=" $( $ssh_cmd ' grep -o "/home/uiuser/v[0-9]\.[0-9]\.[0-9]" /etc/sv/nd/run | head -n 1' ) "
23+ if [[ -z $nakamochi_nd_path ]]; then
24+ echo " Could not determine Nakamochi nd installation path."
25+ exit 1
26+ fi
27+
28+ $ssh_cmd " sha256sum $nakamochi_nd_path /*; sv stop nd" || { echo " Failed to stop nd service" ; exit 1; }
29+ scp " $BINARIES_PATH /nd" " root@$NAKAMOCHI_IP :$nakamochi_nd_path /nd" || { echo " Failed to copy nd binary" ; exit 1; }
30+ scp " $BINARIES_PATH /ngui" " root@$NAKAMOCHI_IP :$nakamochi_nd_path /ngui" || { echo " Failed to copy ngui binary" ; exit 1; }
31+ $ssh_cmd " sha256sum $nakamochi_nd_path /*; sv start nd; grep ndg /var/log/socklog/daemon/current | tail" || { echo " Failed to start nd service" ; exit 1; }
32+
33+ echo " Nakamochi NDG update completed."
You can’t perform that action at this time.
0 commit comments