Fixup scripts to set up a new CI node (#9348)
* Clean up node setup scripts for new CI boxes * Move files under ci directory * Set CUDA env var to setup cuda drivers * Fixup and add README * shellcheck * Apply review feedback, rename dir and setup files Co-authored-by: publish-docs.sh <maintainers@solana.com>
This commit is contained in:
16
ci/setup-new-buildkite-agent/utils.sh
Executable file
16
ci/setup-new-buildkite-agent/utils.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We need root access, but also appropriate envvar values. Require scripts to
|
||||
# run with sudo as a normal user
|
||||
ensure_env() {
|
||||
RC=false
|
||||
[ $EUID -eq 0 ] && [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ] && RC=true
|
||||
if $RC; then
|
||||
export SETUP_USER="$SUDO_USER"
|
||||
export SETUP_HOME="$HOME"
|
||||
else
|
||||
echo "Please run \"$0\" via sudo as a normal user"
|
||||
fi
|
||||
$RC
|
||||
}
|
||||
|
Reference in New Issue
Block a user