From b2c636c446f3d8744ee93331a3d7681c59402499 Mon Sep 17 00:00:00 2001 From: Yannik Enss Date: Tue, 20 Jul 2021 10:20:22 +0200 Subject: [PATCH] get uvproto dynamically from a script, also show if protos have TODOs --- generator.conf.example | 1 + get_uvproto.sh | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100755 get_uvproto.sh diff --git a/generator.conf.example b/generator.conf.example index 98eda6e..c1787ff 100644 --- a/generator.conf.example +++ b/generator.conf.example @@ -17,6 +17,7 @@ pre_tops: {% endfor %}' - title: Unveröffentlichte Protokolle file: "data/uvproto.txt" + command: ./get_uvproto.sh body: "* FSR-Protokoll vom {{last_date|date}}" - title: Berichte protostub: diff --git a/get_uvproto.sh b/get_uvproto.sh new file mode 100755 index 0000000..a0cf45d --- /dev/null +++ b/get_uvproto.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -e + +: "${FSR_GEN_SSH_TO:=fsmi-login.fsmi.uni-karlsruhe.de}" +: "${FSR_GEN_SSH:=$(test "$(hostname -d)" = "fsmi.uni-karlsruhe.de" || echo 1)}" + +QUERY="select '* FSR-Protokoll vom '||datum|| case when protokoll like '%TODO%' then ' (hat noch TODOs)' else '' end from protokolle where ist_veroeffentlicht=false and name is null order by datum asc" + +cmd="psql --no-align --tuples-only service=fsmi -c \"$QUERY\"" + +if [ -z "$FSR_GEN_SSH" ] || [ "$FSR_GEN_SSH" -eq 0 ]; then + raw_proto="$(sh -c "$cmd")" +else + raw_proto="$(ssh -- "$FSR_GEN_SSH_TO" "$cmd")" +fi + +echo "$raw_proto"