add comments in update

This commit is contained in:
Tykayn 2022-10-20 12:52:44 +02:00 committed by tykayn
parent 0ed6e08ab1
commit 79638a18d0
1 changed files with 48 additions and 43 deletions

View File

@ -1,10 +1,19 @@
#!/bin/bash #!/bin/bash
# update all projects # author: @tykayn@mastodon.cipherbliss.com
# list of framagit repos to clone # 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
#
# --------------------------------
declare -a StringArrayFramagit=("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" ) 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" )
declare -a StringArrayForgeChapril=("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") 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")
prefix_framagit='https://framagit.org/tykayn/' prefix_framagit='https://framagit.org/tykayn/'
prefix_forgechapril='https://forge.chapril.org/tykayn/' prefix_forgechapril='https://forge.chapril.org/tykayn/'
@ -16,9 +25,14 @@ mkdir -p $cloning_place
cd $cloning_place cd $cloning_place
echo "Number of items in original list: ${#list[*]}" echo "Number of items in original list: ${#list[*]}"
echo "cloning from framagit"
for folder_name in ${StringArrayFramagit[@]} # 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 do
echo "check project ${folder_name}" echo "check project ${folder_name}"
if [ ! -d $folder_name ] if [ ! -d $folder_name ]
@ -37,27 +51,18 @@ do
git fetch origin git fetch origin
fi fi
done done
# done framagit
for folder_name in ${StringArrayForgeChapril[@]} }
do
echo "check project ${folder_name}"
if [ ! -d $folder_name ]
then
echo "cloning ${folder_name}"
git clone "${prefix_forgechapril}${folder_name}.git"
# test existence of a folder # lancer les clonages et git pull sur chaque dépot
# 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 echo "cloning from framagit"
git fetch origin pullOrCreateRepo $prefix_framagit $list_repos_framagit
fi
done echo "cloning from forge chapril"
pullOrCreateRepo $prefix_forgechapril $list_repos_forge_chapril
# vous pouvez ajouter vos autres dépots et lancer la fonction pullOrCreateRepo
ls -l ls -l
echo "update done" echo "update done"