This commit is contained in:
Flo 2024-12-21 02:40:06 +01:00
parent 669a6f9b33
commit 9dde2c0aeb
4 changed files with 40 additions and 8 deletions

11
.gitignore vendored
View File

@ -1,10 +1,11 @@
.alias
.systems
bin/cron/
var/
docker/letsencrypt*
docker/docker-compose.yml
systems/*
var/
script/clone
.alias
.systems

3
docker/.gitignore vendored
View File

@ -1,3 +0,0 @@
letsencrypt/*
docker-compose-mac.yml
docker-compose.yml

34
script/clone Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )
CONFIG_FILE="$ENV_DIR/.systems"
source $ENV_DIR/bin/denv_msg
# Check if .systems configuration exists
if [ ! -f "$CONFIG_FILE" ]; then
denv_error_msg "$CONFIG_FILE not found."
exit 1
fi
denv_info_msg "[dev-env]: Cloning all systems defined in $CONFIG_FILE"
# 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
denv_info_msg "System $IDENTIFIER"
DIRECTORY="systems/$DIRECTORY"
# Check if system directory already exists
if [ ! -d "$DIRECTORY" ]; then
denv_info_msg "Clone into directory '$DIRECTORY'..."
git clone "$GIT" "$DIRECTORY"
denv_success_msg "Successfully cloned $IDENTIFIER"
else
denv_echo_msg "Directory '$DIRECTORY' already exists. Skipping..."
fi
echo ""
done < "$CONFIG_FILE"