mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
35 lines
616 B
Bash
Executable File
35 lines
616 B
Bash
Executable File
#!/bin/bash
|
|
|
|
source .env
|
|
|
|
if [ -z "$BLOG_ENDPOINT" ]; then
|
|
echo "BLOG_ENDPOINT is not set in the .env file"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$GIT_WORK_DIR" ]; then
|
|
echo "GIT_WORK_DIR is not set in the .env file"
|
|
exit 1
|
|
fi
|
|
|
|
check_for_updates() {
|
|
cd "$GIT_WORK_DIR" || exit
|
|
res=$(git pull)
|
|
if echo "$res" | grep -q "Already up to date"; then
|
|
echo "Repo is up to date."
|
|
else
|
|
echo "Repo has updated"
|
|
fi
|
|
}
|
|
|
|
if [ -d "$GIT_WORK_DIR" ]; then
|
|
check_for_updates
|
|
else
|
|
git clone "$BLOG_ENDPOINT" "$GIT_WORK_DIR"
|
|
if [ $? -eq 0 ]; then
|
|
check_for_updates
|
|
else
|
|
echo "Failed to clone the repo"
|
|
fi
|
|
fi
|