1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/grav_ynh.git synced 2024-09-03 19:16:01 +02:00
This commit is contained in:
ericgaspar 2021-11-29 20:25:33 +01:00
parent f069ac6eaf
commit aad6b2e2ef
9 changed files with 38 additions and 33 deletions

View file

@ -3,4 +3,3 @@ SOURCE_SUM=5a4b543ff62fed497a0e0c429389cd730df1cc59327567df02c3dff834af069a
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -3,4 +3,3 @@ SOURCE_SUM=6ee7e6d0008dbbad448718ecd2d714173a1f4e17698805621e1cd1a6e802eb75
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -3,9 +3,6 @@ location __PATH__/ {
alias __FINALPATH__/;
index index.php;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
client_max_body_size 30m;
# Add headers to serve security related headers

View file

@ -37,7 +37,7 @@
}
],
"requirements": {
"yunohost": ">= 4.1.0"
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
@ -47,8 +47,7 @@
"install": [
{
"name": "domain",
"type": "domain",
"example": "example.org"
"type": "domain"
},
{
"name": "path",
@ -58,8 +57,7 @@
},
{
"name": "admin",
"type": "user",
"example": "johndoe"
"type": "user"
},
{
"name": "is_public",

View file

@ -8,22 +8,8 @@
YNH_PHP_VERSION="7.3"
# dependencies used by the app
extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap"
pkg_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap"
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]
then
eval $@
else
sudo -u "$USER" $@
fi
}

View file

@ -51,6 +51,13 @@ 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=language --value=$language
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -108,8 +115,8 @@ ynh_script_progression --message="Installing and configuring LDAP plugin..." --w
ynh_setup_source --dest_dir="$final_path/user/plugins/login-ldap" --source_id="ldap"
# Preparing config
exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
exec_as $app touch "$final_path/user/accounts/admin.yaml"
ynh_exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
ynh_exec_as $app touch "$final_path/user/accounts/admin.yaml"
# Setting up config
ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml"

View file

@ -61,6 +61,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -40,8 +40,7 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
@ -90,8 +89,13 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# GENERIC FINALIZATION

View file

@ -115,6 +115,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -146,8 +153,8 @@ ynh_script_progression --message="Installing and configuring LDAP plugin..." --w
# Download LDAP source
ynh_setup_source --dest_dir="$final_path/user/plugins/login-ldap" --source_id="ldap"
exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
exec_as $app touch "$final_path/user/accounts/admin.yaml"
ynh_exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
ynh_exec_as $app touch "$final_path/user/accounts/admin.yaml"
ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml"
chown $app:$app "$final_path/user/config/plugins/login-ldap.yaml"