blob: 56632a19990037ac8ec0699a3230625fbc5c4ac7 (
plain)
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
|
#!/bin/sh
# adds my other script paths (except volsv)
SSH_BASE_URL="git@git.zachir.xyz:zachir/"
HTTP_BASE_URL="https://git.zachir.xyz/"
SCRIPT_DIRS="blocks
generics
scripts
shortcmds
sp"
case "$1" in
"-s"|"-S"|"-y"|"-Y")
___USE_SSH=y
;;
"-h")
printf "install.sh\n\nUsed to add my other script repos as submodules. Feel free to modfy it to clone yours as well.\n"
printf "-s, -S, -y, and -Y will clone using SSH. -h will show this help menu. Everything else will clone using https.\n"
;;
*)
unset ___USE_SSH
;;
esac
clone_dir () {
if [ -d "$1" ]; then
printf "%s already exists as dir; not adding.\n" "$1"
elif [ -f "$1" ]; then
printf "%s already exists, but not as a dir; not adding.\n" "$1"
else
if [ -n "$2" ]; then
printf "Cloning %s %s using ssh; will be read-write\nNote: only my ssh key will clone it\n" "$1"
git clone "$SSH_BASE_URL$1.git" "$1"
else
printf "Cloning %s using http; will be read-only\n" "$1"
git clone "$HTTP_BASE_URL$1.git" "$1"
fi
fi
}
echo "$SCRIPT_DIRS" | while read i; do
clone_dir "$i" "$___USE_SSH"
done
|