From cf88d7ba7299b3764778aaefae92931d8546094c Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Thu, 16 Jul 2020 19:15:03 -0700 Subject: [PATCH] embed build details into build as splash screen --- Makefile | 16 +++++++++++-- config/buildroot/board/librem13v4/grub.cfg | 10 ++++---- .../buildroot/board/librem13v4/post-build.sh | 7 ++++++ config/buildroot/rootfs_overlay/etc/profile | 24 +++++++++++++++++++ 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 config/buildroot/rootfs_overlay/etc/profile diff --git a/Makefile b/Makefile index b9d9943..193c503 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,16 @@ NAME := airgap IMAGE := local/$(NAME):latest TARGET := librem13v4 GIT_DATETIME := \ - $(shell git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S') -GIT_EPOCH := $(shell git log -1 --format=%at) + $(shell git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S' config) +GIT_REF := $(shell git log -1 --format=%H config) +GIT_AUTHOR := $(shell git log -1 --format=%an config) +GIT_KEY := $(shell git log -1 --format=%GP config) +GIT_EPOCH := $(shell git log -1 --format=%at config) +ifeq ($(strip $(shell git status --porcelain 2>/dev/null)),) + GIT_STATE=clean +else + GIT_STATE=dirty +endif OUT_DIR := build/buildroot/output/images docker = docker executables = $(docker) @@ -95,6 +103,10 @@ contain := \ --env TARGET=$(TARGET) \ --env GIT_DATETIME="$(GIT_DATETIME)" \ --env GIT_EPOCH="$(GIT_EPOCH)" \ + --env GIT_REF="$(GIT_REF)" \ + --env GIT_AUTHOR="$(GIT_AUTHOR)" \ + --env GIT_KEY="$(GIT_KEY)" \ + --env GIT_STATE="$(GIT_STATE)" \ --security-opt seccomp=unconfined \ --volume $(PWD)/build:/home/build/build \ --volume $(PWD)/config:/home/build/config \ diff --git a/config/buildroot/board/librem13v4/grub.cfg b/config/buildroot/board/librem13v4/grub.cfg index 47f3857..d17373d 100644 --- a/config/buildroot/board/librem13v4/grub.cfg +++ b/config/buildroot/board/librem13v4/grub.cfg @@ -1,27 +1,27 @@ set default="0" set timeout="10" -menuentry "Buildroot (qwerty)" { +menuentry "AirgapOS (qwerty)" { linux /boot/bzImage root=/dev/sr0 keymap=qwerty/us initrd /boot/initrd } -menuentry "Buildroot (dvorak)" { +menuentry "AirgapOS (dvorak)" { linux /boot/bzImage root=/dev/sr0 keymap=dvorak initrd /boot/initrd } -menuentry "Buildroot (colemak)" { +menuentry "AirgapOS (colemak)" { linux /boot/bzImage root=/dev/sr0 keymap=colemak/en-latin9 initrd /boot/initrd } -menuentry "Buildroot (qwertz)" { +menuentry "AirgapOS (qwertz)" { linux /boot/bzImage root=/dev/sr0 keymap=qwertz/de initrd /boot/initrd } -menuentry "Buildroot (azerty)" { +menuentry "AirgapOS (azerty)" { linux /boot/bzImage root=/dev/sr0 keymap=azerty/fr initrd /boot/initrd } diff --git a/config/buildroot/board/librem13v4/post-build.sh b/config/buildroot/board/librem13v4/post-build.sh index 5c90c8f..436fe04 100755 --- a/config/buildroot/board/librem13v4/post-build.sh +++ b/config/buildroot/board/librem13v4/post-build.sh @@ -8,4 +8,11 @@ BOARD_DIR="$(dirname $0)" cp -f ${BOARD_DIR}/grub.cfg ${TARGET_DIR}/boot/grub/grub.cfg +echo "export GIT_REF=\"${GIT_REF}\"" > ${TARGET_DIR}/etc/environment +echo "export GIT_AUTHOR=\"${GIT_AUTHOR}\"" >> ${TARGET_DIR}/etc/environment +echo "export GIT_KEY=\"${GIT_KEY}\"" >> ${TARGET_DIR}/etc/environment +echo "export GIT_DATETIME=\"${GIT_DATETIME}\"" >> ${TARGET_DIR}/etc/environment +echo "export GIT_EPOCH=\"${GIT_EPOCH}\"" >> ${TARGET_DIR}/etc/environment +echo "export GIT_STATE=\"${GIT_STATE}\"" >> ${TARGET_DIR}/etc/environment + exit $? diff --git a/config/buildroot/rootfs_overlay/etc/profile b/config/buildroot/rootfs_overlay/etc/profile new file mode 100644 index 0000000..1ed4842 --- /dev/null +++ b/config/buildroot/rootfs_overlay/etc/profile @@ -0,0 +1,24 @@ +export EDITOR=/bin/vi +export PATH="/bin:/sbin:/usr/bin:/usr/sbin" +export PS1="[\h \t] \\$ " +source /etc/environment + +clear +cat << "EOF" + ___ _ _____ _____ + / _ \ (_) | _ / ___| +/ /_\ \_ __ _ __ _ __ _ _ __ | | | \ `--. +| _ | '__| |/ _` |/ _` | '_ \| | | |`--. \ +| | | | | | | (_| | (_| | |_) \ \_/ /\__/ / +\_| |_/_| |_|\__, |\__,_| .__/ \___/\____/ + __/ | | | + |___/ |_| + +EOF +echo "Build Details:" +echo " - Date: $GIT_DATETIME" +echo " - Tree State: $GIT_STATE" +echo " - Committer: $GIT_AUTHOR" +echo " - Commit: $GIT_REF" +echo " - Key: $GIT_KEY" +echo ""