-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodebook.sh
More file actions
executable file
·54 lines (48 loc) · 1.53 KB
/
Copy pathcodebook.sh
File metadata and controls
executable file
·54 lines (48 loc) · 1.53 KB
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
53
54
#!/usr/bin/env bash
#
# Setup script to run CodeBook on current folder
#
# curl https://raw.githubusercontent.com/aus-der-Technik//CodeBook/main/codebook.sh | sh -
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/" >/dev/null 2>&1 && pwd)"
if [ ! -f "${SCRIPT_DIR}/.env" ]; then
curl https://raw.githubusercontent.com/aus-der-Technik//CodeBook/main/.env >> .env
fi
if [ ! -f "${SCRIPT_DIR}/docker-compose.yaml" ]; then
curl https://raw.githubusercontent.com/aus-der-Technik//CodeBook/main/docker-compose.yaml >> "${SCRIPT_DIR}/docker-compose.yaml"
fi
if [ ! -f "${SCRIPT_DIR}/settings.json" ]; then
curl https://raw.githubusercontent.com/aus-der-Technik//CodeBook/main/settings.json >> "${SCRIPT_DIR}/settings.json"
fi
if [ ! -d "${SCRIPT_DIR}/startup" ]; then
mkdir "${SCRIPT_DIR}/startup"
fi
if [ ! -d "${SCRIPT_DIR}/.gitignore" ]; then
echo "
.DS_Store
/settings.json
/docker-compose.yaml
" > "${SCRIPT_DIR}/.gitignore"
fi
SCRIPT_DIR=${SCRIPT_DIR} docker-compose \
-f "${SCRIPT_DIR}/docker-compose.yaml" \
--env-file "${SCRIPT_DIR}/.env" \
up \
--detach --wait \
codebook
sleep 2
if [ "$(uname -s)" == "Darwin" ]; then
open http://localhost:31546/?folder=/project
else
which xdg-open && true
if [ "$?" == "0" ]; then
xdg-open http://localhost:31546/?folder=/project
else
echo "Open http://localhost:31546/?folder=/project in your browser."
fi
fi
echo ""
echo "Press enter to stop the code-server."
read -r
docker-compose -f "${SCRIPT_DIR}/docker-compose.yaml" down codebook