31 lines
933 B
Bash
Executable File
31 lines
933 B
Bash
Executable File
#!/bin/bash
|
|
ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )
|
|
CONFIG_FILE="$ENV_DIR/.systems"
|
|
source $ENV_DIR/bin/messages
|
|
|
|
# Check if .systems configuration exists
|
|
if [ ! -f "$CONFIG_FILE" ]; then
|
|
errormsg "$CONFIG_FILE not found."
|
|
exit 1
|
|
fi
|
|
|
|
# Iterate through all lines in .systems configuration
|
|
while IFS=' ' read -r IDENTIFIER DIRECTORY GIT; do
|
|
# Skip comments and emtpy lines
|
|
if [[ "$IDENTIFIER" =~ ^#.* ]] || [ -z "$IDENTIFIER" ]; then
|
|
continue
|
|
fi
|
|
|
|
SYSTEM_PATH="$ENV_DIR/systems/$DIRECTORY"
|
|
DIRECTORY="./systems/$DIRECTORY"
|
|
|
|
# Check if system directory already exists
|
|
if [ ! -d "$SYSTEM_PATH" ]; then
|
|
infomsg "[$IDENTIFIER] Clone into directory '$DIRECTORY'..."
|
|
git clone -b develop "$GIT" "$SYSTEM_PATH"
|
|
successmsg "Successfully cloned $IDENTIFIER"
|
|
else
|
|
warnmsg "[$IDENTIFIER] Directory '$DIRECTORY' already exists. Skipping..."
|
|
fi
|
|
done < "$CONFIG_FILE"
|