mirror of
https://github.com/YunoHost-Apps/grav_ynh.git
synced 2024-09-03 19:16:01 +02:00
commit
17b96de2a6
9 changed files with 40 additions and 37 deletions
|
@ -3,4 +3,3 @@ SOURCE_SUM=5a4b543ff62fed497a0e0c429389cd730df1cc59327567df02c3dff834af069a
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=zip
|
SOURCE_FORMAT=zip
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
SOURCE_FILENAME=
|
|
||||||
|
|
|
@ -3,4 +3,3 @@ SOURCE_SUM=6ee7e6d0008dbbad448718ecd2d714173a1f4e17698805621e1cd1a6e802eb75
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=zip
|
SOURCE_FORMAT=zip
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
SOURCE_FILENAME=
|
|
||||||
|
|
|
@ -3,9 +3,6 @@ location __PATH__/ {
|
||||||
alias __FINALPATH__/;
|
alias __FINALPATH__/;
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
if ($scheme = http) {
|
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
|
||||||
}
|
|
||||||
client_max_body_size 30m;
|
client_max_body_size 30m;
|
||||||
|
|
||||||
# Add headers to serve security related headers
|
# Add headers to serve security related headers
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.1.0"
|
"yunohost": ">= 4.3.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -47,8 +47,7 @@
|
||||||
"install": [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain"
|
||||||
"example": "example.org"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
|
@ -58,8 +57,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user"
|
||||||
"example": "johndoe"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
|
|
|
@ -8,22 +8,8 @@
|
||||||
YNH_PHP_VERSION="7.3"
|
YNH_PHP_VERSION="7.3"
|
||||||
|
|
||||||
# dependencies used by the app
|
# 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
|
# 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
|
|
||||||
}
|
|
||||||
|
|
|
@ -36,8 +36,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available --domain=$domain --path_url=$path_url
|
|
||||||
# Register (book) web path
|
# 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
|
||||||
|
|
||||||
|
@ -51,6 +49,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=admin --value=$admin
|
||||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
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
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -84,7 +89,7 @@ ynh_add_nginx_config
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=3
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=3
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config --usage=medium --footprint=medium --package="$extra_php_dependencies"
|
ynh_add_fpm_config --usage=medium --footprint=medium
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -108,8 +113,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"
|
ynh_setup_source --dest_dir="$final_path/user/plugins/login-ldap" --source_id="ldap"
|
||||||
|
|
||||||
# Preparing config
|
# Preparing config
|
||||||
exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
|
ynh_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 touch "$final_path/user/accounts/admin.yaml"
|
||||||
|
|
||||||
# Setting up config
|
# Setting up config
|
||||||
ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml"
|
ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml"
|
||||||
|
|
|
@ -61,6 +61,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
ynh_remove_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
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -40,8 +40,7 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
test ! -d $final_path \
|
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# 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
|
# 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"
|
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..." --weight=1
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -115,6 +115,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_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
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -129,7 +136,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||||
|
|
||||||
# Delete existing ini configuration file (backward compatibility)
|
# Delete existing ini configuration file (backward compatibility)
|
||||||
if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then
|
if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then
|
||||||
|
@ -146,8 +153,8 @@ ynh_script_progression --message="Installing and configuring LDAP plugin..." --w
|
||||||
# Download LDAP source
|
# Download LDAP source
|
||||||
ynh_setup_source --dest_dir="$final_path/user/plugins/login-ldap" --source_id="ldap"
|
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"
|
ynh_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 touch "$final_path/user/accounts/admin.yaml"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.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"
|
chown $app:$app "$final_path/user/config/plugins/login-ldap.yaml"
|
||||||
|
|
Loading…
Reference in a new issue