1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cypht_ynh.git synced 2024-09-03 18:26:09 +02:00
cypht_ynh/scripts/install
2024-07-05 14:46:31 +02:00

75 lines
2.4 KiB
Bash
Executable file

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
timezone=$(cat /etc/timezone)
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_mysql_db_shell <<< "CREATE TABLE hm_user_session (hm_id varchar(180), data longblob, date timestamp, primary key (hm_id));"
ynh_mysql_db_shell <<< "CREATE TABLE hm_user (username varchar(250), hash varchar(250), primary key (username));"
ynh_mysql_db_shell <<< "CREATE TABLE hm_user_settings(username varchar(250), settings longblob, primary key (username));"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated PHP-FPM config
ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_config_add_nginx
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL CYPHT WITH COMPOSER
#=================================================
ynh_script_progression "Installing $app with Composer..."
ynh_composer_install
ynh_composer_exec install --no-dev --ignore-platform-reqs
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression "Adding $app's configuration..."
ynh_config_add --template=".env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#=================================================
# ADD AN ADMIN USER
#=================================================
ynh_script_progression "Adding an admin..."
#Generate the run-time configuration
php$php_version $install_dir/scripts/config_gen.php
# create an admin account
php$php_version $install_dir/scripts/create_account.php $admin $password
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Installation of $app completed"