mirror of
https://github.com/YunoHost-Apps/moodle_ynh.git
synced 2024-09-03 19:46:23 +02:00
small fixes (#33)
This commit is contained in:
parent
ef91727302
commit
3cbed24eaf
4 changed files with 47 additions and 55 deletions
|
@ -1 +1 @@
|
|||
*/15 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINAL_PATH__/admin/cli/cron.php
|
||||
*/15 * * * * __USER__ /usr/bin/php__PHPVERSION__ -f __FINALPATH__/admin/cli/cron.php
|
||||
|
|
|
@ -40,16 +40,16 @@ data_path=/home/yunohost.app/$app
|
|||
test ! -e "$data_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url"
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app="$app" --key=domain --value="$domain"
|
||||
ynh_app_setting_set --app="$app" --key=path --value="$path_url"
|
||||
ynh_app_setting_set --app="$app" --key=admin --value="$admin"
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -58,7 +58,7 @@ ynh_app_setting_set --app="$app" --key=admin --value="$admin"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies "$pkg_dependencies"
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE POSTGRESQL DATABASE
|
||||
|
@ -67,10 +67,10 @@ ynh_script_progression --message="Creating a PostgreSQL database..." --weight=4
|
|||
|
||||
ynh_psql_test_if_first_run
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
|
||||
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name"
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
|
||||
|
||||
|
@ -79,7 +79,7 @@ db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=6
|
||||
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
|
@ -97,7 +97,7 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Configuring system user..." --weight=2
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username="$app"
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
|
@ -106,7 +106,7 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
|||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -114,10 +114,10 @@ phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
|||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
ynh_app_setting_set --app="$app" --key=data_path --value="$data_path"
|
||||
mkdir -p "$data_path"
|
||||
chown -R $app: "$data_path"
|
||||
chown -R $app: "$final_path"
|
||||
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
|
||||
mkdir -p $data_path
|
||||
chown -R $app: $data_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION
|
||||
|
@ -147,18 +147,14 @@ ynh_psql_execute_as_root --database="$db_name" --sql="UPDATE public.mdl_config_p
|
|||
# The admin is an ldap user
|
||||
ynh_psql_execute_as_root --database="$db_name" --sql="UPDATE public.mdl_user SET auth='ldap' WHERE username='$admin';"
|
||||
|
||||
exec_as $app php${phpversion} "$final_path/admin/cli/purge_caches.php"
|
||||
exec_as $app php$phpversion "$final_path/admin/cli/purge_caches.php"
|
||||
|
||||
#=================================================
|
||||
# ADD CRON JOB
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding cron job..." --weight=2
|
||||
|
||||
# Set up poller
|
||||
cp "../conf/cron" "/etc/cron.d/$app"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
|
||||
ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
|
||||
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app"
|
||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -168,8 +164,8 @@ ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion
|
|||
ynh_script_progression --message="Securing files and directories..." --weight=1
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R $app: "$data_path"
|
||||
chown -R $app: "$final_path"
|
||||
chown -R $app: $data_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -23,13 +23,13 @@ ynh_script_progression --message="Loading settings..." --weight=1
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app="$app" --key=data_path)
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -57,9 +57,9 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring Moodle main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path=$final_path
|
||||
|
||||
ynh_restore_file --origin_path="$data_path"
|
||||
ynh_restore_file --origin_path=$data_path
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
|
@ -75,8 +75,8 @@ ynh_system_user_create --username=$app
|
|||
ynh_script_progression --message="Restoring user rights..."
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app: "$final_path"
|
||||
chown -R $app: "$data_path"
|
||||
chown -R $app: $final_path
|
||||
chown -R $app: $data_path
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
@ -96,7 +96,7 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
|
|||
ynh_script_progression --message="Reinstalling dependencies..." --weight=3
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies "$pkg_dependencies"
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
|
@ -105,9 +105,9 @@ ynh_script_progression --message="Restoring the PostgreSQL database..." --weight
|
|||
|
||||
ynh_psql_test_if_first_run
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
||||
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd"
|
||||
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
|
|
|
@ -16,13 +16,13 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||
admin=$(ynh_app_setting_get --app="$app" --key=admin)
|
||||
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app="$app" --key=data_path)
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -105,7 +105,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
|||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -126,8 +126,8 @@ ynh_store_file_checksum --file="$final_path/config.php"
|
|||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app: "$data_path"
|
||||
chown -R $app: "$final_path"
|
||||
chown -R $app: $data_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE LDAP SUPPORT
|
||||
|
@ -154,11 +154,7 @@ exec_as $app php${phpversion} "$final_path/admin/cli/purge_caches.php"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding cron job..." --weight=4
|
||||
|
||||
# Set up poller
|
||||
cp "../conf/cron" "/etc/cron.d/$app"
|
||||
ynh_replace_string "__APP__" "$app" "/etc/cron.d/$app"
|
||||
ynh_replace_string "__FINAL_PATH__" "$final_path" "/etc/cron.d/$app"
|
||||
ynh_replace_string "__PHPVERSION__" "$phpversion" "/etc/cron.d/$app"
|
||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -168,8 +164,8 @@ ynh_replace_string "__PHPVERSION__" "$phpversion" "/etc/cron.d/$app"
|
|||
ynh_script_progression --message="Securing files and directories..." --weight=1
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app: "$data_path"
|
||||
chown -R $app: "$final_path"
|
||||
chown -R $app: $data_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Reference in a new issue