Skip to content

Commit e44c301

Browse files
committed
init: suppress /etc/config.user not existing on grep calls
Signed-off-by: Thierry Laurion <[email protected]>
1 parent 8594f3a commit e44c301

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

initrd/init

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ if [ "$CONFIG_LINUXBOOT" = "y" ]; then
125125
fi
126126

127127
# Set GPG_TTY before calling gpg in key-init
128+
#TODO: do better then this; on dual console gpg only interacts with main console (affects Talos-2 and all whiptail variants)
128129
export GPG_TTY=/dev/console
129130

130131
# Initialize gpnupg with distro/user keys and setup the keyrings
@@ -144,10 +145,10 @@ fi
144145
# changing the value for the rest of the scripts which source /tmp/config.
145146

146147
#Only set CONFIG_TPM and CONFIG_TPM2_TOOLS if they are not already set in /etc/config.user
147-
if ! grep -q 'CONFIG_TPM=' /etc/config.user; then
148+
if ! grep -q 'CONFIG_TPM=' /etc/config.user 2>/dev/null; then
148149
echo "export CONFIG_TPM=\"$CONFIG_TPM\"" >> /etc/config.user
149150
fi
150-
if ! grep -q 'CONFIG_TPM2_TOOLS=' /etc/config.user; then
151+
if ! grep -q 'CONFIG_TPM2_TOOLS=' /etc/config.user 2> /dev/null; then
151152
echo "export CONFIG_TPM2_TOOLS=\"$CONFIG_TPM2_TOOLS\"" >> /etc/config.user
152153
fi
153154

0 commit comments

Comments
 (0)