From 305a3a06d2b12b4e05328462e829901a3bbf508c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 12 Apr 2023 11:22:27 -0400 Subject: [PATCH] Ensure $HOME is set during firstboot systemd tends not to set environment variables. However some firstboot scripts generally expect $HOME to be correct. --- .../el7-diskless/profiles/default/scripts/firstboot.sh | 2 ++ confluent_osdeploy/el7/profiles/default/scripts/firstboot.sh | 2 ++ .../el8-diskless/profiles/default/scripts/firstboot.sh | 2 ++ confluent_osdeploy/el8/profiles/default/scripts/firstboot.sh | 2 ++ .../el9-diskless/profiles/default/scripts/firstboot.sh | 2 ++ confluent_osdeploy/suse15/profiles/hpc/scripts/firstboot.sh | 2 ++ confluent_osdeploy/suse15/profiles/server/scripts/firstboot.sh | 2 ++ .../ubuntu18.04/profiles/default/scripts/firstboot.sh | 2 ++ .../ubuntu20.04/profiles/default/scripts/firstboot.sh | 3 +++ .../ubuntu22.04/profiles/default/scripts/firstboot.sh | 3 +++ 10 files changed, 22 insertions(+) diff --git a/confluent_osdeploy/el7-diskless/profiles/default/scripts/firstboot.sh b/confluent_osdeploy/el7-diskless/profiles/default/scripts/firstboot.sh index a9654c01..2bab4136 100644 --- a/confluent_osdeploy/el7-diskless/profiles/default/scripts/firstboot.sh +++ b/confluent_osdeploy/el7-diskless/profiles/default/scripts/firstboot.sh @@ -5,6 +5,8 @@ # noted below so custom commands are executed before # the script notifies confluent that install is fully complete. +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}') confluent_apikey=$(cat /etc/confluent/confluent.apikey) confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg|awk '{print $2}') diff --git a/confluent_osdeploy/el7/profiles/default/scripts/firstboot.sh b/confluent_osdeploy/el7/profiles/default/scripts/firstboot.sh index 0fe078ba..73ced187 100644 --- a/confluent_osdeploy/el7/profiles/default/scripts/firstboot.sh +++ b/confluent_osdeploy/el7/profiles/default/scripts/firstboot.sh @@ -1,4 +1,6 @@ #!/bin/sh +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME # This script is executed on the first boot after install has # completed. It is best to edit the middle of the file as diff --git a/confluent_osdeploy/el8-diskless/profiles/default/scripts/firstboot.sh b/confluent_osdeploy/el8-diskless/profiles/default/scripts/firstboot.sh index a9654c01..2bab4136 100644 --- a/confluent_osdeploy/el8-diskless/profiles/default/scripts/firstboot.sh +++ b/confluent_osdeploy/el8-diskless/profiles/default/scripts/firstboot.sh @@ -5,6 +5,8 @@ # noted below so custom commands are executed before # the script notifies confluent that install is fully complete. +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}') confluent_apikey=$(cat /etc/confluent/confluent.apikey) confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg|awk '{print $2}') diff --git a/confluent_osdeploy/el8/profiles/default/scripts/firstboot.sh b/confluent_osdeploy/el8/profiles/default/scripts/firstboot.sh index c343b26f..bcc54719 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/firstboot.sh +++ b/confluent_osdeploy/el8/profiles/default/scripts/firstboot.sh @@ -1,4 +1,6 @@ #!/bin/sh +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME # This script is executed on the first boot after install has # completed. It is best to edit the middle of the file as diff --git a/confluent_osdeploy/el9-diskless/profiles/default/scripts/firstboot.sh b/confluent_osdeploy/el9-diskless/profiles/default/scripts/firstboot.sh index a9654c01..2bab4136 100644 --- a/confluent_osdeploy/el9-diskless/profiles/default/scripts/firstboot.sh +++ b/confluent_osdeploy/el9-diskless/profiles/default/scripts/firstboot.sh @@ -5,6 +5,8 @@ # noted below so custom commands are executed before # the script notifies confluent that install is fully complete. +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}') confluent_apikey=$(cat /etc/confluent/confluent.apikey) confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg|awk '{print $2}') diff --git a/confluent_osdeploy/suse15/profiles/hpc/scripts/firstboot.sh b/confluent_osdeploy/suse15/profiles/hpc/scripts/firstboot.sh index dcb70e0d..23f14579 100644 --- a/confluent_osdeploy/suse15/profiles/hpc/scripts/firstboot.sh +++ b/confluent_osdeploy/suse15/profiles/hpc/scripts/firstboot.sh @@ -1,4 +1,6 @@ #!/bin/bash +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME # This script runs at the end of the final boot, updating status exec >> /var/log/confluent/confluent-firstboot.log diff --git a/confluent_osdeploy/suse15/profiles/server/scripts/firstboot.sh b/confluent_osdeploy/suse15/profiles/server/scripts/firstboot.sh index dcb70e0d..23f14579 100644 --- a/confluent_osdeploy/suse15/profiles/server/scripts/firstboot.sh +++ b/confluent_osdeploy/suse15/profiles/server/scripts/firstboot.sh @@ -1,4 +1,6 @@ #!/bin/bash +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME # This script runs at the end of the final boot, updating status exec >> /var/log/confluent/confluent-firstboot.log diff --git a/confluent_osdeploy/ubuntu18.04/profiles/default/scripts/firstboot.sh b/confluent_osdeploy/ubuntu18.04/profiles/default/scripts/firstboot.sh index 89b4e90a..e960d6e0 100755 --- a/confluent_osdeploy/ubuntu18.04/profiles/default/scripts/firstboot.sh +++ b/confluent_osdeploy/ubuntu18.04/profiles/default/scripts/firstboot.sh @@ -1,5 +1,7 @@ #!/bin/bash echo "Confluent first boot is running" +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME #cp -a /etc/confluent/ssh/* /etc/ssh/ #systemctl restart sshd rootpw=$(grep ^rootpassword: /etc/confluent/confluent.deploycfg |awk '{print $2}') diff --git a/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/firstboot.sh b/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/firstboot.sh index d90d5f7f..d14269cf 100755 --- a/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/firstboot.sh +++ b/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/firstboot.sh @@ -1,5 +1,8 @@ #!/bin/bash echo "Confluent first boot is running" +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME +seems a potentially relevant thing to put i... by Jarrod Johnson cp -a /etc/confluent/ssh/* /etc/ssh/ systemctl restart sshd rootpw=$(grep ^rootpassword: /etc/confluent/confluent.deploycfg |awk '{print $2}') diff --git a/confluent_osdeploy/ubuntu22.04/profiles/default/scripts/firstboot.sh b/confluent_osdeploy/ubuntu22.04/profiles/default/scripts/firstboot.sh index d90d5f7f..d14269cf 100755 --- a/confluent_osdeploy/ubuntu22.04/profiles/default/scripts/firstboot.sh +++ b/confluent_osdeploy/ubuntu22.04/profiles/default/scripts/firstboot.sh @@ -1,5 +1,8 @@ #!/bin/bash echo "Confluent first boot is running" +HOME=$(getent passwd $(whoami)|cut -d: -f 6) +export HOME +seems a potentially relevant thing to put i... by Jarrod Johnson cp -a /etc/confluent/ssh/* /etc/ssh/ systemctl restart sshd rootpw=$(grep ^rootpassword: /etc/confluent/confluent.deploycfg |awk '{print $2}')