This commit is contained in:
Tykayn 2022-10-20 13:48:10 +02:00 committed by tykayn
parent 81927a720e
commit a36b4a972a
1 changed files with 31 additions and 24 deletions

View File

@ -1,17 +1,21 @@
#!/bin/bash #!/bin/bash
#####################################################
# author: @tykayn@mastodon.cipherbliss.com # author: @tykayn@mastodon.cipherbliss.com
# website: https://www.cipherbliss.com # website: https://www.cipherbliss.com
# #
# update all listed git projects in the home folder/www # update all listed git projects in the home folder/www
# list of framagit repos to clone. Run this command to make it work # list of framagit repos to clone. Run this command to make it work
# -------------------------------- # ------------------------------------------------------------------------------------------------
# #
# cd ~/Téléchargements # cd ~/Téléchargements
# curl -s https://forge.chapril.org/tykayn/scripts/raw/branch/master/update_git_projects.sh | bash # curl -s https://forge.chapril.org/tykayn/scripts/raw/branch/master/update_git_projects.sh | bash
# #
# -------------------------------- # ------------------------------------------------------------------------------------------------
#####################################################
######################################################
# liste de tous les projets pour chaque forge logicielle # liste de tous les projets pour chaque forge logicielle
#####################################################
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 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 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") 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")
@ -19,23 +23,26 @@ prefix_framagit='https://framagit.org/tykayn/'
prefix_forgechapril='https://forge.chapril.org/tykayn/' prefix_forgechapril='https://forge.chapril.org/tykayn/'
cloning_place="/home/$USER/www/" cloning_place="/home/$USER/www/"
cd "$cloning_place" || exit cd $cloning_place
pwd pwd
# fonction qui prend une url de base et une liste de noms de dépots à cloner # fonction qui prend une url de base et une liste de noms de dépots à cloner
# si vous trouvez comment passer facilement un array en argument à une fonction bash, go faire la fonction pour que l'on puisse faire " pullOrCreateRepo base_url liste_de_dépots" # si vous trouvez comment passer facilement un array en argument à une fonction bash, go faire la fonction pour que l'on puisse faire " pullOrCreateRepo base_url liste_de_dépots"
#function pullOrCreateRepo(){ #function pullOrCreateRepo(){
#} #}
#####################################################
# tout ceci est très verbeux. # tout ceci est très verbeux.
# fonctionnement: # fonctionnement:
# lancer les clonages et git pull sur chaque dépot # lancer les clonages et git pull sur chaque dépot
# test existence of a folder # test existence of a folder
# if there is no folder, clone it # if there is no folder, clone it
# else, update with fetch from origin # else, update with fetch from origin
#####################################################
echo "----------- from framagit" echo "----------- from framagit"
for project_name in "${list_repos_framagit[@]}"; for project_name in "${list_repos_framagit[@]}";
do do
cd "$cloning_place" || exit cd $cloning_place
if [ ! -d "$project_name" ] if [ ! -d "$project_name" ]
then then
echo "+++++ cloning ${project_name}" echo "+++++ cloning ${project_name}"
@ -44,7 +51,7 @@ echo "----------- from framagit"
else else
echo "##### update project $project_name" echo "##### update project $project_name"
cd "$cloning_place" || exit cd $cloning_place$project_name
git fetch origin git fetch origin
git config pull.ff only git config pull.ff only
git pull git pull
@ -54,24 +61,24 @@ echo "----------- from framagit"
echo "----------- from forge chapril" echo "----------- from forge chapril"
for project_name in "${list_repos_forge_chapril[@]}"; for project_name in "${list_repos_forge_chapril[@]}";
do do
cd "$cloning_place" || exit cd $cloning_place
if [ ! -d "$project_name" ] if [ ! -d "$project_name" ]
then then
echo "+++++ cloning ${project_name}" echo "+++++ cloning ${project_name}"
echo "from ${prefix_forgechapril}${project_name}.git" echo "from ${prefix_forgechapril}${project_name}.git"
git clone "${prefix_forgechapril}${project_name}.git" git clone "${prefix_forgechapril}${project_name}.git"
else
else echo "##### update project $project_name"
echo "##### update project $project_name" cd $cloning_place$project_name
cd "$cloning_place" || exit git fetch origin
git fetch origin git config pull.ff only
git config pull.ff only git pull
git pull fi
fi
done done
# vous pouvez ajouter vos autres dépots et lancer la fonction pullOrCreateRepo # vous pouvez ajouter vos autres dépots
cd "$cloning_place" || exit
cd $cloning_place
ls -l |wc -l ls -l |wc -l
echo "update done" echo "update done"