scripts/update_git_projects.sh

56 lines
1.5 KiB
Bash
Raw Normal View History

2022-07-06 16:06:27 +02:00
#!/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/'
2022-07-06 22:20:42 +02:00
username="${SUDO_USER:-${USER}}"
cloning_place="/home/$username/www/"
2022-07-06 16:06:27 +02:00
2022-07-06 22:20:42 +02:00
echo $cloning_place
#mkdir $cloning_place
2022-07-06 16:06:27 +02:00
cd $cloning_place
2022-07-06 22:20:42 +02:00
git config --global credential.helper store
2022-07-06 16:06:27 +02:00
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
2022-07-06 22:20:42 +02:00
echo "update.sh exists"
# bash update.sh
2022-07-06 16:06:27 +02:00
fi
if [ -f "yarn.lock" ]
then
2022-07-06 22:20:42 +02:00
echo "installing yarn packages"
# yarn install --pure-lockfile
2022-07-06 16:06:27 +02:00
# elif [ -f "package.lock" ]
# npm i
fi
cd ..
fi
done
ls -l
echo "update done"