-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner
executable file
·39 lines (30 loc) · 930 Bytes
/
runner
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
35
36
37
38
39
#!/bin/bash
# Source all the scripts in .profile.d
for script in ~/.profile.d/*.sh; do
source "$script"
done
# Check if SHELL_COMMAND exists and is not blank
if [[ -n "$SHELL_COMMAND" ]]; then
# Base64 decode the command into a file
echo "$SHELL_COMMAND" | base64 --decode > ./setup_commands.sh
# Make it executable
chmod +x ./setup_commands.sh
# Execute the file directly
./setup_commands.sh
# Print confirmation
echo "Setup commands executed from file"
fi
# For the Python code, also write to file instead of passing as argument
if [[ -n "$CODE" ]]; then
# Decode and write Python code to file
echo "$CODE" | base64 --decode > ./code_to_run.py
# Execute the Python file directly instead of using runner.py
python ./code_to_run.py
# Capture the exit code
exit_code=$?
else
echo "No CODE provided"
exit_code=1
fi
# Print the exit code in the required format
echo "exit_code: $exit_code"