-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·99 lines (84 loc) · 1.44 KB
/
install.sh
File metadata and controls
executable file
·99 lines (84 loc) · 1.44 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
#
# Install script for OnMyShelf docker
#
#
# Functions
#
# Print usage
print_help() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -v, --version VERSION Choose a version to install"
echo " -p, --port HTTP_PORT Choose the default port"
echo " -h, --help Print this help"
}
#
# Main program
#
# go into current directory
cd "$(dirname "$0")" || exit
# load functions
source .functions.sh || exit
# get options
force_mode=false
while [ $# -gt 0 ] ; do
case $1 in
-p|--port)
if [ -z "$2" ] ; then
print_help
exit 1
fi
port=$2
shift
;;
-v|--version)
if [ -z "$2" ] ; then
print_help
exit 1
fi
version=$2
shift
;;
-y|--yes)
force_mode=true
;;
-h|--help)
print_help
exit 0
;;
-*)
echo "Unknown option: $1"
print_help
exit 1
;;
esac
shift
done
pull_project
# copy config if not exists
if ! [ -f .env ] ; then
echo "Copy environment config file..."
cp env.example .env || exit
echo
else
port=$(get_config HTTP_PORT)
check_env
fi
# get http port from config
default_port=$(get_config HTTP_PORT)
if [ -z "$port" ] ; then
echo -n "Choose the HTTP port [$default_port]: "
read port
[ -z "$port" ] && port=$default_port
echo
fi
# change port if needed
if [ "$port" != "$default_port" ] ; then
set_config HTTP_PORT "$port"|| exit
fi
change_version
if ! $force_mode ; then
lb_yesno -y "Proceed to install?" || exit 0
fi
start_server