From bec7fa8f9a778389e416449d9bdb4938948212a0 Mon Sep 17 00:00:00 2001 From: leo <426742@gmail.com> Date: Sat, 21 Sep 2024 04:46:52 +0500 Subject: [PATCH] autocommit --- _push-all.sh | 87 ++++++++++++++++++++++++++++++++++++++++ push-all.sh | 110 ++++++++++++++------------------------------------- push.env | 4 ++ push.list | 13 ++++++ 4 files changed, 133 insertions(+), 81 deletions(-) create mode 100644 _push-all.sh create mode 100644 push.env create mode 100644 push.list diff --git a/_push-all.sh b/_push-all.sh new file mode 100644 index 0000000..1113328 --- /dev/null +++ b/_push-all.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +echo "Auto push all dependences..." + +echo "push install..." +cd /data/install +git add -A +git commit -m autocommit +git push install main + +echo "push server-origin..." +cd /data/server-origin +git add -A +git commit -m autocommit +git push server-origin main + +echo "push utils..." +cd /data/utils +git add -A +git commit -m autocommit +git push utils main + +echo "push backup..." +cd /data/backup +git add -A +git commit -m autocommit +git push backup main + +echo "push traefik..." +cd /data/traefik +git add -A +git commit -m autocommit +git push traefik main + + +echo "push postgres..." +cd /data/postgres +git add -A +git commit -m autocommit +git push postgres main + +echo "push pgadmin..." +cd /data/pgadmin +git add -A +git commit -m autocommit +git push pgadmin main + +echo "push gitea..." +cd /data/gitea +git add -A +git commit -m autocommit +git push gitea main + +echo "push gitea-init..." +cd /data/gitea-init +git add -A +git commit -m autocommit +git push gitea-init main + + +echo "push mariadb..." +cd /data/mariadb +git add -A +git commit -m autocommit +git push mariadb main + +echo "push blog-wp..." +cd /data/blog-wp +git add -A +git commit -m autocommit +git push blog-wp main + +echo "push blog-wp-install..." +cd /data/blog-wp-install +git add -A +git commit -m autocommit +git push blog-wp-install main + + +echo "push tetris..." +cd /data/tetris +git add -A +git commit -m autocommit +git push tetris main + + +echo "Push server-origin complete" \ No newline at end of file diff --git a/push-all.sh b/push-all.sh index 1113328..14267de 100644 --- a/push-all.sh +++ b/push-all.sh @@ -1,87 +1,35 @@ #!/bin/bash -echo "Auto push all dependences..." +LIST_FILE="./push.list" +ENV_FILE="./push.env" -echo "push install..." -cd /data/install -git add -A -git commit -m autocommit -git push install main +echo "Checking for a push.list file..." +if [ ! -f "$LIST_FILE" ]; then + echo "File $LIST_FILE not found" + exit 1 +fi -echo "push server-origin..." -cd /data/server-origin -git add -A -git commit -m autocommit -git push server-origin main +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 "push utils..." -cd /data/utils -git add -A -git commit -m autocommit -git push utils main +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 backup..." -cd /data/backup -git add -A -git commit -m autocommit -git push backup main - -echo "push traefik..." -cd /data/traefik -git add -A -git commit -m autocommit -git push traefik main - - -echo "push postgres..." -cd /data/postgres -git add -A -git commit -m autocommit -git push postgres main - -echo "push pgadmin..." -cd /data/pgadmin -git add -A -git commit -m autocommit -git push pgadmin main - -echo "push gitea..." -cd /data/gitea -git add -A -git commit -m autocommit -git push gitea main - -echo "push gitea-init..." -cd /data/gitea-init -git add -A -git commit -m autocommit -git push gitea-init main - - -echo "push mariadb..." -cd /data/mariadb -git add -A -git commit -m autocommit -git push mariadb main - -echo "push blog-wp..." -cd /data/blog-wp -git add -A -git commit -m autocommit -git push blog-wp main - -echo "push blog-wp-install..." -cd /data/blog-wp-install -git add -A -git commit -m autocommit -git push blog-wp-install main - - -echo "push tetris..." -cd /data/tetris -git add -A -git commit -m autocommit -git push tetris main - - -echo "Push server-origin complete" \ No newline at end of file +echo "Push complete" \ No newline at end of file diff --git a/push.env b/push.env new file mode 100644 index 0000000..d4f5a35 --- /dev/null +++ b/push.env @@ -0,0 +1,4 @@ +GIT_HOST=rozenlab.com +GIT_NAME=leo +GIT_REMOTE_PREFIX="" +GIT_BRANCH=main diff --git a/push.list b/push.list new file mode 100644 index 0000000..e17fea9 --- /dev/null +++ b/push.list @@ -0,0 +1,13 @@ +NAME_REPO | DESCRIPTION_REPO +utils | shell utils +install | first initialize server +traefik | Traefik Docker configuration +gitea | Gitea Docker configuration +backup | Backup all databases & files +server-origin | Head site, repositories, etc +blog-wp | Wordpress dev blog +blog-wp-install | Init wordpress blog +mariadb | Docker Mariadb for Wordpress dev blog +gitea-init | Create all repos of origin in Gitea +postgres | Docker postgres for traefik +pgadmin | Docker pgadmin for traefik