scripts/update_git_projects.sh

70 lines
2.3 KiB
Bash
Raw Normal View History

2022-07-06 16:06:27 +02:00
#!/bin/bash
2022-10-20 12:52:44 +02:00
# author: @tykayn@mastodon.cipherbliss.com
# website: https://www.cipherbliss.com
#
# update all listed git projects in the home folder/www
# list of framagit repos to clone. Run this command to make it work
# --------------------------------
#
#  cd ~/Téléchargements
# curl -s https://forge.chapril.org/tykayn/scripts/raw/branch/master/update_git_projects.sh | bash
#
# --------------------------------
2022-07-06 16:06:27 +02:00
2022-10-20 12:52:44 +02:00
declare -a list_repos_framagit=("caisse-bliss" "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" )
2022-10-20 12:52:44 +02:00
declare -a list_repos_forge_chapril=("transcription" "org-report-stats" "multi-account-post-schedule-mastodon" "framalibre-scraping" "scripts" "melting-pot" "funky-framadate-front" "rss-feeder-mobilizon" "mastodon-archive-stats" "gtg2json" "libreavous-audio-reader" "osm_my_commerce" "fromage-js" "ueberauth_openstreetmap" "events-liberator")
2022-07-06 16:06:27 +02:00
prefix_framagit='https://framagit.org/tykayn/'
prefix_forgechapril='https://forge.chapril.org/tykayn/'
cloning_place="/home/$USER/www/"
mkdir -p $cloning_place
2022-07-06 16:06:27 +02:00
cd $cloning_place
2022-07-06 22:20:42 +02:00
2022-07-06 16:06:27 +02:00
echo "Number of items in original list: ${#list[*]}"
2022-10-20 12:52:44 +02:00
# fonction qui prend une url de base et une liste de noms de dépots à cloner
function pullOrCreateRepo(){
baseUrl=$1
listOfRepos=$2
for folder_name in ${listOfRepos[@]}
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
fi
done
}
# lancer les clonages et git pull sur chaque dépot
echo "cloning from framagit"
2022-10-20 12:52:44 +02:00
pullOrCreateRepo $prefix_framagit $list_repos_framagit
echo "cloning from forge chapril"
pullOrCreateRepo $prefix_forgechapril $list_repos_forge_chapril
2022-10-20 12:52:44 +02:00
# vous pouvez ajouter vos autres dépots et lancer la fonction pullOrCreateRepo
2022-07-06 16:06:27 +02:00
ls -l
echo "update done"