From d28aa067c8211eeff31a3c415b057d41ae54b01c Mon Sep 17 00:00:00 2001
From: Adithya Balakumar <Adithya.Balakumar@toshiba-tsip.com>
Date: Mon, 14 Jul 2025 08:25:28 -0400
Subject: [PATCH] setupcon: Copy temp files into /etc/console-setup with fixed
 name

Currently when using the --setup-dir option, a temp file is copied to /etc/console-setup,
But the filename is random due to use of mktemp for the temp file creation.

This creates reproducibility issues due to different temp filenames across
multiple builds.

Attempt to solve this by copying the temp file into /etc/console-setup
with a fixed file name

Solves #977877

Signed-off-by: Adithya Balakumar <Adithya.Balakumar@toshiba-tsip.com>
---
 setupcon | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/setupcon b/setupcon
index b3df2f4..0195a65 100755
--- a/setupcon
+++ b/setupcon
@@ -1253,6 +1253,10 @@ if [ "$setupdir" ]; then
                         if [ -f "$arg" ]; then
                             f="${arg##*/}"
                             f="${f%.gz}"
+                            if echo "$f" | grep -q "^tmpkbd\."; then
+                                f=$(echo $f | sed 's/\..*//')
+                                f="$f.fixed"
+                            fi
                             case "$arg" in
                                 *.gz) zcat "$arg" >"$setupdir/etc/console-setup/$f" ;;
                                 *) cp -a "$arg" "$setupdir/etc/console-setup/$f" ;;
-- 
2.39.5

