mirror of
https://github.com/YunoHost-Apps/chatonsinfos_ynh.git
synced 2024-09-03 18:15:58 +02:00
Merge c7a8f3f162
into 31b4b1351b
This commit is contained in:
commit
4ab7125914
11 changed files with 76 additions and 132 deletions
|
@ -16,7 +16,8 @@ admindoc = "https://framagit.org/chatons/chatonsinfos/-/blob/master/README.md"
|
||||||
code = "https://framagit.org/chatons/chatonsinfos"
|
code = "https://framagit.org/chatons/chatonsinfos"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2"
|
yunohost = ">= 11.2.18"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
|
|
||||||
|
@ -53,6 +54,7 @@ ram.runtime = "50M"
|
||||||
# This will provision/deprovision a unix system user
|
# This will provision/deprovision a unix system user
|
||||||
|
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
group = "www-data:r-x"
|
||||||
# This will create/remove the install dir as /var/www/$app
|
# This will create/remove the install dir as /var/www/$app
|
||||||
# and store the corresponding setting $install_dir
|
# and store the corresponding setting $install_dir
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
generate_config_panel() {
|
generate_config_panel() {
|
||||||
export apps=$(yunohost app list | grep "id\:" | sed "s/ *id: //g" | grep -v chatonsinfos | tr '\n' ',' | sed "s/,$//")
|
export apps=$(yunohost app list | grep "id\:" | sed "s/ *id: //g" | grep -v chatonsinfos | tr '\n' ',' | sed "s/,$//")
|
||||||
ynh_render_template /etc/yunohost/apps/chatonsinfos/conf/config_panel.toml.j2 /etc/yunohost/apps/chatonsinfos/config_panel.toml
|
ynh_config_add --jinja /etc/yunohost/apps/chatonsinfos/conf/config_panel.toml.j2 /etc/yunohost/apps/chatonsinfos/config_panel.toml
|
||||||
|
|
||||||
create_service_properties
|
create_service_properties
|
||||||
}
|
}
|
||||||
|
@ -31,7 +28,7 @@ create_service_properties() {
|
||||||
cp "$source_path" "$service_path"
|
cp "$source_path" "$service_path"
|
||||||
|
|
||||||
# Prefill the properties
|
# Prefill the properties
|
||||||
ynh_print_info --message="Filling '$service_path'"
|
ynh_print_info "Filling '$service_path'"
|
||||||
local app_info="$(yunohost app info $_app_id --full --json)"
|
local app_info="$(yunohost app info $_app_id --full --json)"
|
||||||
get_info() {
|
get_info() {
|
||||||
echo $app_info | jq -r ".$1"
|
echo $app_info | jq -r ".$1"
|
||||||
|
@ -74,15 +71,15 @@ create_service_properties() {
|
||||||
for config_key in host.name host.description host.server.distribution host.server.type host.provider.type host.provider.hypervisor host.country.name host.country.code
|
for config_key in host.name host.description host.server.distribution host.server.type host.provider.type host.provider.hypervisor host.country.name host.country.code
|
||||||
do
|
do
|
||||||
settings=${config_key//\./_}
|
settings=${config_key//\./_}
|
||||||
local value=$(ynh_app_setting_get --app=$app --key=$settings)
|
local value=$(ynh_app_setting_get --key=$settings)
|
||||||
ynh_write_var_in_file --file="$service_path" --key="$config_key" --value="$value"
|
ynh_write_var_in_file --file="$service_path" --key="$config_key" --value="$value"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
chown $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 | chown $app:www-data "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir/public"
|
chown -R $app:www-data "$install_dir/public"
|
||||||
chown -R $app:www-data "$install_dir/public"
|
chown -R $app:www-data "$install_dir/public"
|
||||||
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 | chmod -R o-rwx "$install_dir"
|
||||||
#chmod a-x "$install_dir/{public,sources}/*"
|
#chmod a-x "$install_dir/{public,sources}/*"
|
||||||
}
|
}
|
||||||
update_subs() {
|
update_subs() {
|
||||||
|
@ -92,12 +89,13 @@ update_subs() {
|
||||||
local orga_path="$install_dir/public/organization.properties"
|
local orga_path="$install_dir/public/organization.properties"
|
||||||
|
|
||||||
# Remove all subs
|
# Remove all subs
|
||||||
|
|
||||||
sed -i "/^subs\..* =/d" "$orga_path"
|
sed -i "/^subs\..* =/d" "$orga_path"
|
||||||
|
|
||||||
# Add a subs for each published apps
|
# Add a subs for each published apps
|
||||||
for subs_app_id in $apps
|
for subs_app_id in $apps
|
||||||
do
|
do
|
||||||
local app_published=$(ynh_app_setting_get --app=$app --key=${subs_app_id}_published)
|
local app_published=$(ynh_app_setting_get --key=${subs_app_id}_published)
|
||||||
if [ "$app_published" == "" ]
|
if [ "$app_published" == "" ]
|
||||||
then
|
then
|
||||||
sed -i "/\[Subs\]/a \
|
sed -i "/\[Subs\]/a \
|
||||||
|
@ -106,7 +104,7 @@ subs.${subs_app_id} = 'https://$domain$path/${subs_app_id}.properties'" "$orga_p
|
||||||
done
|
done
|
||||||
|
|
||||||
# Add external subs
|
# Add external subs
|
||||||
local external_subs=$(ynh_app_setting_get --app=$app --key=external_subs | sed "s/,/ /g")
|
local external_subs=$(ynh_app_setting_get --key=external_subs | sed "s/,/ /g")
|
||||||
for external_sub in $external_subs
|
for external_sub in $external_subs
|
||||||
do
|
do
|
||||||
local subs_app_id=${external_sub%*:}
|
local subs_app_id=${external_sub%*:}
|
||||||
|
@ -118,11 +116,3 @@ subs.${subs_app_id} = '${subs_url}'" "$orga_path"
|
||||||
|
|
||||||
ynh_write_var_in_file --file="$orga_path" --key="file.datetime" --value="$(date '+%Y-%m-%dT%H:%M:%S')"
|
ynh_write_var_in_file --file="$orga_path" --key="file.datetime" --value="$(date '+%Y-%m-%dT%H:%M:%S')"
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
|
@ -1,31 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$install_dir"
|
ynh_backup "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# 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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
@ -33,10 +24,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# BACKUP VARIOUS FILES
|
# BACKUP VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/cron.daily/$app"
|
ynh_backup "/etc/cron.daily/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# 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)."
|
||||||
|
|
|
@ -6,12 +6,12 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
ynh_script_progression "Updating NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
ynh_config_change_url_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
ynh_script_progression "Change of URL completed for $app"
|
||||||
|
|
|
@ -2,22 +2,17 @@
|
||||||
# In simple cases, you don't need a config script.
|
# In simple cases, you don't need a config script.
|
||||||
|
|
||||||
# With a simple config_panel.toml, you can write in the app settings, in the
|
# With a simple config_panel.toml, you can write in the app settings, in the
|
||||||
|
|
||||||
# upstream config file or replace complete files (logo ...) and restart services.
|
# upstream config file or replace complete files (logo ...) and restart services.
|
||||||
|
|
||||||
# The config scripts allows you to go further, to handle specific cases
|
# The config scripts allows you to go further, to handle specific cases
|
||||||
|
|
||||||
# (validation of several interdependent fields, specific getter/setter for a value,
|
# (validation of several interdependent fields, specific getter/setter for a value,
|
||||||
# display dynamic informations or choices, pre-loading of config type .cube... ).
|
# display dynamic informations or choices, pre-loading of config type .cube... ).
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||||
|
@ -33,7 +28,7 @@ get__host_properties() {
|
||||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||||
#=================================================
|
#=================================================
|
||||||
get__multi_file() {
|
get__multi_file() {
|
||||||
ynh_app_setting_get --app=$app --key=$1
|
ynh_app_setting_get --key=$1
|
||||||
}
|
}
|
||||||
set__multi_file() {
|
set__multi_file() {
|
||||||
local short_setting="${1//_/.}"
|
local short_setting="${1//_/.}"
|
||||||
|
@ -41,26 +36,26 @@ set__multi_file() {
|
||||||
local bind_files="$(echo $3 | sed 's/multi_file(//' | sed 's/)//')"
|
local bind_files="$(echo $3 | sed 's/multi_file(//' | sed 's/)//')"
|
||||||
local value="${!1}"
|
local value="${!1}"
|
||||||
local bind_file
|
local bind_file
|
||||||
ynh_app_setting_set --app=$app --key=$1 --value="$value"
|
ynh_app_setting_set --key=$1 --value="$value"
|
||||||
ynh_print_info --message="Configuration key '$short_setting' edited in app settings"
|
ynh_print_info "Configuration key '$short_setting' edited in app settings"
|
||||||
if [ "$bind_files" != "" ]
|
if [ "$bind_files" != "" ]
|
||||||
then
|
then
|
||||||
for bind_file in ${bind_files//,/ }
|
for bind_file in ${bind_files//,/ }
|
||||||
do
|
do
|
||||||
ynh_read_var_in_file --file="${bind_file}" --key="${short_settings}"
|
ynh_read_var_in_file --file="${bind_file}" --key="${short_settings}"
|
||||||
ynh_print_info --message="Configuration key '$short_setting' edited in '${bind_file}'"
|
ynh_print_info "Configuration key '$short_setting' edited in '${bind_file}'"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get__manage_subs() {
|
get__manage_subs() {
|
||||||
ynh_app_setting_get --app=$app --key=$1
|
ynh_app_setting_get --key=$1
|
||||||
}
|
}
|
||||||
set__manage_subs() {
|
set__manage_subs() {
|
||||||
ynh_print_info --message="Configuration key '$1' edited in app settings"
|
ynh_print_info "Configuration key '$1' edited in app settings"
|
||||||
ynh_app_setting_set --app=$app --key=$1 --value="${!1}"
|
ynh_app_setting_set --key=$1 --value="${!1}"
|
||||||
|
|
||||||
ynh_print_info --message="Subs added in organization.properties"
|
ynh_print_info "Subs added in organization.properties"
|
||||||
update_subs
|
update_subs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +77,4 @@ ynh_app_config_apply() {
|
||||||
|
|
||||||
}
|
}
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
ynh_app_config_run $1
|
ynh_app_config_run $1
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -13,14 +7,14 @@ source /usr/share/yunohost/helpers
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=host_server_distribution --value="YunoHost"
|
ynh_app_setting_set --key=host_server_distribution --value="YunoHost"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir/sources"
|
ynh_setup_source --dest_dir="$install_dir/sources"
|
||||||
|
@ -29,27 +23,27 @@ mkdir $install_dir/public
|
||||||
# Empty html page to fix the CI
|
# Empty html page to fix the CI
|
||||||
echo "<html><body>ChatonsInfos</body></html>" > $install_dir/public/index.html
|
echo "<html><body>ChatonsInfos</body></html>" > $install_dir/public/index.html
|
||||||
# $install_dir will automatically be initialized with some decent
|
# $install_dir will automatically be initialized with some decent
|
||||||
|
|
||||||
# permission by default ... however, you may need to recursively reapply
|
# permission by default ... however, you may need to recursively reapply
|
||||||
# ownership to all files such as after the ynh_setup_source step
|
# ownership to all files such as after the ynh_setup_source step
|
||||||
chown -R root:root "$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 root:root "$install_dir"
|
||||||
chown $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 | chown $app:www-data "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir/public"
|
chown -R $app:www-data "$install_dir/public"
|
||||||
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 | chmod -R o-rwx "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# 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 using the conf/nginx.conf template
|
# Create a dedicated NGINX config using the conf/nginx.conf template
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# APP INITIAL CONFIGURATION
|
# APP INITIAL CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
cp "$install_dir/sources/MODELES/organization.properties" "$install_dir/public/"
|
cp "$install_dir/sources/MODELES/organization.properties" "$install_dir/public/"
|
||||||
orga_path="$install_dir/public/organization.properties"
|
orga_path="$install_dir/public/organization.properties"
|
||||||
|
@ -62,22 +56,22 @@ chown -R $app:www-data "$install_dir/public"
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERATE CONFIG PANEL
|
# GENERATE CONFIG PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Generating configuration panel..." --weight=1
|
ynh_script_progression "Generating configuration panel..."
|
||||||
|
|
||||||
generate_config_panel
|
generate_config_panel
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CRON JOB
|
# ADD A CRON JOB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding cron job to generate metrics..." --weight=1
|
ynh_script_progression "Adding cron job to generate metrics..."
|
||||||
|
|
||||||
cron_path="/etc/cron.daily/$app"
|
cron_path="/etc/cron.daily/$app"
|
||||||
ynh_add_config --template="cron" --destination="$cron_path"
|
ynh_config_add --template="cron" --destination="$cron_path"
|
||||||
chown root: "$cron_path"
|
#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 | chown root: "$cron_path"
|
||||||
chmod 644 "$cron_path"
|
#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 644 "$cron_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -1,25 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEM CONFIGURATIONS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
ynh_script_progression "Removing system configurations related to $app..."
|
||||||
|
|
||||||
ynh_remove_nginx_config
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
ynh_secure_remove --file="/etc/cron.daily/$app"
|
ynh_safe_rm "/etc/cron.daily/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# 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
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -13,9 +7,9 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
chown -R root:root "$install_dir/sources"
|
chown -R root:root "$install_dir/sources"
|
||||||
chown -R $app:www-data "$install_dir/public"
|
chown -R $app:www-data "$install_dir/public"
|
||||||
|
@ -25,22 +19,20 @@ chown -R $app:www-data "$install_dir/public"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# 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/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
ynh_restore_file --origin_path="/etc/cron.daily/$app"
|
ynh_restore "/etc/cron.daily/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
ynh_script_progression "Reloading NGINX web server and $app's service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemctl --service=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --last
|
ynh_script_progression "Restoration completed for $app"
|
||||||
|
|
|
@ -1,54 +1,46 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
|
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# 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
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir/sources"
|
ynh_setup_source --dest_dir="$install_dir/sources"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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 | chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REAPPLY SYSTEM CONFIGURATIONS
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||||
|
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
|
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERATE CONFIG PANEL
|
# GENERATE CONFIG PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Generating configuration panel..." --weight=1
|
ynh_script_progression "Generating configuration panel..."
|
||||||
|
|
||||||
generate_config_panel
|
generate_config_panel
|
||||||
|
|
||||||
chmod 400 "$install_dir/public/organization.properties"
|
chmod 400 "$install_dir/public/organization.properties"
|
||||||
chown $app:www-data "$install_dir/public/organization.properties"
|
chown $app:www-data "$install_dir/public/organization.properties"
|
||||||
ynh_store_file_checksum --file="$install_dir/public/organization.properties"
|
ynh_store_file_checksum "$install_dir/public/organization.properties"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
2
sources/patches/.gitignore
vendored
2
sources/patches/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
Loading…
Add table
Reference in a new issue