mirror of
https://github.com/YunoHost-Apps/elabftw_ynh.git
synced 2024-09-03 18:26:23 +02:00
79 lines
2.9 KiB
Bash
79 lines
2.9 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# INITIALIZE AND STORE SETTINGS
|
|
#=================================================
|
|
|
|
secret_key=$(ynh_string_random --length=137)
|
|
ynh_app_setting_set --app=$app --key="secret_key" --value="$secret_key"
|
|
|
|
#=================================================
|
|
# INSTALL DEPENDENCIES
|
|
#=================================================
|
|
ynh_script_progression --message="Installing NodeJS..." --weight=1
|
|
|
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..." --weight=7
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir/sources"
|
|
mkdir -p "$install_dir/sources/"{cache,uploads}
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
#=================================================
|
|
# INSTALL AND INITIALIZE COMPOSER
|
|
#=================================================
|
|
ynh_script_progression --message="Installing $app with Composer..." --weight=30
|
|
|
|
pushd "$install_dir/sources"
|
|
ynh_install_composer --workdir="$install_dir/sources" --install_args="--no-dev"
|
|
|
|
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile --prod
|
|
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn run buildall
|
|
|
|
ynh_composer_exec --workdir="$install_dir/sources" --commands="install --prefer-dist --no-cache --no-progress --no-dev -a"
|
|
|
|
ynh_secure_remove node_modules
|
|
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean
|
|
|
|
ynh_add_config --template="config.php" --destination="$install_dir/sources/config.php"
|
|
ynh_exec_as "$app" "php$phpversion" "bin/install" start -q
|
|
popd
|
|
|
|
# ynh_script_progression --message="Configuring LDAP and emails..." --weight=2
|
|
# ynh_add_config --template="sql.template" --destination="$install_dir/ldap_sql"
|
|
# ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/ldap_sql"
|
|
# ynh_secure_remove --file="$install_dir/ldap_sql"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
ynh_add_fpm_config
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|