This repository was archived by the owner on Jan 14, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
134 lines (103 loc) · 4.14 KB
/
install.sh
File metadata and controls
134 lines (103 loc) · 4.14 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
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
#!/bin/bash
: '
/**
* @author Constan van Suchtelen van de Haere <constan.vansuchtelenvandehaere@hostingbe.com>
* @copyright 2024 - 2025 HostingBE
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
'
# Database Connection strings
hostname=""
database=""
username=""
password=""
# If you have another directory name as public website enter it below
public="public_html"
# domain without https://
url="yourdomain.com"
# SMTP settings
smtp_port=587
smtp_username=
smtp_password=
smtp_host=
smtp_from=
smtp_tls=true
smtp_auth=true
#
# No need to edit the file below this line!
#
version="simple-cms-3.1"
curl="/usr/bin/curl"
mkdir="/usr/bin/mkdir"
rsync="/usr/bin/rsync"
echo "Checking if we need to update?"
if [ -f $(pwd)'/config/config.php' ]; then
echo "config.php found aborting install!"
exit 0
fi
echo "Checking if public directory exists"
if [ -d $(pwd)'/public_html' ]; then
mv $(pwd)'/public_html' $(pwd)'/public_html-'$(date +"%Y-%m-%d")
fi
echo "Downloading latest source code"
${curl} -L -o simple-cms.zip https://github.com/HostingBE/simple-cms/archive/refs/tags/v3.1.zip
echo "Making temp directory for install"
${mkdir} $(pwd)/simple-cms/
echo "Move download to seperate directory"
mv simple-cms.zip $(pwd)/simple-cms/.
echo "Unzip download file in temp directory"
unzip $(pwd)/simple-cms/simple-cms.zip
echo "Moving the CMS to original directory"
${rsync} -rv $(pwd)/${version}/ $(pwd)
echo "Deleting the simple-cms directory"
rm -rf $(pwd)/simple-cms/
rm -rf $(pwd)/${version}/
echo "Creating the .env file for the CMS"
mv $(pwd)/env $(pwd)/.env
echo "Running composer update"
if ! [ $(composer update; echo $0) ]; then
exit 1
fi
echo "copy config.php to config directory"
mv $(pwd)/config/config-sample.php $(pwd)/config/config.php
echo "Changing database settings in env"
sed -i -e "s/^database=.*/database=${database}/" $(pwd)/.env
sed -i -e "s/^username=.*/username=${username}/" $(pwd)/.env
sed -i -e "s/^password=.*/password=${password}/" $(pwd)/.env
sed -i -e "s/^host=.*/host=${hostname}/" $(pwd)/.env
echo "Changing SMTP settings in env"
sed -i -e "s/^smtp_port=.*/smtp_port=${smtp_port}/" $(pwd)/.env
sed -i -e "s/^smtp_username=.*/smtp_username=${smtp_username}/" $(pwd)/.env
sed -i -e "s/^smtp_password=.*/smtp_password=${smtp_password}/" $(pwd)/.env
sed -i -e "s/^smtp_host=.*/smtp_host=${smtp_host}/" $(pwd)/.env
sed -i -e "s/^smtp_tls=.*/smtp_tls=${smtp_tls}/" $(pwd)/.env
sed -i -e "s/^smtp_auth=.*/smtp_auth=${smtp_auth}/" $(pwd)/.env
sed -i -e "s/^smtp_from=.*/smtp_from=${smtp_from}/" $(pwd)/.env
echo "Changing the domain name in the config file"
sed -i -e "s/\[domain\]/${url}/" $(pwd)/config/config.php
if [ ${public} != "public_html" ]; then
mv $(pwd)/public_html/ $(pwd)/${public}/
fi
echo "Moving htaccess to .htaccess";
mv $(pwd)/${public}/htaccess $(pwd)/${public}/.htaccess
echo "Running npm update\n"
cd $(pwd)/${public};npm install;cd ..
echo "Making the temp and other directories"
mkdir $(pwd)/tmp
mkdir $(pwd)/logs
mkdir $(pwd)/${public}/uploads
mkdir $(pwd)/${public}/images/users
echo "Import the database schema";
mysql -u ${username} -p${password} -h ${hostname} ${database} < $(pwd)/sql/simple_cms.sql
touch $(pwd)/.new_install
echo "done";