Skip to content

Commit

Permalink
Adds a butler manager script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maaack committed Nov 30, 2023
1 parent 165fd16 commit a3063cb
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Extras/Scripts/butler_manager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# butler managing command

file=upload_destination.txt
directories=("HTML5" "Linux" "Windows" "MacOS")
channels=("html5" "linux" "win" "osx")

# Check if the file exists
if [ ! -e $file ]; then
# File doesn't exist, create an empty one
touch $file
fi

# File exists, read the first line into a variable
read -r destination < $file

if [ -z "$destination" ]; then
# File is empty, prompt the user for input
echo "Please enter the build destination (username/project-url-after-slash)."
read -r user_input

# Save user input to the file
echo "$user_input" > "$file"
echo "Destination saved to $file."
destination="$user_input"
fi

# Check for the existence of directories and print mapped strings
for ((i=0; i<${#directories[@]}; i++)); do
dir="${directories[i]}"
channel="${channels[i]}"

if [ -d "$dir" ]; then
echo butler push ./$dir/ $destination:$channel
butler push ./$dir/ $destination:$channel
else
echo "Directory '$dir' does not exist."
fi
done

0 comments on commit a3063cb

Please sign in to comment.