From 9bcef17fcda0af5e9aa3dc10916816bb30d36169 Mon Sep 17 00:00:00 2001 From: leo <426742@gmail.com> Date: Fri, 9 Aug 2024 02:45:42 +0500 Subject: [PATCH] create --- create-all.sh | 47 ++++++++++++++++++++++++++++++ push-all.sh | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ repos.list | 14 +++++++++ 3 files changed, 141 insertions(+) create mode 100644 create-all.sh create mode 100644 push-all.sh create mode 100644 repos.list diff --git a/create-all.sh b/create-all.sh new file mode 100644 index 0000000..9901a24 --- /dev/null +++ b/create-all.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +LIST_FILE="./repos.list" +ENV_FILE="/data/secrets/dev.env" + +# Checking for a CSV file +if [ ! -f "$LIST_FILE" ]; then + echo "File $LIST_FILE not found" + exit 1 +fi + +# Including a file with environment variables +if [ -f $ENV_FILE ]; then + source $ENV_FILE +else + echo "File dev.env not found" + exit 1 +fi + +# Checking the presence of a variable GITEA_W_USER_REPO +if [ -z "$GITEA_W_USER_REPO" ]; then + echo "The GITEA_W_USER_REPO variable is not set" + exit 1 +fi + +# Reading a CSV file and creating repositories +OLDIFS=$IFS +IFS=' | ' +while read -r NAME_REPO DESCRIPTION_REPO; do + if [ "$NAME_REPO" != "NAME_REPO" ]; then # Skip title + RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST "https://git.rozenlab.com/api/v1/user/repos" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $GITEA_W_USER_REPO" \ + -d '{ + "name": "'"$NAME_REPO"'", + "private": true, + "description": "'"$DESCRIPTION_REPO"'" + }') + + if [ "$RESPONSE" -eq 201 ]; then + echo "The $NAME_REPO repository has been created successfully" + else + echo "Error creating repository $NAME_REPO. HTTP status: $RESPONSE" + fi + fi +done < "$LIST_FILE" +IFS=$OLDIFS \ No newline at end of file diff --git a/push-all.sh b/push-all.sh new file mode 100644 index 0000000..217a095 --- /dev/null +++ b/push-all.sh @@ -0,0 +1,80 @@ + +# notes +# git@rozenlab.com:leo/notes.git +cd /data/notes +git push notes main + +# ssl-gen +# git@rozenlab.com:leo/ssl-gen.git +cd /data/ssl-gen +git push ssl-gen main + +# utils +# git@rozenlab.com:leo/utils.git +cd /data/utils +git push utils main + +# server-origin +# git@rozenlab.com:leo/server-origin.git +cd /data/server-origin +git push server-origin main + +# backup +# git@rozenlab.com:leo/backup.git +cd /data/backup +git push backup main + +# gitea +# git@rozenlab.com:leo/gitea.git +cd /data/gitea +git push gitea main + +# traefik +# git@rozenlab.com:leo/traefik.git +cd /data/traefik +git push traefik main + +# socks5 +# git@rozenlab.com:leo/socks5.git +cd /data/socks5 +git push socks5 main + +# install +# git@rozenlab.com:leo/install.git +cd /data/install +git push install main + +# server-backup +# git@rozenlab.com:leo/server-backup.git +cd /data/server-backup +git push server-backup main + +# tetris +# git@rozenlab.com:Leo/tetris.git +cd /data/tetris +git push tetris main + +# brickgame +# git@rozenlab.com:leo/brickgame.git +cd /data/brickgame +git push brickgame main + +# blog-frontend +# git@rozenlab.com:leo/blog-frontend.git +cd /data/blog-frontend +git push blog-frontend main + +# nginx-main +# git@rozenlab.com:leo/nginx-main.git +#cd /data/nginx-main +#git push nginx-main main + +# pgadmin +# git@rozenlab.com:leo/pgadmin.git +cd /data/pgadmin +git push pgadmin main + +# postgres +# git@rozenlab.com:leo/postgres.git +cd /data/postgres +git push postgres main \ No newline at end of file diff --git a/repos.list b/repos.list new file mode 100644 index 0000000..44ee37f --- /dev/null +++ b/repos.list @@ -0,0 +1,14 @@ +NAME_REPO | DESCRIPTION_REPO +utils | shell utils +server-backup | init server backup, proxy +install | first initialize server +socks5 | Create dante-server socks5 +traefik | Traefik Docker configuration +gitea | Gitea Docker configuration +backup | Backup all databases & files +server-origin | Head site, repositories, etc +notes | Other notes +ssl-gen | Self signed SSL certs generator +brickgame | Tetris and other games +tetris | Classic Tetris +brickgame | Modular system with several games \ No newline at end of file