Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd-init: use sudo when creating src/config.json #3505

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/cmd-init
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,14 @@ if [[ -n "${VARIANT}" ]] && [[ "${VARIANT}" != "default" ]]; then
fatal "Could not find the manifests (${manifest} & ${image}) for the '${VARIANT}' variant"
fi
echo "Using variant: '${VARIANT}'"
cat > "src/config.json" <<EOF
# Use sudo if we have privileges as we've seen some permissions
# issues creating this file when running on local developer workstations
if has_privileges; then
tee_cmd='sudo tee'
else
tee_cmd='tee'
fi
$tee_cmd "src/config.json" <<EOF
{
"coreos-assembler.config-variant": "${VARIANT}"
}
Expand Down