-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_orchid
277 lines (242 loc) · 6.78 KB
/
install_orchid
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#!/bin/bash
#
RED=$(echo -en '\033[00;31m')
GREEN=$(echo -en '\033[00;32m')
NC=$(echo -en '\033[0m')
YELLOW=$(echo -en '\033[00;33m')
echo "${GREEN}##################################"
echo "# Install Orchid Platform #"
echo "##################################
${NC}"
fn_install_laravel()
{
echo "
${GREEN}Install Laravel by issuing the Composer${NC}"
echo " composer create-project laravel/laravel \"8.*\" --prefer-dist
"
read -r -p "${YELLOW}Install Laravel?[y/N]${NC}" ilaravel
ilaravel=${ilaravel,,} # tolower
if [[ "$ilaravel" =~ ^(yes|y)$ ]]
then
read -e -r -p "${YELLOW}Enter laravel directory (. current directory):${NC}" -i "orchid" laraveldir
composer create-project --prefer-dist laravel/laravel "$laraveldir"
cd "$laraveldir"
fi
}
fn_install_orchid()
{
echo "
${GREEN}Install Orchid Platform by using the Composer${NC}"
read -r -p "${YELLOW}Install Orchid Platform?[y/N]${NC}" iorchid
iorchid=${iorchid,,} # tolower
if [[ "$iorchid" =~ ^(yes|y)$ ]]
then
read -e -r -p "${YELLOW}Enter orchid version:${NC}" -i ":9.*" orchidver
echo " composer require orchid/platform${orchidver}
"
composer require orchid/platform"$orchidver"
fi
}
fn_app_url()
{
source ./.env
#cp ./.env ./.env.bak
echo "
${GREEN}3. Enter application url (site url) in .env file${NC}"
echo "Our application url in .env file = $APP_URL"
read -r -p "${YELLOW}Change application url(http:\/\/sitename.com\/)? [y/N]${NC} " changeurl
changeurl=${changeurl,,} # tolower
if [[ "$changeurl" =~ ^(yes|y)$ ]]
then
read -e -r -p "${YELLOW}APP_URL( $APP_URL )=${NC}" -i "$APP_URL" APP_URL
sed -i "/APP_URL\=/c APP_URL\=$APP_URL" ./.env
fi
echo "
${GREEN}4. Enter prefix of each route in the administration panel${NC}"
DASHBOARD_PREFIX="admin"
echo "Our administration panel prefix = $DASHBOARD_PREFIX"
read -r -p "${YELLOW}Change prefix? [y/N]${NC} " changepref
changepref=${changepref,,} # tolower
if [[ "$changepref" =~ ^(yes|y)$ ]]
then
read -e -r -p "${YELLOW}DASHBOARD_PREFIX( $DASHBOARD_PREFIX )=${NC}" -i "$DASHBOARD_PREFIX" DASHBOARD_PREFIX
sed -i "$ a DASHBOARD_PREFIX=$DASHBOARD_PREFIX" ./.env
fi
echo "
${GREEN}Enter database data in .env and config/database.php files${NC}"
echo "Our database config in .env file"
echo "DB_CONNECTION=$DB_CONNECTION"
echo "DB_HOST=$DB_HOST"
echo "DB_PORT=$DB_PORT"
echo "DB_DATABASE=$DB_DATABASE"
echo "DB_USERNAME=$DB_USERNAME"
echo "DB_PASSWORD=$DB_PASSWORD
"
read -r -p "${YELLOW}Change database data? [y/N]${NC} " changedb
changedb=${changedb,,} # tolower
if [[ "$changedb" =~ ^(yes|y)$ ]]
then
read -e -r -p "${YELLOW}DB_CONNECTION( $DB_CONNECTION )=${NC}" -i "$DB_CONNECTION" DB_CONNECTION
read -e -r -p "${YELLOW}DB_HOST( $DB_HOST )=${NC}" -i "$DB_HOST" DB_HOST
read -e -r -p "${YELLOW}DB_PORT( $DB_PORT )=${NC}" -i "$DB_PORT" DB_PORT
read -e -r -p "${YELLOW}DB_DATABASE( $DB_DATABASE )=${NC}" -i "$DB_DATABASE" DB_DATABASE
read -e -r -p "${YELLOW}DB_USERNAME( $DB_USERNAME )=${NC}" -i "$DB_USERNAME" DB_USERNAME
read -e -r -p "${YELLOW}DB_PASSWORD( $DB_PASSWORD )=${NC}" -i "$DB_PASSWORD" DB_PASSWORD
sed -i "/DB_CONNECTION\=/c DB_CONNECTION\=$DB_CONNECTION
/DB_HOST\=/c DB_HOST\=$DB_HOST
/DB_PORT\=/c DB_PORT\=$DB_PORT
/DB_DATABASE\=/c DB_DATABASE\=$DB_DATABASE
/DB_USERNAME\=/c DB_USERNAME\=$DB_USERNAME
/DB_PASSWORD\=/c DB_PASSWORD\=$DB_PASSWORD" ./.env
echo "DB_CONNECTION=$DB_CONNECTION"
echo "DB_HOST=$DB_HOST"
echo "DB_PORT=$DB_PORT"
echo "DB_DATABASE=$DB_DATABASE"
echo "DB_USERNAME=$DB_USERNAME"
echo "DB_PASSWORD=$DB_PASSWORD"
fi
}
fn_run_orchid()
{
echo "
${GREEN}Run Orchid Platform by using (php artisan orchid:install)${NC}"
read -r -p "${YELLOW}Run Orchid Platform?[y/N]${NC}" irunorchid
irunorchid=${irunorchid,,} # tolower
if [[ "$irunorchid" =~ ^(yes|y)$ ]]
then
echo " php artisan orchid:install
"
php artisan orchid:install
fi
}
fn_add_user()
{
echo "
${GREEN}6. Create your admin user${NC}"
read -r -p "${YELLOW}Create new admin user?[y/N]${NC}" addadmin
addadmin=${addadmin,,} # tolower
if [[ "$addadmin" =~ ^(yes|y)$ ]]
then
read -r -p "${YELLOW}Enter admin name:${NC}" admin_name
read -r -p "${YELLOW}Enter admin email:${NC}" admin_email
read -r -p "${YELLOW}Enter admin password:${NC}" admin_password
php artisan orchid:admin "$admin_name" "$admin_email" "$admin_password"
fi
}
fn_install_package()
{
echo "
Select package:
1) Press (https://github.com/orchidsoftware/press)
2) Demo kit (https://github.com/orchidcommunity/DemoKit)
3) XSetting (https://github.com/orchidcommunity/XSetting)
4) Repeater Field (https://github.com/Nks/orchid-repeater-field)
0) Return to main menu
"
read -r -p "${YELLOW}Select variable: (1-4)${NC}" ipack
ipack=${ipack,,} # tolower
case "$ipack" in
1)
composer require orchid/press
php artisan migrate
fn_install_package
exit 0
;;
2)
composer require orchids/demokit
fn_install_package
exit 0
;;
3)
composer require orchids/xsetting
php artisan migrate
fn_install_package
exit 0
;;
4)
composer require nakukryskin/orchid-repeater-field
fn_install_package
exit 0
;;
0)
fn_start
exit 0
;;
# Default
*)
fn_start
;;
esac
}
fn_start()
{
echo "
Select variable:
1) Full instalation
2) Install Laravel by issuing the Composer
3) Install Orchid Platform by using the Composer
4) Seting in .env file (site url, dashboard, database)
5) Run install Orchid (php artisan orchid:install)
6) Create your admin user
7) Install other packages
0) Exit
"
read -r -p "${YELLOW}Select variable: (1-7)${NC}" istart
istart=${istart,,} # tolower
case "$istart" in
# 1) Full instalation
1)
fn_install_laravel
fn_install_orchid
fn_app_url
fn_run_orchid
fn_add_user
fn_start
exit 0
;;
# 2) Install Laravel by issuing the Composer
2)
fn_install_laravel
fn_start
exit 0
;;
3)
fn_install_orchid
fn_start
exit 0
;;
4)
fn_app_url
fn_start
exit 0
;;
5)
fn_run_orchid
fn_start
exit 0
;;
6)
fn_add_user
fn_start
exit 0
;;
7)
fn_install_package
fn_start
exit 0
;;
0)
exit 0
;;
# Default
*)
fn_install_laravel
fn_install_orchid
fn_app_url
fn_run_orchid
fn_add_user
fn_start
;;
esac
}
fn_start