From 277569bfc04a577a189e87b82ef78a51e8f988ee Mon Sep 17 00:00:00 2001 From: pennae Date: Wed, 27 Sep 2023 17:46:33 +0200 Subject: don't provide log formats as environments environments work, but this seems a little less fragile. --- openwrt/config_generation.sh | 11 +++++++---- openwrt/default.nix | 5 +---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'openwrt') diff --git a/openwrt/config_generation.sh b/openwrt/config_generation.sh index c8e9bfa..e119608 100644 --- a/openwrt/config_generation.sh +++ b/openwrt/config_generation.sh @@ -22,6 +22,13 @@ _rollback() { } apply() { + CYAN='\e[36m' + NORMAL='\e[0m' + + log() { + printf "$CYAN>> %s$NORMAL\n" "$*" + } + if ! rm -rf /overlay/upper.prev/ \ || ! cp -al /overlay/upper/ /overlay/upper.prev/ \ || ! rm -rf /overlay/upper.prev/etc/ \ @@ -44,10 +51,6 @@ apply() { trap 'reboot &' EXIT - log() { - printf "$LOG_FMT\n" "$*" - } - if ! ( set -e diff --git a/openwrt/default.nix b/openwrt/default.nix index 4bd00fb..d609760 100644 --- a/openwrt/default.nix +++ b/openwrt/default.nix @@ -174,10 +174,7 @@ let # apply the new config and wait for the box to go down via ssh connection # timeout. log 'applying config' - ssh ' - export LOG_FMT="'"$CYAN"'>> %s'"$NORMAL"'" - /etc/init.d/config_generation apply &1 \ - | logger -t '"$TAG" & + ssh '/etc/init.d/config_generation apply &1 | logger -t '"$TAG" & ssh 'logread -l9999 -f' | awk -v FS="$TAG: " '$2 { print $2 }' || true log 'waiting for device to return' -- cgit v1.2.3