mirror of
https://github.com/YunoHost-Apps/lionwiki-t2t_ynh.git
synced 2024-09-03 19:36:27 +02:00
Merge ed0dd98996
into 8b33042df3
This commit is contained in:
commit
105e0cab64
10 changed files with 78 additions and 140 deletions
|
@ -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,6 +21,7 @@ cpe = "cpe:2.3:a:lionwiki:lionwiki"
|
|||
|
||||
[integration]
|
||||
yunohost = ">=11.2"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = false
|
||||
|
@ -88,6 +89,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
|
||||
#=================================================
|
||||
|
||||
_validate_color() {
|
||||
|
@ -17,11 +13,3 @@ _validate_color() {
|
|||
fi
|
||||
echo "$color"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -1,38 +1,29 @@
|
|||
#!/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"
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# 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 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"
|
||||
|
||||
#=================================================
|
||||
# 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,25 +1,17 @@
|
|||
#!/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
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -14,74 +8,69 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
# Password is required to regen the files...
|
||||
ynh_app_setting_set --app="$app" --key=password --value="$password"
|
||||
ynh_app_setting_set --key=password --value="$password"
|
||||
|
||||
password_sha1=$(python -c 'import hashlib; import sys; a=str(sys.argv[1]); print(hashlib.sha512(a.encode("UTF-8")).hexdigest())' "$password")
|
||||
|
||||
# Validate, fix and set default value for color
|
||||
color="$(_validate_color)"
|
||||
ynh_app_setting_set --app="$app" --key=color --value="$color"
|
||||
ynh_app_setting_set --key=color --value="$color"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=4
|
||||
ynh_script_progression "Setting up source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$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 -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"
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
ynh_script_progression "Adding $app's configuration..."
|
||||
|
||||
# Workaround for php code containing __FILE__ and __DIR__
|
||||
file=__FILE__
|
||||
dir=__DIR__
|
||||
|
||||
ynh_add_config --template="config.php" --destination="$install_dir/config.php"
|
||||
ynh_add_config --template="pheditor.php" --destination="$install_dir/pheditor.php"
|
||||
ynh_config_add --template="config.php" --destination="$install_dir/config.php"
|
||||
ynh_config_add --template="pheditor.php" --destination="$install_dir/pheditor.php"
|
||||
|
||||
mkdir -p "$install_dir/templates/minimaxing/"
|
||||
ynh_add_config --template="minimaxing.less" --destination="$install_dir/templates/minimaxing/minimaxing.less"
|
||||
ynh_add_config --template="minimaxing.css" --destination="$install_dir/templates/minimaxing/minimaxing.css"
|
||||
ynh_config_add --template="minimaxing.less" --destination="$install_dir/templates/minimaxing/minimaxing.less"
|
||||
ynh_config_add --template="minimaxing.css" --destination="$install_dir/templates/minimaxing/minimaxing.css"
|
||||
|
||||
mkdir -p "$install_dir/templates/mimoza/"
|
||||
ynh_add_config --template="mimoza.css" --destination="$install_dir/templates/mimoza/mimoza.css"
|
||||
ynh_config_add --template="mimoza.css" --destination="$install_dir/templates/mimoza/mimoza.css"
|
||||
|
||||
ynh_store_file_checksum --file="$install_dir/config.t2t"
|
||||
ynh_store_file_checksum --file="$install_dir/menu.php"
|
||||
ynh_store_file_checksum "$install_dir/config.t2t"
|
||||
ynh_store_file_checksum "$install_dir/menu.php"
|
||||
|
||||
#=================================================
|
||||
# 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 PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
ynh_config_add_nginx
|
||||
|
||||
# chmod again to fix unaccessible templates / css files
|
||||
chmod -R 755 "$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 755 "$install_dir"
|
||||
# don't allow read access to config.php and pages/ for everyone
|
||||
chmod 750 "$install_dir"/config.php
|
||||
chmod -R 750 "$install_dir"/var/pages/
|
||||
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"/config.php
|
||||
chmod -R 750 "$install_dir"/var/pages/
|
||||
|
||||
# chmod root folder
|
||||
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 750 "$install_dir"
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
#!/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
|
||||
|
||||
#=================================================
|
||||
# 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,34 +7,31 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=2
|
||||
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"
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
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,18 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
ynh_script_progression "Ensuring downward compatibility..."
|
||||
|
||||
# Settings were not backed up prior to packaging v2
|
||||
if [[ -z "${password:-}" ]] || [[ -z "${color:-}" ]] || [[ -z "${wiki:-}" ]]; then
|
||||
|
@ -23,16 +17,16 @@ if [[ -z "${password:-}" ]] || [[ -z "${color:-}" ]] || [[ -z "${wiki:-}" ]]; th
|
|||
|
||||
if [[ -z "$password" ]] || [[ -z "$wiki" ]] || [[ -z "$color" ]]; then
|
||||
yunohost_app="yunohost app"
|
||||
ynh_die --message="Previous versions did not save settings. You need to manually set them before upgrading.
|
||||
ynh_die "Previous versions did not save settings. You need to manually set them before upgrading.
|
||||
Here are the retrieved values: password='$password', wiki='$wiki', color='$color'
|
||||
And the commands to set missing values:
|
||||
$yunohost_app setting $app password -v 'YOUR PASSWORD'
|
||||
$yunohost_app setting $app wiki -v 'YOUR WIKI NAME'
|
||||
$yunohost_app setting $app color -v 'YOUR BASE COLOR'"
|
||||
fi
|
||||
ynh_app_setting_set --app="$app" --key=password --value="$password"
|
||||
ynh_app_setting_set --app="$app" --key=wiki --value="$wiki"
|
||||
ynh_app_setting_set --app="$app" --key=color --value="$color"
|
||||
ynh_app_setting_set --key=password --value="$password"
|
||||
ynh_app_setting_set --key=wiki --value="$wiki"
|
||||
ynh_app_setting_set --key=color --value="$color"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -43,78 +37,75 @@ password_sha1=$(python -c 'import hashlib; import sys; a=str(sys.argv[1]); print
|
|||
|
||||
# Validate, fix and set default value for color
|
||||
color="$(_validate_color)"
|
||||
ynh_app_setting_set --app="$app" --key=color --value="$color"
|
||||
ynh_app_setting_set --key=color --value="$color"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir" --keep="config.php pheditor.php menu.php config.t2t var/pages/main.txt var/pages/todo.txt var/pages/sandbox.txt var/pages/links.txt var/pages/admin.txt"
|
||||
|
||||
|
||||
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"
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating configuration files..."
|
||||
ynh_script_progression "Updating configuration files..."
|
||||
|
||||
# Workaround for php code containing __FILE__ and __DIR__
|
||||
file=__FILE__
|
||||
dir=__DIR__
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$install_dir/config.php"
|
||||
ynh_backup_if_checksum_is_different --file="$install_dir/pheditor.php"
|
||||
ynh_backup_if_checksum_is_different "$install_dir/config.php"
|
||||
ynh_backup_if_checksum_is_different "$install_dir/pheditor.php"
|
||||
|
||||
# FIXME: is it required ?
|
||||
ynh_delete_file_checksum --file="$install_dir/config.php"
|
||||
ynh_delete_file_checksum --file="$install_dir/pheditor.php"
|
||||
ynh_delete_file_checksum "$install_dir/config.php"
|
||||
ynh_delete_file_checksum "$install_dir/pheditor.php"
|
||||
|
||||
# Do not overwrite existing configuration as it could have user customization's and settings.
|
||||
# Create file if it does not exist
|
||||
if [ ! -f "$install_dir/config.php" ]; then
|
||||
# Set the default settings
|
||||
ynh_add_config --template="../conf/config.php" --destination="$install_dir/config.php"
|
||||
ynh_config_add --template="config.php" --destination="$install_dir/config.php"
|
||||
fi
|
||||
|
||||
if [ ! -f "$install_dir/pheditor.php" ]; then
|
||||
# Set the default settings
|
||||
ynh_add_config --template="../conf/pheditor.php" --destination="$install_dir/pheditor.php"
|
||||
ynh_config_add --template="pheditor.php" --destination="$install_dir/pheditor.php"
|
||||
fi
|
||||
|
||||
|
||||
# ynh_add_config --template="config.php" --destination="$install_dir/config.php"
|
||||
# ynh_add_config --template="pheditor.php" --destination="$install_dir/pheditor.php"
|
||||
# ynh_config_add --template="config.php" --destination="$install_dir/config.php"
|
||||
# ynh_config_add --template="pheditor.php" --destination="$install_dir/pheditor.php"
|
||||
|
||||
mkdir -p "$install_dir/templates/minimaxing/"
|
||||
ynh_delete_file_checksum --file="$install_dir/templates/minimaxing/minimaxing.less"
|
||||
ynh_delete_file_checksum --file="$install_dir/templates/minimaxing/minimaxing.css"
|
||||
ynh_add_config --template="minimaxing.less" --destination="$install_dir/templates/minimaxing/minimaxing.less"
|
||||
ynh_add_config --template="minimaxing.css" --destination="$install_dir/templates/minimaxing/minimaxing.css"
|
||||
ynh_delete_file_checksum "$install_dir/templates/minimaxing/minimaxing.less"
|
||||
ynh_delete_file_checksum "$install_dir/templates/minimaxing/minimaxing.css"
|
||||
ynh_config_add --template="minimaxing.less" --destination="$install_dir/templates/minimaxing/minimaxing.less"
|
||||
ynh_config_add --template="minimaxing.css" --destination="$install_dir/templates/minimaxing/minimaxing.css"
|
||||
|
||||
mkdir -p "$install_dir/templates/mimoza/"
|
||||
ynh_delete_file_checksum --file="$install_dir/templates/mimoza/mimoza.css"
|
||||
ynh_add_config --template="mimoza.css" --destination="$install_dir/templates/mimoza/mimoza.css"
|
||||
ynh_delete_file_checksum "$install_dir/templates/mimoza/mimoza.css"
|
||||
ynh_config_add --template="mimoza.css" --destination="$install_dir/templates/mimoza/mimoza.css"
|
||||
|
||||
ynh_store_file_checksum --file="$install_dir/config.t2t"
|
||||
ynh_store_file_checksum --file="$install_dir/menu.php"
|
||||
ynh_store_file_checksum "$install_dir/config.t2t"
|
||||
ynh_store_file_checksum "$install_dir/menu.php"
|
||||
|
||||
#=================================================
|
||||
# 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 PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue