shellcheck verif update git projects
This commit is contained in:
parent
79638a18d0
commit
81927a720e
@ -6,64 +6,72 @@
|
|||||||
# 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
|
||||||
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")
|
||||||
|
|
||||||
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/'
|
||||||
|
|
||||||
cloning_place="/home/$USER/www/"
|
cloning_place="/home/$USER/www/"
|
||||||
|
cd "$cloning_place" || exit
|
||||||
|
pwd
|
||||||
|
# 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"
|
||||||
|
#function pullOrCreateRepo(){
|
||||||
|
#}
|
||||||
|
|
||||||
mkdir -p $cloning_place
|
# tout ceci est très verbeux.
|
||||||
|
# fonctionnement:
|
||||||
cd $cloning_place
|
# lancer les clonages et git pull sur chaque dépot
|
||||||
|
|
||||||
echo "Number of items in original list: ${#list[*]}"
|
|
||||||
|
|
||||||
# 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
|
# 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
|
||||||
else
|
echo "----------- from framagit"
|
||||||
echo "##### update project $folder_name"
|
for project_name in "${list_repos_framagit[@]}";
|
||||||
cd $folder_name
|
do
|
||||||
|
cd "$cloning_place" || exit
|
||||||
|
if [ ! -d "$project_name" ]
|
||||||
|
then
|
||||||
|
echo "+++++ cloning ${project_name}"
|
||||||
|
echo "from ${prefix_framagit}${project_name}.git"
|
||||||
|
git clone "${prefix_framagit}${project_name}.git"
|
||||||
|
|
||||||
git remote -v
|
else
|
||||||
|
echo "##### update project $project_name"
|
||||||
|
cd "$cloning_place" || exit
|
||||||
git fetch origin
|
git fetch origin
|
||||||
|
git config pull.ff only
|
||||||
|
git pull
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
echo "----------- from forge chapril"
|
||||||
|
for project_name in "${list_repos_forge_chapril[@]}";
|
||||||
|
do
|
||||||
|
cd "$cloning_place" || exit
|
||||||
|
if [ ! -d "$project_name" ]
|
||||||
|
then
|
||||||
|
echo "+++++ cloning ${project_name}"
|
||||||
|
echo "from ${prefix_forgechapril}${project_name}.git"
|
||||||
|
git clone "${prefix_forgechapril}${project_name}.git"
|
||||||
|
|
||||||
# lancer les clonages et git pull sur chaque dépot
|
else
|
||||||
|
echo "##### update project $project_name"
|
||||||
echo "cloning from framagit"
|
cd "$cloning_place" || exit
|
||||||
pullOrCreateRepo $prefix_framagit $list_repos_framagit
|
git fetch origin
|
||||||
|
git config pull.ff only
|
||||||
echo "cloning from forge chapril"
|
git pull
|
||||||
pullOrCreateRepo $prefix_forgechapril $list_repos_forge_chapril
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# vous pouvez ajouter vos autres dépots et lancer la fonction pullOrCreateRepo
|
# vous pouvez ajouter vos autres dépots et lancer la fonction pullOrCreateRepo
|
||||||
|
cd "$cloning_place" || exit
|
||||||
ls -l
|
ls -l |wc -l
|
||||||
echo "update done"
|
echo "update done"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user