mirror of
https://github.com/YunoHost-Apps/dotclear2_ynh.git
synced 2024-09-03 18:26:29 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
6baf817cd3
commit
6ce3b38c50
12 changed files with 127 additions and 221 deletions
|
@ -1,4 +0,0 @@
|
|||
; Additional php.ini defines, specific to this pool of workers.
|
||||
|
||||
php_admin_value[upload_max_filesize] = 50M
|
||||
php_admin_value[post_max_size] = 50M
|
|
@ -12,7 +12,7 @@ location __PATH__/ {
|
|||
try_files $uri $uri/ index.php;
|
||||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
|
||||
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
|
|
|
@ -21,7 +21,8 @@ cpe = "cpe:2.3:a:dotclear:dotclear"
|
|||
fund = "https://dotclear.org/donate"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
|
||||
|
@ -68,6 +69,7 @@ ram.runtime = "50M"
|
|||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
group = "www-data:r-x"
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
|
||||
_dotclear2_setup_source() {
|
||||
|
@ -19,11 +15,3 @@ _dotclear2_setup_source() {
|
|||
ynh_setup_source --dest_dir="$install_dir" --source_id="attic"
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -1,54 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$install_dir"
|
||||
ynh_backup "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_backup "/etc/fail2ban/filter.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the MySQL database..."
|
||||
ynh_print_info "Backing up the MySQL database..."
|
||||
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
ynh_mysql_dump_db > db.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -1,52 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
ynh_config_change_url_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# UPDATE THE DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating database..."
|
||||
ynh_script_progression "Updating database..."
|
||||
|
||||
new_index_url="${new_path%/}/index.php"
|
||||
new_public_url="${new_path%/}/public"
|
||||
new_themes_url="${new_path%/}/themes"
|
||||
|
||||
ynh_mysql_execute_as_root --sql="UPDATE dc_blog SET blog_url='https://$new_domain$new_index_url?' WHERE dc_blog.blog_id='default'" --database=$db_name
|
||||
ynh_mysql_execute_as_root --sql="UPDATE dc_setting SET setting_value='$new_public_url' WHERE dc_setting.setting_id='public_url'" --database=$db_name
|
||||
ynh_mysql_execute_as_root --sql="UPDATE dc_setting SET setting_value='$new_themes_url' WHERE dc_setting.setting_id='themes_url'" --database=$db_name
|
||||
ynh_mysql_db_shell <<< "UPDATE dc_blog SET blog_url='https://$new_domain$new_index_url?' WHERE dc_blog.blog_id='default'"
|
||||
|
||||
ynh_mysql_db_shell <<< "UPDATE dc_setting SET setting_value='$new_public_url' WHERE dc_setting.setting_id='public_url'"
|
||||
|
||||
ynh_mysql_db_shell <<< "UPDATE dc_setting SET setting_value='$new_themes_url' WHERE dc_setting.setting_id='themes_url'"
|
||||
|
||||
#=================================================
|
||||
# UPDATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating configuration file..."
|
||||
ynh_script_progression "Updating configuration file..."
|
||||
|
||||
php_config=$install_dir/inc/config.php
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$php_config"
|
||||
ynh_backup_if_checksum_is_different "$php_config"
|
||||
|
||||
new_admin_url="${new_path%/}/admin/"
|
||||
old_admin_url="${old_path%/}/admin/"
|
||||
ynh_replace_string --match_string="'DC_ADMIN_URL', 'https://$old_domain$old_admin_url'" --replace_string="'DC_ADMIN_URL', 'https://$new_domain$new_admin_url'" --target_file=$php_config
|
||||
ynh_replace --match="'DC_ADMIN_URL', 'https://$old_domain$old_admin_url'" --replace="'DC_ADMIN_URL', 'https://$new_domain$new_admin_url'" --file=$php_config
|
||||
|
||||
ynh_store_file_checksum --file="$php_config"
|
||||
ynh_store_file_checksum "$php_config"
|
||||
|
||||
chmod 400 "$php_config"
|
||||
chown $app:$app "$php_config"
|
||||
|
@ -55,4 +49,4 @@ chown $app:$app "$php_config"
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
install_dir=$(ynh_app_setting_get --key=install_dir)
|
||||
admin=$(ynh_app_setting_get --key=admin)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||
|
@ -55,19 +49,19 @@ set__blogs_list() {
|
|||
if [ ynh_permission_exists --permission="$id" ]; then
|
||||
ynh_permission_delete --permission="$id"
|
||||
fi
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/${old_domain_array[$id]}.d/$app.conf"
|
||||
ynh_safe_rm "/etc/nginx/conf.d/${old_domain_array[$id]}.d/$app.conf"
|
||||
done
|
||||
|
||||
for id in $domain_array; do
|
||||
|
||||
|
||||
if [ $domain_array[$id] != $old_domain_array[$id] ]; then
|
||||
mv /etc/nginx/conf.d/${old_domain_array[$id]}.d/$app.conf /etc/nginx/conf.d/${domain_array[$id]}.d/$app.conf
|
||||
fi
|
||||
|
||||
|
||||
if [ $path_array[$id] != $old_path_array[$id] ]; then
|
||||
domain=$domain_array[$id]
|
||||
path=$path_array[$id]
|
||||
ynh_add_config --template="nginx.conf" --destination="/etc/nginx/conf.d/${domain_array[$id]}.d/$app.conf"
|
||||
ynh_config_add --template="nginx.conf" --destination="/etc/nginx/conf.d/${domain_array[$id]}.d/$app.conf"
|
||||
fi
|
||||
|
||||
if [ ynh_permission_exists --permission="$id" ]; then
|
||||
|
@ -77,13 +71,11 @@ set__blogs_list() {
|
|||
ynh_permission_create --permission="$id" --url="$domain_array[$id]$path_array[$id]"
|
||||
ynh_permission_create --permission="$id.admin" --url="$domain_array[$id]$path_array[$id]/admin"
|
||||
fi
|
||||
|
||||
|
||||
done
|
||||
|
||||
|
||||
ynh_app_setting_set $app blogs_list $blogs_list
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
ynh_app_config_run $1
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=4
|
||||
ynh_script_progression "Setting up source files..."
|
||||
|
||||
_dotclear2_setup_source
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
# https://dotclear.org/documentation/2.0/admin/install
|
||||
mkdir -p "$install_dir/"{cache,public}
|
||||
setfacl -m d:u:www-data:rwx "$install_dir/"{cache,public}
|
||||
|
@ -27,46 +20,46 @@ setfacl -m d:u:www-data:rwx "$install_dir/"{cache,public}
|
|||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Adding system configurations related to $app..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
ynh_script_progression "Adding $app's configuration..."
|
||||
|
||||
php_config=$install_dir/inc/config.php
|
||||
|
||||
admin=$(yunohost user permission info "$app.admin" --output-as json | jq -r '.allowed | .[]')
|
||||
|
||||
master_key=$(ynh_string_random --length=30)
|
||||
ynh_app_setting_set --app=$app --key=master_key --value=$master_key
|
||||
ynh_app_setting_set --key=master_key --value=$master_key
|
||||
|
||||
cp $php_config.in $php_config
|
||||
|
||||
admin_url="${path%/}/admin/"
|
||||
|
||||
admin=$(yunohost user permission info "$app.admin" --output-as json | jq -r '.allowed | .[]')
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
ynh_app_setting_set --key=admin --value=$admin
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
|
||||
# Config as if we called in admin/install/wizard.php
|
||||
ynh_replace_string --match_string="'DC_DBDRIVER', ''" --replace_string="'DC_DBDRIVER', 'mysqli'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_DBHOST', ''" --replace_string="'DC_DBHOST', 'localhost'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_DBUSER', ''" --replace_string="'DC_DBUSER', '$db_user'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_DBPASSWORD', ''" --replace_string="'DC_DBPASSWORD', '$db_pwd'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_DBNAME', ''" --replace_string="'DC_DBNAME', '$db_name'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_MASTER_KEY', ''" --replace_string="'DC_MASTER_KEY', '$master_key'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_ADMIN_URL', ''" --replace_string="'DC_ADMIN_URL', 'https://$domain$admin_url'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_ADMIN_MAILFROM', ''" --replace_string="'DC_ADMIN_MAILFROM', '$email'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="//define('DC_NOT_UPDATE', false);" --replace_string="define('DC_NOT_UPDATE', true);" --target_file=$php_config
|
||||
ynh_replace --match="'DC_DBDRIVER', ''" --replace="'DC_DBDRIVER', 'mysqli'" --file=$php_config
|
||||
ynh_replace --match="'DC_DBHOST', ''" --replace="'DC_DBHOST', 'localhost'" --file=$php_config
|
||||
ynh_replace --match="'DC_DBUSER', ''" --replace="'DC_DBUSER', '$db_user'" --file=$php_config
|
||||
ynh_replace --match="'DC_DBPASSWORD', ''" --replace="'DC_DBPASSWORD', '$db_pwd'" --file=$php_config
|
||||
ynh_replace --match="'DC_DBNAME', ''" --replace="'DC_DBNAME', '$db_name'" --file=$php_config
|
||||
ynh_replace --match="'DC_MASTER_KEY', ''" --replace="'DC_MASTER_KEY', '$master_key'" --file=$php_config
|
||||
ynh_replace --match="'DC_ADMIN_URL', ''" --replace="'DC_ADMIN_URL', 'https://$domain$admin_url'" --file=$php_config
|
||||
ynh_replace --match="'DC_ADMIN_MAILFROM', ''" --replace="'DC_ADMIN_MAILFROM', '$email'" --file=$php_config
|
||||
ynh_replace --match="//define('DC_NOT_UPDATE', false);" --replace="define('DC_NOT_UPDATE', true);" --file=$php_config
|
||||
|
||||
# Adding LDAP login
|
||||
blog_admin="false"
|
||||
|
@ -80,18 +73,18 @@ blog_media="false"
|
|||
blog_pages="false"
|
||||
blog_blogroll="false"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=blog_admin --value=$blog_admin
|
||||
ynh_app_setting_set --app=$app --key=blog_contentadmin --value=$blog_contentadmin
|
||||
ynh_app_setting_set --app=$app --key=blog_usage --value=$blog_usage
|
||||
ynh_app_setting_set --app=$app --key=blog_publish --value=$blog_publish
|
||||
ynh_app_setting_set --app=$app --key=blog_delete --value=$blog_delete
|
||||
ynh_app_setting_set --app=$app --key=blog_categories --value=$blog_categories
|
||||
ynh_app_setting_set --app=$app --key=blog_media_admin --value=$blog_media_admin
|
||||
ynh_app_setting_set --app=$app --key=blog_media --value=$blog_media
|
||||
ynh_app_setting_set --app=$app --key=blog_pages --value=$blog_pages
|
||||
ynh_app_setting_set --app=$app --key=blog_blogroll --value=$blog_blogroll
|
||||
ynh_app_setting_set --key=blog_admin --value=$blog_admin
|
||||
ynh_app_setting_set --key=blog_contentadmin --value=$blog_contentadmin
|
||||
ynh_app_setting_set --key=blog_usage --value=$blog_usage
|
||||
ynh_app_setting_set --key=blog_publish --value=$blog_publish
|
||||
ynh_app_setting_set --key=blog_delete --value=$blog_delete
|
||||
ynh_app_setting_set --key=blog_categories --value=$blog_categories
|
||||
ynh_app_setting_set --key=blog_media_admin --value=$blog_media_admin
|
||||
ynh_app_setting_set --key=blog_media --value=$blog_media
|
||||
ynh_app_setting_set --key=blog_pages --value=$blog_pages
|
||||
ynh_app_setting_set --key=blog_blogroll --value=$blog_blogroll
|
||||
|
||||
ynh_add_config --template="../conf/class.auth.ldap.php" --destination="$install_dir/inc/class.auth.ldap.php"
|
||||
ynh_config_add --template="class.auth.ldap.php" --destination="$install_dir/inc/class.auth.ldap.php"
|
||||
|
||||
cat << EOF >> $php_config
|
||||
|
||||
|
@ -99,7 +92,7 @@ require dirname(__FILE__).'/class.auth.ldap.php';
|
|||
define('DC_AUTH_CLASS','ldapDcAuth');
|
||||
EOF
|
||||
|
||||
ynh_store_file_checksum --file=$php_config
|
||||
ynh_store_file_checksum $php_config
|
||||
|
||||
chmod 400 "$php_config"
|
||||
chown $app:$app "$php_config"
|
||||
|
@ -107,7 +100,7 @@ chown $app:$app "$php_config"
|
|||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finalizing installation..." --weight=14
|
||||
ynh_script_progression "Finalizing installation..."
|
||||
|
||||
firstname=$(ynh_user_get_info --username=$admin --key=firstname)
|
||||
lastname=$(ynh_user_get_info --username=$admin --key=lastname)
|
||||
|
@ -120,15 +113,13 @@ installUrl="/admin/install/index.php"
|
|||
|
||||
ynh_local_curl $installUrl "u_email=$email" "u_firstname=$firstname" "u_name=$lastname" "u_login=$admin" "u_pwd=$password" "u_pwd2=$password"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Fail2Ban..."
|
||||
ynh_script_progression "Configuring Fail2Ban..."
|
||||
|
||||
# Create a dedicated Fail2Ban config
|
||||
ynh_add_fail2ban_config \
|
||||
ynh_config_add_fail2ban \
|
||||
--logpath="/var/log/nginx/${domain}-error.log" \
|
||||
--failregex="Invalid credentials in $install_dir/inc/class.auth.ldap.php .* client: <HOST>, .*https://$domain${path%/}/admin/auth.php"
|
||||
|
||||
|
@ -136,4 +127,4 @@ ynh_add_fail2ban_config \
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,30 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Removing system configurations related to $app..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
ynh_config_remove_phpfpm
|
||||
|
||||
# Remove the dedicated Fail2Ban config
|
||||
ynh_remove_fail2ban_config
|
||||
ynh_config_remove_fail2ban
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
@ -13,13 +7,12 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
ynh_script_progression "Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
ynh_restore "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
# https://dotclear.org/documentation/2.0/admin/install
|
||||
mkdir -p "$install_dir/"{cache,public}
|
||||
setfacl -m d:u:www-data:rwx "$install_dir/"{cache,public}
|
||||
|
@ -27,37 +20,35 @@ setfacl -m d:u:www-data:rwx "$install_dir/"{cache,public}
|
|||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=3
|
||||
ynh_script_progression "Restoring the MySQL database..."
|
||||
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
ynh_mysql_db_shell < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Restoring system configurations related to $app..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
ynh_restore "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore "/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemctl --action=restart --service=fail2ban
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemctl --service=php$php_version-fpm --action=reload
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -1,26 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
ynh_script_progression "Ensuring downward compatibility..."
|
||||
|
||||
if [ -z "${blog_admin:-}" ] ||
|
||||
[ -z "$blog_contentadmin" ] ||
|
||||
|
@ -42,32 +28,32 @@ if [ -z "${blog_admin:-}" ] ||
|
|||
blog_media="false"
|
||||
blog_pages="false"
|
||||
blog_blogroll="false"
|
||||
ynh_app_setting_set --app=$app --key=blog_admin --value=$blog_admin
|
||||
ynh_app_setting_set --app=$app --key=blog_contentadmin --value=$blog_contentadmin
|
||||
ynh_app_setting_set --app=$app --key=blog_usage --value=$blog_usage
|
||||
ynh_app_setting_set --app=$app --key=blog_publish --value=$blog_publish
|
||||
ynh_app_setting_set --app=$app --key=blog_delete --value=$blog_delete
|
||||
ynh_app_setting_set --app=$app --key=blog_categories --value=$blog_categories
|
||||
ynh_app_setting_set --app=$app --key=blog_media_admin --value=$blog_media_admin
|
||||
ynh_app_setting_set --app=$app --key=blog_media --value=$blog_media
|
||||
ynh_app_setting_set --app=$app --key=blog_pages --value=$blog_pages
|
||||
ynh_app_setting_set --app=$app --key=blog_blogroll --value=$blog_blogroll
|
||||
ynh_app_setting_set --key=blog_admin --value=$blog_admin
|
||||
ynh_app_setting_set --key=blog_contentadmin --value=$blog_contentadmin
|
||||
ynh_app_setting_set --key=blog_usage --value=$blog_usage
|
||||
ynh_app_setting_set --key=blog_publish --value=$blog_publish
|
||||
ynh_app_setting_set --key=blog_delete --value=$blog_delete
|
||||
ynh_app_setting_set --key=blog_categories --value=$blog_categories
|
||||
ynh_app_setting_set --key=blog_media_admin --value=$blog_media_admin
|
||||
ynh_app_setting_set --key=blog_media --value=$blog_media
|
||||
ynh_app_setting_set --key=blog_pages --value=$blog_pages
|
||||
ynh_app_setting_set --key=blog_blogroll --value=$blog_blogroll
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
|
||||
if ynh_app_upstream_version_changed
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
_dotclear2_setup_source
|
||||
fi
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
# https://dotclear.org/documentation/2.0/admin/install
|
||||
mkdir -p "$install_dir/"{cache,public}
|
||||
setfacl -m d:u:www-data:rwx "$install_dir/"{cache,public}
|
||||
|
@ -75,24 +61,22 @@ setfacl -m d:u:www-data:rwx "$install_dir/"{cache,public}
|
|||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
ynh_script_progression "Updating configuration..."
|
||||
|
||||
php_config=$install_dir/inc/config.php
|
||||
|
||||
ynh_backup_if_checksum_is_different --file=$php_config
|
||||
ynh_backup_if_checksum_is_different $php_config
|
||||
|
||||
cp $php_config.in $php_config
|
||||
|
||||
|
@ -101,18 +85,18 @@ admin_url="${path%/}/admin/"
|
|||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
|
||||
# Config as if we called in admin/install/wizard.php
|
||||
ynh_replace_string --match_string="'DC_DBDRIVER', ''" --replace_string="'DC_DBDRIVER', 'mysqli'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_DBHOST', ''" --replace_string="'DC_DBHOST', 'localhost'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_DBUSER', ''" --replace_string="'DC_DBUSER', '$db_user'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_DBPASSWORD', ''" --replace_string="'DC_DBPASSWORD', '$db_pwd'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_DBNAME', ''" --replace_string="'DC_DBNAME', '$db_name'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_MASTER_KEY', ''" --replace_string="'DC_MASTER_KEY', '$master_key'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_ADMIN_URL', ''" --replace_string="'DC_ADMIN_URL', 'https://$domain$admin_url'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="'DC_ADMIN_MAILFROM', ''" --replace_string="'DC_ADMIN_MAILFROM', '$email'" --target_file=$php_config
|
||||
ynh_replace_string --match_string="//define('DC_NOT_UPDATE', false);" --replace_string="define('DC_NOT_UPDATE', true);" --target_file=$php_config
|
||||
ynh_replace --match="'DC_DBDRIVER', ''" --replace="'DC_DBDRIVER', 'mysqli'" --file=$php_config
|
||||
ynh_replace --match="'DC_DBHOST', ''" --replace="'DC_DBHOST', 'localhost'" --file=$php_config
|
||||
ynh_replace --match="'DC_DBUSER', ''" --replace="'DC_DBUSER', '$db_user'" --file=$php_config
|
||||
ynh_replace --match="'DC_DBPASSWORD', ''" --replace="'DC_DBPASSWORD', '$db_pwd'" --file=$php_config
|
||||
ynh_replace --match="'DC_DBNAME', ''" --replace="'DC_DBNAME', '$db_name'" --file=$php_config
|
||||
ynh_replace --match="'DC_MASTER_KEY', ''" --replace="'DC_MASTER_KEY', '$master_key'" --file=$php_config
|
||||
ynh_replace --match="'DC_ADMIN_URL', ''" --replace="'DC_ADMIN_URL', 'https://$domain$admin_url'" --file=$php_config
|
||||
ynh_replace --match="'DC_ADMIN_MAILFROM', ''" --replace="'DC_ADMIN_MAILFROM', '$email'" --file=$php_config
|
||||
ynh_replace --match="//define('DC_NOT_UPDATE', false);" --replace="define('DC_NOT_UPDATE', true);" --file=$php_config
|
||||
|
||||
# Adding LDAP login
|
||||
ynh_add_config --template="../conf/class.auth.ldap.php" --destination="$install_dir/inc/class.auth.ldap.php"
|
||||
ynh_config_add --template="class.auth.ldap.php" --destination="$install_dir/inc/class.auth.ldap.php"
|
||||
|
||||
cat << EOF >> $php_config
|
||||
|
||||
|
@ -121,7 +105,7 @@ define('DC_AUTH_CLASS','ldapDcAuth');
|
|||
EOF
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file=$php_config
|
||||
ynh_store_file_checksum $php_config
|
||||
|
||||
chmod 400 "$php_config"
|
||||
chown $app:$app "$php_config"
|
||||
|
@ -134,18 +118,16 @@ chown $app:$app "$php_config"
|
|||
adminUrl="/admin/auth.php"
|
||||
ynh_local_curl $adminUrl
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# UPGRADE FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=1
|
||||
ynh_script_progression "Reconfiguring Fail2Ban..."
|
||||
|
||||
# Create a dedicated Fail2Ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Invalid credentials in $install_dir/inc/class.auth.ldap.php .* client: <HOST>, .*https://$domain${path%/}/admin/auth.php"
|
||||
ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="Invalid credentials in $install_dir/inc/class.auth.ldap.php .* client: <HOST>, .*https://$domain${path%/}/admin/auth.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
diff --git a/inc/core/class.dc.core.php b/inc/core/class.dc.core.php
|
||||
index 317434b..2d1e6f8 100644
|
||||
--- a/inc/core/class.dc.core.php
|
||||
+++ b/inc/core/class.dc.core.php
|
||||
@@ -1056,8 +1056,8 @@ final class dcCore
|
||||
}
|
||||
|
||||
if ($cur->isField('user_pwd')) {
|
||||
- if (strlen($cur->user_pwd) < 6) {
|
||||
- throw new Exception(__('Password must contain at least 6 characters.'));
|
||||
+ if (strlen($cur->user_pwd) < 1) {
|
||||
+ throw new Exception(__('Password must contain at least 1 characters.'));
|
||||
}
|
||||
$cur->user_pwd = $this->auth->crypt($cur->user_pwd);
|
||||
}
|
Loading…
Reference in a new issue