From 04cb0a9f045551897c3b72ea353a911ccbaa3090 Mon Sep 17 00:00:00 2001 From: Ryan Lahfa Date: Sat, 31 Aug 2024 22:22:00 +0200 Subject: [PATCH] feat(scripts): add liminix-oriented scripts - extraction for manual recovery via nandwrite - liminix rebuild to interactively develop the AP Signed-off-by: Ryan Lahfa --- .../extract-firmware-from-zyxel-nwa-fit.sh | 12 ++++++ scripts/liminix-rebuild.sh | 42 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 scripts/extract-firmware-from-zyxel-nwa-fit.sh create mode 100755 scripts/liminix-rebuild.sh diff --git a/scripts/extract-firmware-from-zyxel-nwa-fit.sh b/scripts/extract-firmware-from-zyxel-nwa-fit.sh new file mode 100755 index 0000000..12a8cd2 --- /dev/null +++ b/scripts/extract-firmware-from-zyxel-nwa-fit.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p ubootTools + +usage() { + echo "extract the firmware part to write it manually from a Zyxel NWA FIT image" + echo "$0 " +} + +ZYXEL_NWA_FIT="$1" +FIRMWARE_OUTPUT="$2" + +dumpimage -T flat_dt -p 0 $ZYXEL_NWA_FIT -o $FIRMWARE_OUTPUT diff --git a/scripts/liminix-rebuild.sh b/scripts/liminix-rebuild.sh new file mode 100755 index 0000000..1e36a84 --- /dev/null +++ b/scripts/liminix-rebuild.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +ssh_command=${SSH_COMMAND-ssh} + +reboot="reboot" + +case "$1" in + "--no-reboot") + unset reboot + shift + ;; + "--fast") + reboot="soft" + shift + ;; +esac + +target_host=$1 +shift + +if [ -z "$target_host" ] ; then + echo Usage: liminix-rebuild \[--no-reboot\] target-host params + exit 1 +fi + +if toplevel="$@"; then + echo systemConfiguration $toplevel + min-copy-closure $target_host $toplevel + $ssh_command $target_host $toplevel/bin/install + case "$reboot" in + reboot) + $ssh_command $target_host "sync; source /etc/profile; reboot" + ;; + soft) + $ssh_command $target_host $toplevel/bin/restart-services + ;; + *) + ;; + esac +else + echo Rebuild failed +fi