Automatically detect local repos and update all of them

This commit is contained in:
RealStickman 2022-06-30 15:00:13 +02:00
parent de0181cab8
commit 5ae7dc8cf7

View File

@ -7,70 +7,20 @@ fi
WORKPATH="$HOME/GitProjects" WORKPATH="$HOME/GitProjects"
if [ ! -d "$HOME/GitProjects/config" ]; then readarray -t dirs < <(find "$WORKPATH" -mindepth 1 -maxdepth 1 -type d -printf '%P\n')
git -C $WORKPATH clone git@gitlab.com:RealStickman-arch/config.git
fi
cd "$HOME/GitProjects/config"
git fetch --all
git pull
if [ ! -d "$HOME/GitProjects/grab" ]; then for dir in "${dirs[@]}"; do
git -C $WORKPATH clone git@gitlab.com:RealStickman/grab.git # go into GitProjects directory
fi cd "$WORKPATH"
cd "$HOME/GitProjects/grab" # output directory you're currently working on
git fetch --all printf "Working on ${dir}\n"
git pull # change into that directory
cd "$dir"
: ' # try to check out master or main branch
if [ ! -d "$HOME/GitProjects/powershell-scripting" ]; then git checkout -q master \
git -C $WORKPATH clone git@gitlab.com:RealStickman/powershell-scripting.git || git checkout -q main
fi git fetch --all
cd "$HOME/GitProjects/powershell-scripting" git pull origin
git fetch --all done
git pull
'
if [ ! -d "$HOME/GitProjects/setup" ]; then
git -C $WORKPATH clone git@gitlab.com:RealStickman-arch/setup.git
fi
cd "$HOME/GitProjects/setup"
git fetch --all
git pull
if [ ! -d "$HOME/GitProjects/themes" ]; then
git -C $WORKPATH clone git@gitlab.com:RealStickman-arch/themes.git
fi
cd "$HOME/GitProjects/themes"
git fetch --all
git pull
: '
if [ ! -d "$HOME/GitProjects/setup-pinephone" ]; then
git -C $WORKPATH clone git@gitlab.com:RealStickman/setup-pinephone.git
fi
cd "$HOME/GitProjects/setup-pinephone"
git fetch --all
git pull
'
if [ ! -d "$HOME/GitProjects/website" ]; then
git -C $WORKPATH clone git@gitlab.com:RealStickman/website.git
fi
cd "$HOME/GitProjects/website"
git fetch --all
git pull
if [ ! -d "$HOME/GitProjects/arch-autobuild-pkg" ]; then
git -C $WORKPATH clone git@gitlab.com:arch-pkgbuilds/arch-autobuild-pkg.git
fi
cd "$HOME/GitProjects/arch-autobuild-pkg"
git fetch --all
git pull
if [ ! -d "$HOME/GitProjects/ssh" ]; then
git -C $WORKPATH clone git@gitlab.com:RealStickman/ssh.git
fi
cd "$HOME/GitProjects/ssh"
git fetch --all
git pull
exit 0 exit 0