diff --git a/install.sh b/install.sh index c4f70cc..82a6d7c 100644 --- a/install.sh +++ b/install.sh @@ -215,9 +215,42 @@ read answer if [[ "$answer" == "y" ]]; then install_pkg tmux get_username + + if [[ -z "$db_directus_password" ]]; then + echo -e "${PURPLE}${BOLD}Enter the MariaDB Directus password : ${RESET}" + read -s db_directus_password + echo + fi + + echo -e "${PURPLE}${BOLD}Generate and store the credentials somewhere safe${RESET}" + echo -e "${PURPLE}${BOLD}Enter the Directus admin email : ${RESET}" + read -s directus_admin_email + echo -e "${PURPLE}${BOLD}Enter the Directus admin password : ${RESET}" + read -s directus_admin_password + + cms_folder="cms.${domain_name}" + env_file="${cms_folder}/.env" + + key=$(head -c 16 /dev/urandom | od -An -tx1 | tr -d ' \n') + secret=$(head -c 16 /dev/urandom | od -An -tx1 | tr -d ' \n') + su -c "cd &&\ - npm init -y directus-project@latest cms &&\ - echo \"HOST=${ip}\" >> cms/.env &&\ - echo \"PUBLIC_URL=cms.${domain_name}\" >> cms/.env" $username + mkdir ${$cms_folder} &&\ + mkdir ${$cms_folder}/uploads &&\ + echo \"HOST=\\"${ip}\\"\" >> ${env_file} &&\ + echo \"PUBLIC_URL=\\"cms.${domain_name}\\"\" >> ${env_file} &&\ + echo \"PORT=8055\" >> ${env_file} &&\ + echo \"DB_CLIENT=\\"mysql\\"\" >> ${env_file} &&\ + echo \"DB_HOST=\\"127.0.0.1\\"\" >> ${env_file} &&\ + echo \"DB_PORT=\\"3306\\"\" >> ${env_file} &&\ + echo \"DB_DATABASE=\\"directus\\"\" >> ${env_file} &&\ + echo \"DB_USER=\\"directus\\"\" >> ${env_file} &&\ + echo \"DB_PASSWORD=\\"${db_directus_password}\\"\" >> ${env_file} &&\ + echo \"SECRET=\\"${secret}\\"\" >> ${env_file} &&\ + echo \"KEY=\\"${key}\\"\" >> ${env_file} &&\ + echo \"ADMIN_EMAIL=\\"${directus_admin_email}\\"\" >> ${env_file} &&\ + echo \"ADMIN_PASSWORD=\\"${directus_admin_password}\\"\" >> ${env_file} &&\ + npx directus bootstrap" $username fi + # TODO REMOVE EXPECT IF IT IS INSTALLED \ No newline at end of file