Skip to content
This repository was archived by the owner on Apr 17, 2024. It is now read-only.

Commit 594e89d

Browse files
author
Mateu Aguiló Bosch
committed
feat: improve quick installer
1 parent 10a75ce commit 594e89d

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

installer.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/usr/bin/env bash
22

33
original_wd=$(pwd)
4-
mytmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
5-
git clone --depth=1 https://github.com/contentacms/contenta_jsonapi.git $mytmpdir
6-
cd $mytmpdir
74
read -n 1 -p "Do you wish to install Contenta CMS (y/n)? " answer
85
if echo "$answer" | grep -iq "^y" ;then
96
echo -e "\nGreat!"
@@ -13,12 +10,27 @@ else
1310
fi
1411
read -e -p "Where do you want to install it? (Ex: /var/www/contentacms) " install_path
1512
if echo "$install_path" ;then
13+
# Clean up the user input.
1614
install_path=$(echo $install_path|sed -e "s:~:$HOME:g")
17-
composer run-script install-contenta $install_path --timeout=0
18-
composer run-script start-contenta $install_path --timeout=0
15+
16+
# Download Contenta CMS using composer create-project.
17+
php -r "readfile('https://raw.githubusercontent.com/contentacms/contenta_jsonapi/8.x-1.x/download.sh');" > download-contentacms.sh
18+
chmod a+x download-contentacms.sh
19+
./download-contentacms.sh $install_path
20+
21+
# Install Contenta CMS using sqlite by default.
22+
echo "The Quick Install uses SQLite to install Contenta CMS. This is not suited for production sites."
23+
# Set the .env data.
24+
ACCOUNT_PASS="$(LC_ALL=C tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c 13)"
25+
echo -e "SQLITE_PATH=tmp\nSQLITE_DATABASE=site.sqlite\nSITE_MAIL=admin@localhost\nACCOUNT_MAIL=admin@localhost\nSITE_NAME='Contenta CMS Demo'\nACCOUNT_NAME=admin\nACCOUNT_PASS=$ACCOUNT_PASS\n" > $install_path/.env
26+
echo -e "ACCOUNT_PASS=$ACCOUNT_PASS\n" >> $install_path/.env.local
27+
# Install using SQLite.
28+
composer run-script install:with-sqlite $install_path --timeout=0 --working-dir $install_path
29+
30+
# Start the built-in PHP server.
31+
composer run-script start-contenta $install_path --timeout=0 --working-dir $install_path
1932
cd $original_wd
2033
else
2134
echo -e "\nBye!"
2235
exit
2336
fi
24-
rm -Rf $mytmpdir

0 commit comments

Comments
 (0)