mirror of
https://github.com/YunoHost-Apps/horde_ynh.git
synced 2024-09-03 19:16:08 +02:00
Add message and use getops for helper's args
This commit is contained in:
parent
fc86477bcb
commit
9f6be881b4
11 changed files with 169 additions and 193 deletions
|
@ -394,3 +394,6 @@ catch_workers_output = yes
|
||||||
; Special settings for Horde
|
; Special settings for Horde
|
||||||
php_value[include_path] = "__FINALPATH__/pear/php:.:__FINALPATH__/horde/lib"
|
php_value[include_path] = "__FINALPATH__/pear/php:.:__FINALPATH__/horde/lib"
|
||||||
env[PHP_PEAR_SYSCONF_DIR] = __FINALPATH__
|
env[PHP_PEAR_SYSCONF_DIR] = __FINALPATH__
|
||||||
|
|
||||||
|
php_value[session.gc_divisor] = 20000
|
||||||
|
php_value[session.gc_probability] = 1
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
; Common values to change to increase file upload limit
|
|
||||||
; upload_max_filesize = 50M
|
|
||||||
; post_max_size = 50M
|
|
||||||
; mail.add_x_header = Off
|
|
||||||
|
|
||||||
; Other common parameters
|
|
||||||
; max_execution_time = 600
|
|
||||||
; max_input_time = 300
|
|
||||||
; memory_limit = 256M
|
|
||||||
; short_open_tag = On
|
|
||||||
session.gc_divisor = 20000
|
|
||||||
session.gc_probability = 1
|
|
|
@ -14,7 +14,7 @@
|
||||||
"email": "josue@tille.ch"
|
"email": "josue@tille.ch"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.14.5"
|
"yunohost": ">= 3.5.2.2"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -23,43 +23,43 @@ patch_app() {
|
||||||
}
|
}
|
||||||
|
|
||||||
config_horde() {
|
config_horde() {
|
||||||
ynh_backup_if_checksum_is_different "$final_path/horde/config/conf.php"
|
ynh_backup_if_checksum_is_different --file "$final_path/horde/config/conf.php"
|
||||||
ynh_backup_if_checksum_is_different "$final_path/horde/imp/config/conf.php"
|
ynh_backup_if_checksum_is_different --file "$final_path/horde/imp/config/conf.php"
|
||||||
ynh_backup_if_checksum_is_different "$final_path/horde/config/registry.local.php"
|
ynh_backup_if_checksum_is_different --file "$final_path/horde/config/registry.local.php"
|
||||||
ynh_backup_if_checksum_is_different "$final_path/horde/gollem/config/backends.local.php"
|
ynh_backup_if_checksum_is_different --file "$final_path/horde/gollem/config/backends.local.php"
|
||||||
ynh_backup_if_checksum_is_different "$final_path/horde/ingo/config/backends.local.php"
|
ynh_backup_if_checksum_is_different --file "$final_path/horde/ingo/config/backends.local.php"
|
||||||
|
|
||||||
cp ../conf/horde_conf.php "$final_path/horde/config/conf.php"
|
cp ../conf/horde_conf.php "$final_path/horde/config/conf.php"
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/horde/config/conf.php"
|
ynh_replace_string --match_string __DOMAIN__ --replace_string "$domain" --target_file "$final_path/horde/config/conf.php"
|
||||||
ynh_replace_string "__PATH__" "$path_url" "$final_path/horde/config/conf.php"
|
ynh_replace_string --match_string __PATH__ --replace_string "$path_url" --target_file "$final_path/horde/config/conf.php"
|
||||||
ynh_replace_string "__FINAL_PATH__" "$final_path" "$final_path/horde/config/conf.php"
|
ynh_replace_string --match_string __FINAL_PATH__ --replace_string "$final_path" --target_file "$final_path/horde/config/conf.php"
|
||||||
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/horde/config/conf.php"
|
ynh_replace_string --match_string __DB_NAME__ --replace_string "$db_name" --target_file "$final_path/horde/config/conf.php"
|
||||||
ynh_replace_string "__DB_USER__" "$db_user" "$final_path/horde/config/conf.php"
|
ynh_replace_string --match_string __DB_USER__ --replace_string "$db_user" --target_file "$final_path/horde/config/conf.php"
|
||||||
ynh_replace_string "__DB_PASSWORD__" "$db_pwd" "$final_path/horde/config/conf.php"
|
ynh_replace_string --match_string __DB_PASSWORD__ --replace_string "$db_pwd" --target_file "$final_path/horde/config/conf.php"
|
||||||
ynh_replace_string "__ADMIN_USER__" "$admin" "$final_path/horde/config/conf.php"
|
ynh_replace_string --match_string __ADMIN_USER__ --replace_string "$admin" --target_file "$final_path/horde/config/conf.php"
|
||||||
ynh_replace_string "__SECRET_KEY__" "$secret_key" "$final_path/horde/config/conf.php"
|
ynh_replace_string --match_string __SECRET_KEY__ --replace_string "$secret_key" --target_file "$final_path/horde/config/conf.php"
|
||||||
|
|
||||||
cp ../conf/horde_imp_conf.php "$final_path/horde/imp/config/conf.php"
|
cp ../conf/horde_imp_conf.php "$final_path/horde/imp/config/conf.php"
|
||||||
|
|
||||||
cp ../conf/horde_registry.php "$final_path/horde/config/registry.local.php"
|
cp ../conf/horde_registry.php "$final_path/horde/config/registry.local.php"
|
||||||
ynh_replace_string "__PATH__" "$path_url" "$final_path/horde/config/registry.local.php"
|
ynh_replace_string --match_string __PATH__ --replace_string "$path_url" --target_file "$final_path/horde/config/registry.local.php"
|
||||||
|
|
||||||
cp ../conf/gollem_backends.php "$final_path/horde/gollem/config/backends.local.php"
|
cp ../conf/gollem_backends.php "$final_path/horde/gollem/config/backends.local.php"
|
||||||
ynh_replace_string "__GOLLEM_DATA_DIR__" "$gollem_data_dir" "$final_path/horde/gollem/config/backends.local.php"
|
ynh_replace_string --match_string __GOLLEM_DATA_DIR__ --replace_string "$gollem_data_dir" --target_file "$final_path/horde/gollem/config/backends.local.php"
|
||||||
|
|
||||||
cp ../conf/ingo_backends.php "$final_path/horde/ingo/config/backends.local.php"
|
cp ../conf/ingo_backends.php "$final_path/horde/ingo/config/backends.local.php"
|
||||||
|
|
||||||
ynh_store_file_checksum "$final_path/horde/config/conf.php"
|
ynh_store_file_checksum --file "$final_path/horde/config/conf.php"
|
||||||
ynh_store_file_checksum "$final_path/horde/imp/config/conf.php"
|
ynh_store_file_checksum --file "$final_path/horde/imp/config/conf.php"
|
||||||
ynh_store_file_checksum "$final_path/horde/config/registry.local.php"
|
ynh_store_file_checksum --file "$final_path/horde/config/registry.local.php"
|
||||||
ynh_store_file_checksum "$final_path/horde/gollem/config/backends.local.php"
|
ynh_store_file_checksum --file "$final_path/horde/gollem/config/backends.local.php"
|
||||||
ynh_store_file_checksum "$final_path/horde/ingo/config/backends.local.php"
|
ynh_store_file_checksum --file "$final_path/horde/ingo/config/backends.local.php"
|
||||||
}
|
}
|
||||||
|
|
||||||
config_nginx() {
|
config_nginx() {
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
[[ $service_autodiscovery ]] && add_nginx_autodiscovery
|
[[ $service_autodiscovery ]] && add_nginx_autodiscovery
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_nginx_autodiscovery() {
|
add_nginx_autodiscovery() {
|
||||||
|
|
|
@ -14,26 +14,33 @@ ynh_abort_if_errors
|
||||||
source ../settings/scripts/experimental_helper.sh
|
source ../settings/scripts/experimental_helper.sh
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
||||||
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
ynh_backup "$final_path"
|
ynh_script_progression --message="Backing up code..." --weight=3
|
||||||
|
ynh_backup --src_path "$final_path"
|
||||||
|
|
||||||
# Backup user data
|
# Backup user data
|
||||||
ynh_backup "$gollem_data_dir" "user_data" 1
|
ynh_script_progression --message="Backing up user data..." --weight=10
|
||||||
|
ynh_backup --src_path "$gollem_data_dir"
|
||||||
|
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_script_progression --message="Backing up configuration..."
|
||||||
|
ynh_backup --src_path "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_backup --src_path "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
|
|
||||||
|
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
|
ynh_script_progression --message="Backing up database"
|
||||||
ynh_mysql_dump_db "$db_name" > db.sql
|
ynh_mysql_dump_db "$db_name" > db.sql
|
||||||
|
|
||||||
|
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
|
||||||
|
|
|
@ -14,25 +14,29 @@ ynh_abort_if_errors
|
||||||
source ./experimental_helper.sh
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
domain=$YNH_APP_NEW_DOMAIN
|
domain=$YNH_APP_NEW_DOMAIN
|
||||||
path_url=$(ynh_normalize_url_path ${YNH_APP_NEW_PATH:-'/'})
|
path_url=$(ynh_normalize_url_path --path_url ${YNH_APP_NEW_PATH:-'/'})
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
admin=$(ynh_app_setting_get $app admin)
|
admin=$(ynh_app_setting_get --app $app --key admin)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get --app $app --key port)
|
||||||
secret_key=$(ynh_app_setting_get $app secret_key)
|
secret_key=$(ynh_app_setting_get --app $app --key secret_key)
|
||||||
service_autodiscovery=$(ynh_app_setting_get $app service_autodiscovery)
|
service_autodiscovery=$(ynh_app_setting_get --app $app --key service_autodiscovery)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
||||||
db_user=$(ynh_app_setting_get $app db_user)
|
db_user=$(ynh_app_setting_get --app $app --key db_user)
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Updating nginx configuration..."
|
||||||
|
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -40,16 +44,19 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
if [ "$old_domain" != "$domain" ]
|
if [ "$old_domain" != "$domain" ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum "$nginx_conf_path"
|
ynh_delete_file_checksum --file "$nginx_conf_path"
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$domain.d/$app.conf
|
mv $nginx_conf_path /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
# Store file checksum for the new config file location
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_nginx
|
config_nginx
|
||||||
|
|
||||||
# Update horde config
|
# Update horde config
|
||||||
|
ynh_script_progression --message="Configuring application..." --weight=3
|
||||||
config_horde
|
config_horde
|
||||||
|
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
|
|
||||||
# Delete a file checksum from the app settings
|
|
||||||
#
|
|
||||||
# $app should be defined when calling this helper
|
|
||||||
#
|
|
||||||
# usage: ynh_remove_file_checksum file
|
|
||||||
# | arg: file - The file for which the checksum will be deleted
|
|
||||||
ynh_delete_file_checksum () {
|
|
||||||
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
|
||||||
ynh_app_setting_delete $app $checksum_setting_name
|
|
||||||
}
|
|
||||||
|
|
||||||
# Use logrotate to manage the logfile
|
|
||||||
#
|
|
||||||
# usage: ynh_use_logrotate [logfile] [--non-append|--append] [specific_user/specific_group]
|
|
||||||
# | arg: logfile - absolute path of logfile
|
|
||||||
# | arg: --non-append - (Option) Replace the config file instead of appending this new config.
|
|
||||||
# | arg: specific_user : run logrotate as the specified user and group. If not specified logrotate is runned as root.
|
|
||||||
#
|
|
||||||
# If no argument provided, a standard directory will be use. /var/log/${app}
|
|
||||||
# You can provide a path with the directory only or with the logfile.
|
|
||||||
# /parentdir/logdir
|
|
||||||
# /parentdir/logdir/logfile.log
|
|
||||||
#
|
|
||||||
# It's possible to use this helper several times, each config will be added to the same logrotate config file.
|
|
||||||
# Unless you use the option --non-append
|
|
||||||
ynh_use_logrotate () {
|
|
||||||
local customtee="tee -a"
|
|
||||||
local user_group="${3:-}"
|
|
||||||
if [ $# -gt 0 ] && [ "$1" == "--non-append" ]; then
|
|
||||||
customtee="tee"
|
|
||||||
# Destroy this argument for the next command.
|
|
||||||
shift
|
|
||||||
elif [ $# -gt 1 ] && [ "$2" == "--non-append" ]; then
|
|
||||||
customtee="tee"
|
|
||||||
fi
|
|
||||||
if [ $# -gt 0 ]; then
|
|
||||||
if [ "$(echo ${1##*.})" == "log" ]; then # Keep only the extension to check if it's a logfile
|
|
||||||
local logfile=$1 # In this case, focus logrotate on the logfile
|
|
||||||
else
|
|
||||||
local logfile=$1/*.log # Else, uses the directory and all logfile into it.
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
local logfile="/var/log/${app}/*.log" # Without argument, use a defaut directory in /var/log
|
|
||||||
fi
|
|
||||||
local su_directive=""
|
|
||||||
if [[ -n $user_group ]]; then
|
|
||||||
su_directive=" # Run logorotate as specific user - group
|
|
||||||
su ${user_group%/*} ${user_group#*/}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat > ./${app}-logrotate << EOF # Build a config file for logrotate
|
|
||||||
$logfile {
|
|
||||||
# Rotate if the logfile exceeds 100Mo
|
|
||||||
size 100M
|
|
||||||
# Keep 12 old log maximum
|
|
||||||
rotate 12
|
|
||||||
# Compress the logs with gzip
|
|
||||||
compress
|
|
||||||
# Compress the log at the next cycle. So keep always 2 non compressed logs
|
|
||||||
delaycompress
|
|
||||||
# Copy and truncate the log to allow to continue write on it. Instead of move the log.
|
|
||||||
copytruncate
|
|
||||||
# Do not do an error if the log is missing
|
|
||||||
missingok
|
|
||||||
# Not rotate if the log is empty
|
|
||||||
notifempty
|
|
||||||
# Keep old logs in the same dir
|
|
||||||
noolddir
|
|
||||||
$su_directive
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
sudo mkdir -p $(dirname "$logfile") # Create the log directory, if not exist
|
|
||||||
cat ${app}-logrotate | sudo $customtee /etc/logrotate.d/$app > /dev/null # Append this config to the existing config file, or replace the whole config file (depending on $customtee)
|
|
||||||
}
|
|
|
@ -14,9 +14,11 @@ ynh_abort_if_errors
|
||||||
source ./experimental_helper.sh
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
ynh_script_progression --message="Validating installation parameters..."
|
||||||
|
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH)
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
service_autodiscovery=$YNH_APP_ARG_SERVICE_AUTODISCOVERY
|
service_autodiscovery=$YNH_APP_ARG_SERVICE_AUTODISCOVERY
|
||||||
|
@ -30,27 +32,28 @@ wicked_install=$YNH_APP_ARG_WICKED_INSTALL
|
||||||
final_path="/var/www/$app"
|
final_path="/var/www/$app"
|
||||||
|
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
ynh_app_setting_set $app admin $admin
|
ynh_script_progression --message="Storing installation settings..."
|
||||||
ynh_app_setting_set $app language $language
|
ynh_app_setting_set --app $app --key admin --value $admin
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set --app $app --key language --value $language
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set --app $app --key final_path --value $final_path
|
||||||
ynh_app_setting_set $app service_autodiscovery $service_autodiscovery
|
ynh_app_setting_set --app $app --key is_public --value $is_public
|
||||||
ynh_app_setting_set $app whups_install $whups_install
|
ynh_app_setting_set --app $app --key service_autodiscovery --value $service_autodiscovery
|
||||||
ynh_app_setting_set $app sesha_install $sesha_install
|
ynh_app_setting_set --app $app --key whups_install --value $whups_install
|
||||||
ynh_app_setting_set $app ansel_install $ansel_install
|
ynh_app_setting_set --app $app --key sesha_install --value $sesha_install
|
||||||
ynh_app_setting_set $app wicked_install $wicked_install
|
ynh_app_setting_set --app $app --key ansel_install --value $ansel_install
|
||||||
|
ynh_app_setting_set --app $app --key wicked_install --value $wicked_install
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available $domain $path_url
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register --app $app --domain $domain --path_url $path_url
|
||||||
|
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message "This path already contains a folder"
|
||||||
|
|
||||||
# Set list of optionnal app to install
|
# Set list of optionnal app to install
|
||||||
optionnal_apps_list=""
|
optionnal_apps_list=""
|
||||||
|
|
||||||
|
ynh_script_progression --message="Configuring options and language..."
|
||||||
|
|
||||||
if [[ $whups_install == 1 ]]
|
if [[ $whups_install == 1 ]]
|
||||||
then
|
then
|
||||||
optionnal_apps_list="$optionnal_apps_list horde/whups"
|
optionnal_apps_list="$optionnal_apps_list horde/whups"
|
||||||
|
@ -83,28 +86,33 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
|
ynh_script_progression --message="Installing dependencies..." --weight=7
|
||||||
install_dependance
|
install_dependance
|
||||||
|
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
ynh_script_progression --message="Configuring MySQL database..."
|
||||||
|
db_name=$(ynh_sanitize_dbid --db_name $app)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
ynh_app_setting_set $app db_name $db_name
|
ynh_app_setting_set --app $app --key db_name --value $db_name
|
||||||
ynh_app_setting_set $app db_user $db_user
|
ynh_app_setting_set --app $app --key db_user --value $db_user
|
||||||
db_pwd=$(ynh_string_random 15)
|
ynh_mysql_setup_db --db_name $db_name --db_user $db_user
|
||||||
ynh_mysql_setup_db $db_name $db_user $db_pwd
|
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
ynh_system_user_create --username $app
|
||||||
|
|
||||||
# Set execution for expect scripts
|
# Set execution for expect scripts
|
||||||
chmod +x ../conf/init_horde_install.exp
|
chmod +x ../conf/init_horde_install.exp
|
||||||
chmod +x ../conf/config_horde.exp
|
chmod +x ../conf/config_horde.exp
|
||||||
|
|
||||||
# Install horde by pear
|
# Install horde by pear
|
||||||
|
ynh_script_progression --message="Creating base directory..."
|
||||||
mkdir $final_path
|
mkdir $final_path
|
||||||
mkdir $final_path/data
|
mkdir $final_path/data
|
||||||
mkdir -p $gollem_data_dir
|
mkdir -p $gollem_data_dir
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installing sources files..." --weight=7
|
||||||
|
|
||||||
pear config-create "$final_path" "$final_path/pear.conf"
|
pear config-create "$final_path" "$final_path/pear.conf"
|
||||||
pear -c "$final_path/pear.conf" install -o -f pear
|
pear -c "$final_path/pear.conf" install -o -f pear
|
||||||
|
|
||||||
|
@ -123,15 +131,18 @@ $pear_cmd install -a -B horde/webmail $optionnal_apps_list
|
||||||
|
|
||||||
PHP_PEAR_SYSCONF_DIR=$final_path ../conf/config_horde.exp "$final_path" "$db_name" "$db_user" "$db_pwd" "$admin"
|
PHP_PEAR_SYSCONF_DIR=$final_path ../conf/config_horde.exp "$final_path" "$db_name" "$db_user" "$db_pwd" "$admin"
|
||||||
secret_key=$(grep 'secret_key' "$final_path/horde/config/conf.php" | cut -d"'" -f4)
|
secret_key=$(grep 'secret_key' "$final_path/horde/config/conf.php" | cut -d"'" -f4)
|
||||||
ynh_app_setting_set $app secret_key "$secret_key"
|
ynh_app_setting_set --app $app --key secret_key --value "$secret_key"
|
||||||
|
|
||||||
# Patch the app
|
# Patch the app
|
||||||
|
ynh_script_progression --message="Patching application..." --weight=7
|
||||||
patch_app
|
patch_app
|
||||||
|
|
||||||
# Configure Horde
|
# Configure Horde
|
||||||
|
ynh_script_progression --message="Configuring application..." --weight=3
|
||||||
config_horde
|
config_horde
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
|
ynh_script_progression --message="Configuring nginx..." --weight=1
|
||||||
config_nginx
|
config_nginx
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
|
@ -142,17 +153,22 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
|
ynh_script_progression --message="Protecting directory..."
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
# configure the sso
|
# configure the sso
|
||||||
|
ynh_script_progression --message="Configuring permissions..."
|
||||||
if [ "$is_public" = "0" ];
|
if [ "$is_public" = "0" ];
|
||||||
then # Retire l'accès public
|
then # Retire l'accès public
|
||||||
ynh_app_setting_delete $app skipped_uris
|
ynh_app_setting_delete --app $app --key skipped_uris
|
||||||
else
|
else
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set --app $app --key unprotected_uris --value "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
ynh_use_logrotate $final_path/horde --non-append www-data/horde
|
ynh_script_progression --message="Configuring log rotation..."
|
||||||
ynh_use_logrotate $final_path/horde/services --append www-data/horde
|
ynh_use_logrotate $final_path/horde --non-append --specific_user www-data/horde
|
||||||
ynh_use_logrotate $final_path/horde/services/portal --append www-data/horde
|
ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde
|
||||||
|
ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -11,39 +11,48 @@ source /usr/share/yunohost/helpers
|
||||||
source ./experimental_helper.sh
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
port=$(ynh_app_setting_get --app $app --key port)
|
||||||
port=$(ynh_app_setting_get $app port)
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_user=$(ynh_app_setting_get --app $app --key db_user)
|
||||||
db_user=$(ynh_app_setting_get $app db_user)
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_script_progression --message="Removing dependencies" --weight=10
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mysql_remove_db $db_user $db_name
|
ynh_script_progression --message="Removing databases..."
|
||||||
|
ynh_mysql_remove_db --db_user $db_user --db_name $db_name
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "$final_path"
|
ynh_script_progression --message="Removing code..."
|
||||||
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
# Remove user data
|
# Remove user data
|
||||||
ynh_secure_remove "$gollem_data_dir"
|
ynh_script_progression --message="Removing user data..."
|
||||||
|
ynh_secure_remove --file="$gollem_data_dir"
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
|
ynh_script_progression --message="Removing nginx configuration..."
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete $app
|
ynh_script_progression --message="Removing the dedicated system user..."
|
||||||
|
ynh_system_user_delete --username $app
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
|
@ -14,47 +14,56 @@ ynh_abort_if_errors
|
||||||
source ../settings/scripts/experimental_helper.sh
|
source ../settings/scripts/experimental_helper.sh
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
ynh_script_progression --message="Loading settings..."
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
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)
|
||||||
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
ynh_webpath_available $domain $path_url \
|
ynh_webpath_available --domain $domain --path_url $path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die --message "Path not available: ${domain}${path_url}"
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|| ynh_die --message "There is already a directory: $final_path "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
||||||
install_dependance
|
install_dependance
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create --username $app
|
||||||
|
|
||||||
# Restore all config and data
|
# Restore all config and data
|
||||||
|
ynh_script_progression --message="Restoring files..." --weight=10
|
||||||
ynh_restore
|
ynh_restore
|
||||||
|
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
ynh_script_progression --message="Restoring database..." --weight=3
|
||||||
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||||
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
ynh_mysql_setup_db --db_user $db_name --db_name $db_name --db_pwd $db_pwd
|
||||||
|
ynh_mysql_connect_as --user $db_name --password $db_pwd --database $db_name < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
|
ynh_script_progression --message="Protecting directory..."
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
ynh_use_logrotate $final_path/horde --non-append www-data/horde
|
ynh_script_progression --message="Configuring log rotation..."
|
||||||
ynh_use_logrotate $final_path/horde/services --append www-data/horde
|
ynh_use_logrotate $final_path/horde --non-append --specific_user www-data/horde
|
||||||
ynh_use_logrotate $final_path/horde/services/portal --append www-data/horde
|
ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde
|
||||||
|
ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde
|
||||||
|
|
||||||
# Reload services
|
# Reload services
|
||||||
systemctl reload php5-fpm
|
systemctl reload php5-fpm
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
|
@ -14,17 +14,19 @@ ynh_abort_if_errors
|
||||||
source ./experimental_helper.sh
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get $app path))
|
path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path))
|
||||||
admin=$(ynh_app_setting_get $app admin)
|
admin=$(ynh_app_setting_get --app $app --key admin)
|
||||||
service_autodiscovery=$(ynh_app_setting_get $app service_autodiscovery)
|
service_autodiscovery=$(ynh_app_setting_get --app $app --key service_autodiscovery)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get --app $app --key port)
|
||||||
secret_key=$(ynh_app_setting_get $app secret_key)
|
secret_key=$(ynh_app_setting_get --app $app --key secret_key)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
||||||
db_user=$(ynh_app_setting_get $app db_user)
|
db_user=$(ynh_app_setting_get --app $app --key db_user)
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -41,20 +43,26 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..."
|
||||||
install_dependance
|
install_dependance
|
||||||
|
|
||||||
# Upgrade Horde by PEAR
|
# Upgrade Horde by PEAR
|
||||||
|
ynh_script_progression --message="Upgrading source files..." --weight=6
|
||||||
pear_cmd="$final_path/pear/pear -c $final_path/pear.conf"
|
pear_cmd="$final_path/pear/pear -c $final_path/pear.conf"
|
||||||
$pear_cmd channel-update pear.horde.org
|
$pear_cmd channel-update pear.horde.org
|
||||||
$pear_cmd upgrade -R $final_path -a -B -c pear.horde.org || true
|
$pear_cmd upgrade -R $final_path -a -B -c pear.horde.org || true
|
||||||
|
|
||||||
# Patch the app
|
# Patch the app
|
||||||
|
ynh_script_progression --message="Patching application..." --weight=7
|
||||||
patch_app
|
patch_app
|
||||||
|
|
||||||
# Configure Horde
|
# Configure Horde
|
||||||
|
ynh_script_progression --message="Configuring application..." --weight=3
|
||||||
config_horde
|
config_horde
|
||||||
|
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
# Create a dedicated nginx config
|
||||||
|
ynh_script_progression --message="Configuring nginx..." --weight=1
|
||||||
config_nginx
|
config_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -62,9 +70,13 @@ config_nginx
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
|
ynh_script_progression --message="Protecting directory..."
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
ynh_use_logrotate $final_path/horde --non-append www-data/horde
|
ynh_script_progression --message="Configuring log rotation..."
|
||||||
ynh_use_logrotate $final_path/horde/services --append www-data/horde
|
ynh_use_logrotate $final_path/horde --non-append --specific_user www-data/horde
|
||||||
ynh_use_logrotate $final_path/horde/services/portal --append www-data/horde
|
ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde
|
||||||
|
ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde
|
||||||
|
|
||||||
|
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||||
|
|
Loading…
Reference in a new issue