summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2016-08-04 21:38:20 +0200
committerlassulus <lass@aidsballs.de>2016-08-04 21:38:20 +0200
commit37d53d7b2578106b3d2c53650bfad0e9d5489fbd (patch)
treee3c61342a43abc82ab00cc35eee591dc98ef69e6
parent6696a9f09846adcc059a29566c949afc518b7574 (diff)
parent048986e09bfe9195ccd434c4c143d374db5488d2 (diff)
Merge remote-tracking branch 'cd/master'
-rw-r--r--Makefile7
-rw-r--r--krebs/5pkgs/logf/default.nix26
-rw-r--r--tv/5pkgs/q/default.nix3
3 files changed, 27 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 3857a2390..4fa5bc885 100644
--- a/Makefile
+++ b/Makefile
@@ -130,7 +130,12 @@ $(error bad method: $(method))
endif
endif
test: ssh ?= ssh
+ifeq ($(target_user)@$(target_host),$(LOGNAME)@$(HOSTNAME))
+test: wrapper = exec
+else
+test: wrapper = $(ssh) $(target_user)@$(target_host) -p $(target_port)
+endif
test: populate
- $(ssh) $(target_user)@$(target_host) -p $(target_port) \
+ $(wrapper) \
$(command) --show-trace -I $(target_path) \
-A config.system.build.toplevel $(target_path)/stockholm
diff --git a/krebs/5pkgs/logf/default.nix b/krebs/5pkgs/logf/default.nix
index 246e4d954..d9eae0a4a 100644
--- a/krebs/5pkgs/logf/default.nix
+++ b/krebs/5pkgs/logf/default.nix
@@ -14,23 +14,27 @@ let
"5" = 255; # notice
"6" = 250; # info
"7" = 139; # debug
+ "-" = 005; # undefined priority
};
+ default-urgent = pkgs.writeJSON "logf.default-urgent.json" [
+ ];
in
pkgs.writeDashBin "logf" ''
- export LOGF_HOST_COLORS LOGF_PRIO_COLORS
+ export LOGF_HOST_COLORS LOGF_PRIO_COLORS LOGF_URGENT
LOGF_HOST_COLORS=$(cat "''${LOGF_HOST_COLORS-${default-host-colors}}")
LOGF_PRIO_COLORS=$(cat "''${LOGF_PRIO_COLORS-${default-prio-colors}}")
+ LOGF_URGENT=$(cat "''${LOGF_URGENT-${default-urgent}}")
printf '%s\0' "$@" \
| ${pkgs.findutils}/bin/xargs -0 -P 0 -n 1 ${pkgs.writeDash "logf-remote" ''
- target=$1 \
- target_host=$(echo "$1" | sed 's/^.*@//;s/\..*//') \
- exec 3>&1;
+ target=$1
+ target_host=$(echo "$1" | sed 's/^.*@//;s/\..*//')
+ exec 3>&1
2>&1 1>&3 ssh "$target" -T \
-o PreferredAuthentications=publickey \
-o StrictHostKeyChecking=yes \
exec journalctl -af -n 0 -o json \
- | stdbuf -oL jq -Rf ${pkgs.writeJq "logf-remote-error.jq" ''
+ | stdbuf -oL jq -Rcf ${pkgs.writeJq "logf-remote-error.jq" ''
{
PRIORITY: "4",
MESSAGE: .,
@@ -40,9 +44,11 @@ pkgs.writeDashBin "logf" ''
sleep 10m
exec "$0" "$@"
''} \
- | ${pkgs.jq}/bin/jq -rf ${pkgs.writeJq "logf-filter.jq" ''
+ | ${pkgs.jq}/bin/jq -Rrf ${pkgs.writeJq "logf-filter.jq" ''
(env.LOGF_HOST_COLORS | fromjson) as $host_colors |
(env.LOGF_PRIO_COLORS | fromjson) as $prio_colors |
+ (env.LOGF_URGENT | fromjson | map("(\(.))") | join("|"))
+ as $urgent_regex |
def when(c; f): if c then f else . end;
@@ -88,10 +94,14 @@ pkgs.writeDashBin "logf" ''
as $prio_c |
.MESSAGE
| sub("\r$"; "")
- | agsub("\\btv@nomic\\b"; "\(.)\u0007" | col(fg(219); $prio_c))
- #| agsub("Start queue"; "\(.)\u0007" | col(fg(42); $prio_c))
+ | agsub($urgent_regex; "\(.)\u0007" | col(fg(219); $prio_c))
| col($prio_c);
+ try fromjson catch {
+ _SOURCE_REALTIME_TIMESTAMP: now | tostring | sub("[.]"; ""),
+ SYSLOG_IDENTIFIER: "logf/journalctl",
+ MESSAGE: .,
+ } |
[ p_time
, p_host
diff --git a/tv/5pkgs/q/default.nix b/tv/5pkgs/q/default.nix
index eeb600300..b19402fa4 100644
--- a/tv/5pkgs/q/default.nix
+++ b/tv/5pkgs/q/default.nix
@@ -190,4 +190,7 @@ pkgs.writeBashBin "q" ''
(${q-thermal_zone}) &
wait
${q-todo}
+ if [ "$PWD" != "$HOME" ]; then
+ (HOME=$PWD; ${q-todo})
+ fi
''