fetch-all-git (610B)
1 #!/bin/bash 2 3 FOLDER=${1:-$HOME/git} 4 set -e 5 6 umask 022 7 8 cd "$FOLDER" 9 10 # awful parsing of cgit's output... 11 curl -s 'https://a3nm.net/git/' | 12 grep '<tr>' | 13 sed '1,3d' | 14 sed 's/.*<tr>/<tr>/g' | 15 while read l; do 16 NAME=$(echo "$l" | cut -d'>' -f4 | cut -d'<' -f1) 17 REPO="$NAME.git" 18 DESC=$(echo "$l" | cut -d'>' -f7-) 19 if [ ! -d "$REPO" ] 20 then 21 git clone --bare "https://a3nm.net/git/$NAME" "$REPO" 22 else 23 cd "$REPO" 24 # https://stackoverflow.com/a/21331942 25 git fetch "https://a3nm.net/git/$NAME" '*:*' 26 cd .. 27 fi 28 echo "$DESC" > "$REPO/description" 29 done 30