summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpennae <pennae.git@eno.space>2023-09-27 17:46:33 +0200
committerpennae <pennae.git@eno.space>2023-09-27 21:40:46 +0200
commit277569bfc04a577a189e87b82ef78a51e8f988ee (patch)
tree98713bdb7db6ba6c7b63810e6477c097cad78b85
parentc074dab95ffa2fc31a15b6ade1d14009e2087a29 (diff)
downloaddewclaw-277569bfc04a577a189e87b82ef78a51e8f988ee.tar.gz
dewclaw-277569bfc04a577a189e87b82ef78a51e8f988ee.tar.xz
dewclaw-277569bfc04a577a189e87b82ef78a51e8f988ee.zip
don't provide log formats as environments
environments work, but this seems a little less fragile.
-rw-r--r--openwrt/config_generation.sh11
-rw-r--r--openwrt/default.nix5
2 files changed, 8 insertions, 8 deletions
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 </dev/null 2>&1 \
- | logger -t '"$TAG" &
+ ssh '/etc/init.d/config_generation apply </dev/null 2>&1 | logger -t '"$TAG" &
ssh 'logread -l9999 -f' | awk -v FS="$TAG: " '$2 { print $2 }' || true
log 'waiting for device to return'