forked from AI-Hypercomputer/maxtext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preflight.sh
34 lines (28 loc) · 829 Bytes
/
preflight.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
echo "Running preflight.sh"
# Command Flags:
#
# Example to invoke this script:
# bash preflight.sh
# Warning:
# For any dependencies, please add them into `setup.sh` or `maxtext_dependencies.Dockerfile`.
# You should not install any dependencies in this file.
# Stop execution if any command exits with error
set -e
# Set environment variables
for ARGUMENT in "$@"; do
IFS='=' read -r KEY VALUE <<< "$ARGUMENT"
export "$KEY"="$VALUE"
done
# Check if sudo is available
if command -v sudo >/dev/null 2>&1; then
# sudo is available, use it
echo "running rto_setup.sh with sudo"
# apply network settings.
sudo bash rto_setup.sh
else
# sudo is not available, run the script without sudo
echo "running rto_setup.sh without sudo"
# apply network settings.
bash rto_setup.sh
fi