-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·51 lines (43 loc) · 1.34 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·51 lines (43 loc) · 1.34 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
#!/bin/bash
#
# Initial setup for craft-deploy.
# Creates the directory structure and the config file on the server.
# @see https://github.com/elfacht/craft-deploy
#
# @author Martin Szymanski <martin@elfacht.com>
# @license MIT
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib.sh
source "$SCRIPT_DIR/lib.sh"
cd "$SCRIPT_DIR"
#######################################
# Releases directory.
#######################################
if [ ! -d "./releases" ]; then
log "Create releases folder."
mkdir -p releases
fi
#######################################
# Shared directory structure.
#######################################
if [ ! -d "./shared" ]; then
log "Create shared folder."
mkdir -p shared/web shared/storage/backups
fi
#######################################
# Empty log file.
#######################################
if [ ! -f "./deploy.log" ]; then
log "Create empty log file."
touch deploy.log
fi
#######################################
# Config file. Copy the example without destroying it,
# and only when no .env exists yet.
#######################################
if [ -f ".env.example" ] && [ ! -f ".env" ]; then
log "Create .env from .env.example — edit it before deploying."
cp .env.example .env
fi
log "Setup complete. Next: edit .env, then upload your shared files into ./shared."