mirror of
https://github.com/YunoHost-Apps/horde_ynh.git
synced 2024-09-03 19:16:08 +02:00
Apply example_ynh
This commit is contained in:
parent
4152be6f5b
commit
053a1c3c90
10 changed files with 74 additions and 77 deletions
|
@ -6,7 +6,7 @@
|
|||
"en": "A groupware (webmail, adressbook, calendar) that uses PHP",
|
||||
"fr": "Un groupware (webmail, carnet adresses, agenda), utilisant PHP."
|
||||
},
|
||||
"version": "5.2.22~ynh4",
|
||||
"version": "5.2.22~ynh5",
|
||||
"url": "https://www.horde.org/",
|
||||
"upstream": {
|
||||
"license": "LGPL-2.0",
|
||||
|
@ -62,12 +62,7 @@
|
|||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose an admin user",
|
||||
"fr": "Choisissez l’administrateur"
|
||||
},
|
||||
"example": "johndoe"
|
||||
"type": "user"
|
||||
},
|
||||
{
|
||||
"name": "service_autodiscovery",
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# SET ALL CONSTANTS
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="php-pear expect php5-imagick|php-imagick php5-tidy|php-tidy php-bcmath"
|
||||
|
||||
#=================================================
|
||||
# DEFINE ALL COMMON FONCTIONS
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
install_dependance() {
|
||||
ynh_install_app_dependencies php-pear expect 'php5-imagick|php-imagick' 'php5-tidy|php-tidy' php-bcmath
|
||||
}
|
||||
|
||||
patch_app() {
|
||||
local old_dir=$(pwd)
|
||||
(cd "$final_path/horde" && patch -p1 < $YNH_CWD/../sources/sso_auth.patch) || echo "Unable to apply patches"
|
||||
|
@ -95,3 +92,11 @@ set_permission() {
|
|||
chmod u=rwX,g=rwX,o= -R $final_path
|
||||
chmod u=rwX,g=rwX,o= -R $gollem_data_dir
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -17,7 +17,7 @@ old_domain=$YNH_APP_OLD_DOMAIN
|
|||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$(ynh_normalize_url_path --path_url ${YNH_APP_NEW_PATH:-'/'})
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -35,7 +35,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
||||
service_autodiscovery=$(ynh_app_setting_get --app=$app --key=service_autodiscovery)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
gollem_data_dir=$(ynh_app_setting_get --app=$app --key=gollem_data_dir)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH)
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
|
@ -103,7 +103,7 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=7
|
||||
|
||||
install_dependance
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -121,7 +121,6 @@ ynh_script_progression --message="Creating a MySQL database..."
|
|||
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_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
|
@ -138,14 +137,6 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
config_nginx
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -154,6 +145,14 @@ ynh_script_progression --message="Configuring PHP-FPM..."
|
|||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
config_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
|
|
@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -31,7 +31,7 @@ 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)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
db_user=$db_name
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
gollem_data_dir=$(ynh_app_setting_get --app=$app --key=gollem_data_dir)
|
||||
|
||||
|
@ -45,13 +45,6 @@ test ! -d $final_path \
|
|||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -76,14 +69,6 @@ ynh_restore_file --origin_path="$gollem_data_dir"
|
|||
|
||||
mkdir -p $gollem_data_dir
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
|
@ -91,8 +76,21 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
||||
|
||||
install_dependance
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
|
|
|
@ -19,13 +19,13 @@ 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)
|
||||
service_autodiscovery=$(ynh_app_setting_get --app=$app --key=service_autodiscovery)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
service_autodiscovery=$(ynh_app_setting_get --app=$app --key=service_autodiscovery)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
gollem_data_dir=$(ynh_app_setting_get --app=$app --key=gollem_data_dir)
|
||||
|
||||
#=================================================
|
||||
|
@ -64,7 +64,7 @@ if ynh_legacy_permissions_exists; then
|
|||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
# If gollem_data_dir doesn't exist, create it
|
||||
if [ -z "$gollem_data_dir" ]; then
|
||||
gollem_data_dir=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=gollem_data_dir --value=$gollem_data_dir
|
||||
|
@ -77,20 +77,12 @@ ynh_script_progression --message="Making sure dedicated system user exists..."
|
|||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
config_nginx
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
install_dependance
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
|
@ -100,6 +92,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
|||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
config_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue