Move entrypoint script to common/bin directory

Also, finalized stuff, KEK.
This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-08-29 21:36:14 +08:00 committed by GitHub
parent fb09922bbf
commit 7e4554cf70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 7 deletions

View File

@ -0,0 +1,19 @@
#!/bin/bash
LOGGER_TARGET_FILE="/var/tests/exec-log.txt"
if [[ $LOG_EVERYTHING == "" || $LOG_EVERYTHING == "false" ]]; then
exec "$@"
fi
# based on https://gitlab.com/friendly-telegram/friendly-telegram/-/blob/master/install.sh#L43-49, but a bit modified
# for our use case
log() {
# Runs the arguments and spins once per line of stdout (tee'd to logfile), also piping stderr to logfile
{ "$@" 2>>$LOGGER_TARGET_FILE || return $?; } | while read -r line; do
spin
printf "%s\n" "$line" >> $LOGGER_TARGET_FILE
done
}
log "$@"

View File

@ -1,7 +0,0 @@
#!/bin/bash
LOGGER_TARGET_FILE="/var/tests/exec-log.txt"
if [[ $LOG_EVERYTHING == "" || $LOG_EVERYTHING == "false" ]]; then
exec "$@"
fi