|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | 3 | 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 |
7 | 4 | read -n 1 -p "Do you wish to install Contenta CMS (y/n)? " answer |
8 | 5 | if echo "$answer" | grep -iq "^y" ;then |
9 | 6 | echo -e "\nGreat!" |
|
13 | 10 | fi |
14 | 11 | read -e -p "Where do you want to install it? (Ex: /var/www/contentacms) " install_path |
15 | 12 | if echo "$install_path" ;then |
| 13 | + # Clean up the user input. |
16 | 14 | 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 |
19 | 32 | cd $original_wd |
20 | 33 | else |
21 | 34 | echo -e "\nBye!" |
22 | 35 | exit |
23 | 36 | fi |
24 | | -rm -Rf $mytmpdir |
|
0 commit comments