scripts/update_git_projects.sh
2022-07-06 22:20:42 +02:00

56 lines
1.5 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# update all projects
# list of framagit repos to clone
declare -a StringArray=("caisse-bliss" "duniter" "joinfediverse" "date-poll-api" "mastodon" "peertube" "events-liberator" "gitall" "dotclear-importer" "mobilizon" "fanzine-log" "crossed-words" "generator-tk" "circles" "card-deck" "sf-probe" "mastermind" "portfolio" "time-tracker" "cipherbliss" "caisse-bliss-frontend" "compta" "trafficjam" "ical-generator" "blueprint-cipherbliss" "dotclear2wordpress" "api" "diaspora" )
prefix_framagit='https://framagit.org/tykayn/'
username="${SUDO_USER:-${USER}}"
cloning_place="/home/$username/www/"
echo $cloning_place
#mkdir $cloning_place
cd $cloning_place
git config --global credential.helper store
echo "Number of items in original list: ${#list[*]}"
for folder_name in ${StringArray[@]}
do
echo "check project ${folder_name}"
if [ ! -d $folder_name ]
then
echo "cloning ${folder_name}"
git clone "${prefix_framagit}${folder_name}.git"
# test existence of a folder
# if there is no folder, clone it
# else, update with fetch from origin
else
echo "##### update project $folder_name"
cd $folder_name
git remote -v
git fetch origin
# update dependencies if there is an update script
if [ -f "update.sh" ]
then
echo "update.sh exists"
# bash update.sh
fi
if [ -f "yarn.lock" ]
then
echo "installing yarn packages"
# yarn install --pure-lockfile
# elif [ -f "package.lock" ]
# npm i
fi
cd ..
fi
done
ls -l
echo "update done"