Merge pull request #1445 from flatcar/tormath1/gcp-oslogin

gcp: fixed OS Login enabling
This commit is contained in:
Mathieu Tortuyaux 2023-12-01 15:06:49 +01:00 committed by GitHub
commit 586fc12b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1 @@
- GCP: Fixed OS Login enabling ([scripts#1445](https://github.com/flatcar/scripts/pull/1445))

View File

@ -8,6 +8,7 @@ Before=sshd.socket
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/oem/bin/enable-oslogin

View File

@ -232,6 +232,10 @@ insert_include() {
local src_config="${1}" options="${2}" includedir="${3}"
local name copy regexp_options regexp lineno comment_options
if [[ ! "${includedir}" =~ ^/.* ]]; then
die "includir must be an absolute path (i.e, starting with /). Got: ${includedir}"
fi
name=${src_config##*/}
copy="${T}/${name}"
cp -a "${src_config}" "${copy}" || die
@ -251,7 +255,7 @@ insert_include() {
head -n "${lineno}" "${copy}" || die
cat <<-EOF || die
# Make sure that all ${comment_options} options are below this Include!
Include "${EPREFIX}/${includedir}/*.conf"
Include "${EPREFIX}${includedir}/*.conf"
EOF
tail -n "+${lineno}" "${copy}" || die