2024-08-14 10:49:54 +05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-09-21 04:46:52 +05:00
|
|
|
LIST_FILE="./push.list"
|
|
|
|
ENV_FILE="./push.env"
|
|
|
|
|
|
|
|
echo "Checking for a push.list file..."
|
|
|
|
if [ ! -f "$LIST_FILE" ]; then
|
|
|
|
echo "File $LIST_FILE not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Including a file with environment variables..."
|
|
|
|
if [ -f $ENV_FILE ]; then
|
|
|
|
source $ENV_FILE
|
|
|
|
else
|
|
|
|
echo "File install.env not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Reading a list file and creating repositories..."
|
|
|
|
OLDIFS=$IFS
|
|
|
|
IFS=' | '
|
|
|
|
while read -r NAME_REPO DESCRIPTION_REPO; do
|
|
|
|
if [ "$NAME_REPO" != "NAME_REPO" ]; then # Skip title
|
|
|
|
cd /data/$NAME_REPO
|
|
|
|
git remote remove ${GIT_REMOTE_PREFIX}$NAME_REPO
|
|
|
|
git remote add ${GIT_REMOTE_PREFIX}$NAME_REPO git@$GIT_HOST:$GIT_NAME/$NAME_REPO.git
|
|
|
|
git add -A
|
|
|
|
git commit -m autocommit
|
|
|
|
git push ${GIT_REMOTE_PREFIX}$NAME_REPO $GIT_BRANCH
|
|
|
|
fi
|
|
|
|
done < "$LIST_FILE"
|
|
|
|
IFS=$OLDIFS
|
|
|
|
|
|
|
|
echo "Push complete"
|