1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/elabftw_ynh.git synced 2024-09-03 18:26:23 +02:00

Try to fix install and postinstall

This commit is contained in:
tituspijean 2021-08-12 17:09:43 +02:00
parent 1ab8882307
commit bd2805b960
3 changed files with 49 additions and 7 deletions

7
conf/config.php Normal file
View file

@ -0,0 +1,7 @@
<?php
define('DB_HOST', 'localhost');
define('DB_PORT', '3306');
define('DB_NAME', '__DB_NAME__');
define('DB_USER', '__DB_NAME__');
define('DB_PASSWORD', '__DB_PWD__');
define('SECRET_KEY', '__SECRET_KEY__');

18
conf/sql.template Normal file
View file

@ -0,0 +1,18 @@
INSERT INTO `config` (`conf_name`, `conf_value`) VALUES
('ldap_base_dn', 'ou=users,dc=yunohost,dc=org'),
('ldap_email', 'mail'),
('ldap_firstname', 'givenname'),
('ldap_host', 'localhost'),
('ldap_lastname', 'sn'),
('ldap_password', NULL),
('ldap_port', '389'),
('ldap_team', ''),
('ldap_toggle', '1'),
('ldap_username', NULL),
('ldap_use_tls', '0'),
('mail_from', '__APP__@__DOMAIN__'),
('mail_method', 'smtp'),
('smtp_password', ''),
('smtp_port', '587'),
('smtp_username', NULL)
ON DUPLICATE KEY UPDATE value = VALUES(value);

View file

@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
read -p "debug me"
true
}
# Exit if an error occurs during the execution of the script
@ -116,22 +117,37 @@ ynh_script_progression --message="Installing Composer..." --weight=10
ynh_secure_remove --file="$final_path/composer.lock"
ynh_install_composer
chown -R $app "$final_path/.composer"
chmod 777 -R "$final_path"
#=================================================
# INSTALL AND INITIALIZE COMPOSER
#=================================================
ynh_script_progression --message="Installing with Composer..." --weight=30
chown -R $app "$final_path/.composer/"
chmod -R 777 $final_path
pushd "$final_path"
ynh_exec_as $app php$phpversion composer.phar install --prefer-dist --no-progress --no-dev
ynh_script_progression --message="Composer install..."
ynh_exec_warn_less ynh_exec_as $app php$phpversion composer.phar install --prefer-dist --no-progress --no-dev
ynh_script_progression --message="Yarn install..."
npm install brotli
yarn install --pure-lockfile --prod && yarn run buildall && rm -rf node_modules && yarn cache clean
ynh_exec_warn_less npm install brotli
ynh_exec_warn_less yarn install --pure-lockfile --prod
ynh_exec_warn_less yarn run buildall
ynh_secure_remove node_modules
ynh_exec_warn_less yarn cache clean
secret_key=$(ynh_string_random --length=137)
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
ynh_script_progression --message="Install start..."
ynh_add_config --template="../conf/config.php" --destination="$final_path/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="../conf/sql.template" --destination="../conf/sql"
ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$db_name < ../conf/sql
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -139,8 +155,9 @@ popd
#=================================================
ynh_script_progression --message="Securing files and directories..." --weight=1
mkdir $final_path/{cache,uploads}
mkdir -p $final_path/{cache,uploads}
chown $app:www-data $final_path/{cache,uploads}
chmod 750 -R "$final_path"
chmod 700 $final_path/{cache,uploads}
#=================================================