-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
executable file
·53 lines (45 loc) · 1.59 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
# Initialize the cryo-data datalad sibling repositories
# load pre.sh commands
DIR=$(dirname $(readlink -f $0))
source ${DIR}/pre.sh
log_info Initializing...
if [[ ! -d ./database ]]; then
log_warn "cryo-data ./database folder not found"
log_warn "You should probably check out existing cryo-data project with:"
log_warn "$ datalad clone https://github.com/cryo-data/database ./database"
log_warn "Or build from scratch (see comments in code)"
log_err "Exiting..."
exit 1
# set up cryo-data
if [[ 0 ]]; then # Run this manually 1x
datalad create -D "cryo-data database" ./database
cd ./database
gh repo create --public -d "cryo-data top-level database" cryo-data/database
git remote add origin https://github.com/cryo-data/database
datalad push --to origin
fi
fi
for aka in $(yq '.aka | keys' ./template/cryo-data/meta.yaml | cut -d" " -f2); do
## Fetch
log_info "Checking for ${aka}"
if [[ -d ${aka} ]]; then
log_info "${aka} found"
else
log_warn "${aka} not found. Cloning..."
datalad clone -d . https://github.com/cryo-data/${aka} ./${aka}
## Create
# log_warn "${aka} not found. Creating..."
# datalad create -D "cryo-data ${aka}" ./${aka}
# cd ./${aka}
# gh repo create --public -d "cryo-data top-level ${aka}" cryo-data/${aka}
# git remote add origin https://github.com/cryo-data/${aka}
# datalad push --to origin
# cd ..
## remove
# rm -fR ${aka}
## install
# log_warn "${aka} not found. Cloning..."
# datalad clone -d . https://github.com/cryo-data/${aka} ./${aka}
fi
done