@@ -19,6 +19,8 @@ INSTALL_SENTINEL=${INSTALLSENTINEL:-false}
19
19
INSTALL_TFSEC=${INSTALLTFSEC:- false}
20
20
INSTALL_TERRAFORM_DOCS=${INSTALLTERRAFORMDOCS:- false}
21
21
CUSTOM_DOWNLOAD_SERVER=" ${CUSTOMDOWNLOADSERVER:- " " } "
22
+ # This is because ubuntu noble and debian trixie don't support the old format of GPG keys and validation
23
+ NEW_GPG_CODENAMES=" trixie noble"
22
24
23
25
TERRAFORM_SHA256=" ${TERRAFORM_SHA256:- " automatic" } "
24
26
TFLINT_SHA256=" ${TFLINT_SHA256:- " automatic" } "
@@ -50,13 +52,11 @@ if [ "$(id -u)" -ne 0 ]; then
50
52
exit 1
51
53
fi
52
54
53
- # Detect Ubuntu Noble and use new repo setup, else use legacy GPG logic
54
- IS_NOBLE=0
55
- if grep -qi ' ubuntu' /etc/os-release; then
56
- . /etc/os-release
57
- if [[ " $VERSION_CODENAME " == " noble" ]]; then
58
- IS_NOBLE=1
59
- fi
55
+ # Detect Ubuntu Noble or Debian Trixie and use new repo setup, else use legacy GPG logic
56
+ IS_GPG_NEW=0
57
+ . /etc/os-release
58
+ if [[ " ${NEW_GPG_CODENAMES} " == * " ${VERSION_CODENAME} " * ]]; then
59
+ IS_GPG_NEW=1
60
60
fi
61
61
62
62
# Get the list of GPG key servers that are reachable
@@ -112,7 +112,7 @@ receive_gpg_keys() {
112
112
chmod 700 ${GNUPGHOME}
113
113
114
114
# Special handling for HashiCorp GPG key on Ubuntu Noble
115
- if [ " $IS_NOBLE " -eq 1 ] && [ " $keys " = " $TERRAFORM_GPG_KEY " ]; then
115
+ if [ " $IS_GPG_NEW " -eq 1 ] && [ " $keys " = " $TERRAFORM_GPG_KEY " ]; then
116
116
echo " (*) Ubuntu Noble detected, using Keybase for HashiCorp GPG key import...."
117
117
curl -fsSL https://keybase.io/hashicorp/pgp_keys.asc | gpg --import
118
118
if ! gpg --list-keys " ${TERRAFORM_GPG_KEY} " > /dev/null 2>&1 ; then
@@ -400,7 +400,7 @@ verify_signature() {
400
400
401
401
receive_gpg_keys " $gpg_key "
402
402
verify_result=$?
403
- if [ $verify_result -ne 0 ] && [ " $IS_NOBLE " -eq 1 ]; then
403
+ if [ $verify_result -ne 0 ] && [ " $IS_GPG_NEW " -eq 1 ]; then
404
404
echo " Skipping the gpg key validation for ubuntu noble as unable to import the key."
405
405
return 1
406
406
fi
429
429
if [ " ${TERRAFORM_SHA256} " != " dev-mode" ]; then
430
430
if [ " ${TERRAFORM_SHA256} " = " automatic" ]; then
431
431
# For Ubuntu Noble, try GPG verification but continue if it fails
432
- if [ " $IS_NOBLE " -eq 1 ]; then
432
+ if [ " $IS_GPG_NEW " -eq 1 ]; then
433
433
echo " (*) Ubuntu Noble detected - attempting GPG verification with fallback..."
434
434
set +e
435
435
sha256sums_url=" ${HASHICORP_RELEASES_URL} /terraform/${TERRAFORM_VERSION} /terraform_${TERRAFORM_VERSION} _SHA256SUMS"
@@ -543,7 +543,7 @@ if [ "${INSTALL_SENTINEL}" = "true" ]; then
543
543
if [ " ${SENTINEL_SHA256} " != " dev-mode" ]; then
544
544
if [ " ${SENTINEL_SHA256} " = " automatic" ]; then
545
545
# For Ubuntu Noble, try GPG verification but continue if it fails
546
- if [ " $IS_NOBLE " -eq 1 ]; then
546
+ if [ " $IS_GPG_NEW " -eq 1 ]; then
547
547
echo " (*) Ubuntu Noble detected - attempting Sentinel GPG verification with fallback..."
548
548
set +e
549
549
sha256sums_url=" ${sentinel_releases_url} /${SENTINEL_VERSION} /sentinel_${SENTINEL_VERSION} _SHA256SUMS"
0 commit comments