35 lines
836 B
Bash
35 lines
836 B
Bash
#!/bin/bash
|
|
|
|
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" |