24 lines
586 B
Bash
24 lines
586 B
Bash
#!/bin/sh
|
|
|
|
# File to check if the user login has already been done
|
|
FLAG_FILE="/root/.user_logged_in"
|
|
|
|
# Check if the flag file exists
|
|
if [ ! -f "$FLAG_FILE" ]; then
|
|
# First command that might require user input
|
|
code tunnel user login --provider microsoft
|
|
|
|
# Check if the previous command succeeded
|
|
if [ $? -eq 0 ]; then
|
|
# Create the flag file to indicate successful login
|
|
touch "$FLAG_FILE"
|
|
else
|
|
echo "Setup failed."
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "User already logged in. Skipping login step."
|
|
fi
|
|
|
|
# Run the second command
|
|
code tunnel
|