Skip to content

Commit

Permalink
print container version at container start
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t committed Oct 23, 2023
1 parent e83f013 commit 29e0269
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ RUN set -x && \
/tmp/* \
/var/lib/apt/lists/* \
/.dockerenv \
/git
/git && \
version="$(/usr/sbin/radar -v | sed 's/^.*Version \(.*\)$/\1/g;q')" && \
echo "${version// /_} ($(uname -m))" > /.CONTAINER_VERSION
#
COPY rootfs/ /
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
2 changes: 2 additions & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/99-print-container-version/up
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec /etc/s6-overlay/scripts/99-print-container-version
Empty file.
Empty file.
30 changes: 30 additions & 0 deletions rootfs/etc/s6-overlay/scripts/99-print-container-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/command/with-contenv bash
# shellcheck shell=bash disable=SC1091,SC2015,SC2164,SC2068,SC2145

source /scripts/common
s6wrap=(s6wrap --quiet --timestamps --prepend="$(basename "$0")")

#---------------------------------------------------------------------------------------------
# This repository, docker container, and accompanying scripts and documentation is
# Copyright (C) 2022-2023, Ramon F. Kolb (kx1t)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
# Radar1090 is an ADS-B RADAR Feed Service
# Copyright (C) 2023 by Michael J. Tubby B.Sc. MIET G8TIC [email protected] All Rights Reserved.
# No license to the "radar" binary and its source code is implied; contact the author for information.
#---------------------------------------------------------------------------------------------

# Print container version

"${s6wrap[@]}" --args echo "Container Version: $([[ -f .CONTAINER_VERSION ]] && cat .CONTAINER_VERSION || true))"
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/radar1090-log
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ while true; do
"${s6wrap[@]}" --args echo "------------------------"
"${s6wrap[@]}" --args echo "Traffic statistics over the previous $WAITTIME seconds:"
"${s6wrap[@]}" --args echo "- Total packets received from ${BEASTHOST:-ultrafeeder}: $total_packets"
"${s6wrap[@]}" --args echo "- Duplicate dackets discarded: $total_dupes"
"${s6wrap[@]}" --args echo "- Duplicate packets discarded: $total_dupes"
"${s6wrap[@]}" --args echo "- Average bandwidth used (excluding overhead): $avg_bps bytes/sec"

done

0 comments on commit 29e0269

Please sign in to comment.