Debian Codegraph @

test/common/make-bots

raw
1 #!/bin/sh
2
3 # Prepare bots by creating ./bots directory
4 # Specify $COCKPIT_BOTS_REF to checkout non-main branch
5
6 GITHUB_REPO='bots'
7 SUBDIR='bots'
8 # Cockpit plugins from different organizations are expected to share the same bots repository
9 GITHUB_BASE="cockpit-project"
10
11 V="${V-0}" # default to friendly messages
12
13 set -eu
14 cd "${0%/*}/../.."
15 # shellcheck source-path=SCRIPTDIR/../..
16 . test/common/git-utils.sh
17
18 if [ ! -e bots ]; then
19 [ -n "${quiet}" ] || set -x
20 if [ -h ~/.config/cockpit-dev/bots ]; then
21 message SYMLINK "bots → $(realpath --relative-to=. ~/.config/cockpit-dev/bots)"
22 ln -sfT "$(realpath --relative-to=. ~/.config/cockpit-dev)/bots" bots
23 else
24 # it's small, so keep everything cached
25 fetch_to_cache ${COCKPIT_BOTS_REF+"${COCKPIT_BOTS_REF}"}
26 clone_from_cache "${COCKPIT_BOTS_REF-main}"
27 fi
28 else
29 echo "bots/ already exists, skipping"
30 fi