78 lines
1.8 KiB
Bash
Executable file
78 lines
1.8 KiB
Bash
Executable file
#!/bin/sh
|
|
# TODO: Rewrite this in a proper language
|
|
# shellcheck disable=2034
|
|
set -a
|
|
|
|
BASE="$XDG_DOCUMENTS_DIR/dev"
|
|
|
|
# TOKEN has to be an API token (PAT) with
|
|
# the following permissions (for the default configuration)
|
|
# read:organization
|
|
# read:repository
|
|
# read:user
|
|
TOKEN="$(secret-tool lookup gitea api_token)"
|
|
# Store with `secret-tool store --label=clonedev gitea api_token`
|
|
|
|
# URL hit by curl is constructed like this: API_URL/TARGET/ENDPOINT
|
|
# TARGET is extracted from a space separated list stored in TARGETS
|
|
API_URL="https://git.snaile.de/api/v1"
|
|
TARGETS="orgs/snailed users/luca"
|
|
ENDPOINT="repos"
|
|
HEADERS="
|
|
-H 'accept: application/json'
|
|
-H 'Authorization: token $TOKEN'
|
|
"
|
|
|
|
# The output of this request are filtered using this jq command:
|
|
FILTER=".[].ssh_url"
|
|
|
|
# After filtering, the output passed to a git clone command with these flags:
|
|
CLONE_FLAGS="--recursive -j8"
|
|
|
|
# If the repo is listed in one of these variables, it is moved to
|
|
# the dir in the variable name. The dirname must match this regex: "^DEVDIRS_([A-Za-z_-]*)(?==)"
|
|
# The following config would result in the testrepo repo being placed like this:
|
|
|
|
# testdir/testrepo
|
|
# test_block would be blocked from getting cloned
|
|
|
|
# DEVDIRS_testdir="
|
|
# testrepo
|
|
#
|
|
# BLOCKDIRS="test_block"
|
|
|
|
DEVDIRS_desktop="
|
|
bootstrapper
|
|
dmenu-custom
|
|
dwm-custom
|
|
dwmblocks-custom
|
|
st-custom
|
|
tokyonight-icons
|
|
tokyonight-theme
|
|
"
|
|
|
|
DEVDIRS_server="
|
|
ansible-example
|
|
ansible-homelab
|
|
dotfiles-server
|
|
void-packages
|
|
void-packages-custom
|
|
qbittorrent-natpmp
|
|
xbps-builder
|
|
matrix-docker-ansible-deploy
|
|
server-resources
|
|
"
|
|
DEVDIRS_misc="
|
|
tidal-scraper
|
|
"
|
|
DEVDIRS_nvim="
|
|
taolf
|
|
"
|
|
|
|
BLOCK_UNSORTED=false
|
|
BLOCK_REPOS="dotfiles pinentry-dmenu-custom"
|
|
|
|
EXTRA_REPOS="
|
|
https://github.com/void-linux/void-packages
|
|
https://github.com/spantaleev/matrix-docker-ansible-deploy
|
|
"
|