Fix grep reference from coreutils

This commit is contained in:
Arnie 2025-07-17 15:44:33 +02:00
parent a7feabf2b8
commit 409a96c224
No known key found for this signature in database
GPG Key ID: 4BDFA3BCF2999D11

View File

@ -47,13 +47,13 @@ in
# Strip account ID and hash up to the region part
URL="''${URL#*\.}"
PROFILE=$(${pkgs.coreutils}/bin/grep "sso_account_id = $ACCOUNT_ID" ~/.aws/config -B 5 | ${pkgs.coreutils}/bin/grep "\[profile" | ${pkgs.coreutils}/bin/tail -n 1 | ${pkgs.coreutils}/bin/tr -d '[]')
PROFILE=$(${pkgs.gnugrep}/bin/grep "sso_account_id = $ACCOUNT_ID" ~/.aws/config -B 5 | ${pkgs.gnugrep}/bin/grep "\[profile" | ${pkgs.coreutils}/bin/tail -n 1 | ${pkgs.coreutils}/bin/tr -d '[]')
PROFILE="''${PROFILE#profile }"
ROLE_NAME=$(${pkgs.awscli2}/bin/aws configure get profile.$PROFILE.sso_role_name)
SSO_SESSION=$(${pkgs.awscli2}/bin/aws configure get profile.$PROFILE.sso_session)
SSO_URL=$(${pkgs.coreutils}/bin/grep "\[sso-session $SSO_SESSION" ~/.aws/config -A5 | ${pkgs.coreutils}/bin/grep sso_start_url | ${pkgs.coreutils}/bin/head -n 1)
SSO_URL=$(${pkgs.gnugrep}/bin/grep "\[sso-session $SSO_SESSION" ~/.aws/config -A5 | ${pkgs.gnugrep}/bin/grep sso_start_url | ${pkgs.coreutils}/bin/head -n 1)
SSO_URL="''${SSO_URL#sso_start_url = }"
# Strip trailing slash from SSO_URL if present
SSO_URL="''${SSO_URL%/}"