Archived
1
1

prepare for desktop and some improvements

This commit is contained in:
2024-12-11 11:31:27 +01:00
parent c8f7181aad
commit 69ce912bd1
6 changed files with 204 additions and 187 deletions

40
configs/auto_clone.sh Normal file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
token="$1"
page=1
project_dir="$HOME/projects"
base_url="https://gitea.finnvanreenen.nl/api/v1"
while [[ $page < 21 ]]
do
echo
echo "## get repo list page $page"
repos="$(curl -X 'GET' "$base_url/user/repos?page=$page&token=$token" -H 'accept: application/json')"
if [[ "$repos" != "[]" ]]
then
for repo in $(echo "$repos" | sed -e 's/^\[{//' -e 's/}]$//' -e 's/},{/\n/g' -e 's/%/%p/g' -e 's/ /%20/g')
do
repo_json="$(echo "$repo" | sed -e 's/%20/ /g' -e 's/%p/%/g')"
full_name="$(echo "$repo_json" | sed -e 's/^.*"full_name":"\([^"]*\)".*$/\1/')"
ssh_url="$(echo "$repo_json" | sed -e 's/^.*"ssh_url":"\([^"]*\)".*$/\1/')"
echo
echo "### $full_name"
if [ -d "$project_dir/$full_name" ]
then
cd "$project_dir/$full_name"
git fetch
else
git clone "$ssh_url" "$project_dir/$full_name"
fi
done
else
echo "No more repositories found."
page=999
fi
page=$(( $page + 1 ))
done