mirror of
https://github.com/YunoHost-Apps/lutim_ynh.git
synced 2024-09-03 19:36:24 +02:00
Update to last standard
This commit is contained in:
parent
5e5bf7c7a8
commit
51113ba754
16 changed files with 231 additions and 256 deletions
|
@ -39,9 +39,9 @@ Not relevant.
|
||||||
|
|
||||||
#### Supported architectures
|
#### Supported architectures
|
||||||
|
|
||||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/lutim/)
|
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/lutim/)
|
||||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/lutim/)
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/lutim/)
|
||||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/lutim/)
|
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/lutim/)
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ Not relevant.
|
||||||
|
|
||||||
* Report a bug: https://github.com/YunoHost-Apps/lutim_ynh/issues
|
* Report a bug: https://github.com/YunoHost-Apps/lutim_ynh/issues
|
||||||
* Lutim website: https://lut.im/
|
* Lutim website: https://lut.im/
|
||||||
|
* Dépôt de Lutim: https://framagit.org/fiat-tux/hat-softwares/lutim
|
||||||
* YunoHost website: https://yunohost.org/
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -23,7 +23,7 @@ Les images sont stockées indéfiniment à moins que vous ne demandiez qu'elles
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Editez le fichier `/var/www/lutim/lutim. conf` pour éditer la configuration de Lutim.
|
Editez le fichier `/var/www/lutim/lutim.conf` pour éditer la configuration de Lutim.
|
||||||
Rechargez ensuite le service lutim.
|
Rechargez ensuite le service lutim.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
@ -39,9 +39,9 @@ Non applicable.
|
||||||
|
|
||||||
#### Architectures supportées.
|
#### Architectures supportées.
|
||||||
|
|
||||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/lutim/)
|
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/lutim/)
|
||||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/lutim/)
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/lutim/)
|
||||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/lutim/)
|
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/lutim/)
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ Non applicable.
|
||||||
|
|
||||||
* Reporter un bug: https://github.com/YunoHost-Apps/lutim_ynh/issues
|
* Reporter un bug: https://github.com/YunoHost-Apps/lutim_ynh/issues
|
||||||
* Site de Lutim: https://lut.im/
|
* Site de Lutim: https://lut.im/
|
||||||
|
* Dépôt de Lutim: https://framagit.org/fiat-tux/hat-softwares/lutim
|
||||||
* Site de YunoHost: https://yunohost.org/
|
* Site de YunoHost: https://yunohost.org/
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -18,18 +18,8 @@
|
||||||
port_already_use=1 (8095)
|
port_already_use=1 (8095)
|
||||||
change_url=1
|
change_url=1
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
|
||||||
Level 2=auto
|
|
||||||
Level 3=auto
|
|
||||||
# Level 4: Pas de gestion des utilisateurs
|
|
||||||
Level 4=na
|
|
||||||
# Level 5: https://github.com/YunoHost/package_linter/issues/36
|
# Level 5: https://github.com/YunoHost/package_linter/issues/36
|
||||||
Level 5=1
|
Level 5=1
|
||||||
Level 6=auto
|
|
||||||
Level 7=auto
|
|
||||||
Level 8=0
|
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=down
|
Notification=down
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
location __PATH__ {
|
location __PATH__ {
|
||||||
|
|
||||||
|
# Force usage of https
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,10 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest"
|
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF ARGUMENTS ARE CORRECT
|
# CHECK IF ARGUMENTS ARE CORRECT
|
||||||
|
@ -31,7 +30,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE DISK QUOTA FOR IMAGES STORED BY LUTIM
|
# CHECK THE DISK QUOTA FOR IMAGES STORED BY LUTIM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Check the disk quota for images stored by lutim" --weight=9
|
ynh_script_progression --message="Checking the disk quota for images stored by lutim..." --weight=9
|
||||||
|
|
||||||
(cd "$final_path" && $(which carton) exec script/lutim cron watch)
|
(cd "$final_path" && $(which carton) exec script/lutim cron watch)
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,10 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest"
|
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF ARGUMENTS ARE CORRECT
|
# CHECK IF ARGUMENTS ARE CORRECT
|
||||||
|
@ -31,7 +30,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE EXPIRED IMAGES
|
# REMOVE EXPIRED IMAGES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove expired images" --weight=9
|
ynh_script_progression --message="Removing expired images..." --weight=9
|
||||||
|
|
||||||
(cd "$final_path" && $(which carton) exec script/lutim cron cleanfiles)
|
(cd "$final_path" && $(which carton) exec script/lutim cron cleanfiles)
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,10 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest"
|
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF ARGUMENTS ARE CORRECT
|
# CHECK IF ARGUMENTS ARE CORRECT
|
||||||
|
@ -31,7 +30,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE OBSOLETE IP FROM THE DATABASE
|
# REMOVE OBSOLETE IP FROM THE DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove obsolete ip from the database" --weight=9
|
ynh_script_progression --message="Removing obsolete ip from the database..." --weight=9
|
||||||
|
|
||||||
(cd "$final_path" && $(which carton) exec script/lutim cron cleanbdd)
|
(cd "$final_path" && $(which carton) exec script/lutim cron cleanbdd)
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,13 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest"
|
|
||||||
|
|
||||||
# Get is_public
|
# Get is_public
|
||||||
is_public=${YNH_ACTION_IS_PUBLIC}
|
is_public=${YNH_ACTION_IS_PUBLIC}
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF ARGUMENTS ARE CORRECT
|
# CHECK IF ARGUMENTS ARE CORRECT
|
||||||
|
@ -29,11 +28,11 @@ path_url=$(ynh_app_setting_get $app path)
|
||||||
# CHECK IF AN ACTION HAS TO BE DONE
|
# CHECK IF AN ACTION HAS TO BE DONE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
is_public_old=$(ynh_app_setting_get $app is_public)
|
is_public_old=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||||
|
|
||||||
if [ $is_public -eq $is_public_old ]
|
if [ $is_public -eq $is_public_old ]
|
||||||
then
|
then
|
||||||
ynh_die "is_public is already set as $is_public." 0
|
ynh_die --message="is_public is already set as $is_public." --ret_code=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -41,12 +40,13 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# MOVE TO PUBLIC OR PRIVATE
|
# MOVE TO PUBLIC OR PRIVATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ $is_public -eq 0 ]; then
|
if [ $is_public -eq 0 ]; then
|
||||||
public_private="private"
|
public_private="private"
|
||||||
else
|
else
|
||||||
public_private="public"
|
public_private="public"
|
||||||
fi
|
fi
|
||||||
ynh_script_progression --message="Move the application to $public_private" --weight=3
|
ynh_script_progression --message="Moving the application to $public_private..." --weight=3
|
||||||
|
|
||||||
if [ $is_public -eq 0 ]
|
if [ $is_public -eq 0 ]
|
||||||
then
|
then
|
||||||
|
@ -57,23 +57,24 @@ then
|
||||||
fi
|
fi
|
||||||
# Modify the domain to be used in a regex
|
# Modify the domain to be used in a regex
|
||||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||||
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/stats$","$domain_regex$path_url/manifest.webapp$","$domain_regex$path_url/$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/m/.*$"
|
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/stats/?$","$domain_regex$path_url/manifest.webapp/?$","$domain_regex$path_url/?$","$domain_regex$path_url/[d-m]/.*$"
|
||||||
else
|
else
|
||||||
ynh_app_setting_delete $app protected_regex
|
ynh_app_setting_delete --app=$app --key=protected_regex
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ynh_script_progression --message="Upgrading SSOwat configuration..."
|
||||||
# Regen ssowat configuration
|
# Regen ssowat configuration
|
||||||
yunohost app ssowatconf
|
yunohost app ssowatconf
|
||||||
|
|
||||||
# Update the config of the app
|
# Update the config of the app
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload nginx"
|
ynh_script_progression --message="Reloading nginx web server..."
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -12,15 +12,14 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest" --weight=3
|
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
always_encrypt=$(ynh_app_setting_get $app always_encrypt)
|
always_encrypt=$(ynh_app_setting_get --app=$app --key=always_encrypt)
|
||||||
secret=$(ynh_app_setting_get $app secret)
|
secret=$(ynh_app_setting_get --app=$app --key=secret)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SORT OUT THE CONFIG FILE TO HANDLE
|
# SORT OUT THE CONFIG FILE TO HANDLE
|
||||||
|
@ -37,10 +36,10 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESET THE CONFIG FILE
|
# RESET THE CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reset the config file $config_file" --weight=9
|
ynh_script_progression --message="Resetting the config file $config_file..." --weight=9
|
||||||
|
|
||||||
# Verify the checksum and backup the file if it's different
|
# Verify the checksum and backup the file if it's different
|
||||||
ynh_backup_if_checksum_is_different "$config_file"
|
ynh_backup_if_checksum_is_different --file="$config_file"
|
||||||
|
|
||||||
if [ "$file" = "lutim.conf" ]
|
if [ "$file" = "lutim.conf" ]
|
||||||
then
|
then
|
||||||
|
@ -48,17 +47,17 @@ then
|
||||||
cp /etc/yunohost/apps/$app/conf/lutim.conf.template "$config_file"
|
cp /etc/yunohost/apps/$app/conf/lutim.conf.template "$config_file"
|
||||||
|
|
||||||
# Recreate the default config
|
# Recreate the default config
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$config_file"
|
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config_file"
|
||||||
ynh_replace_string "__PATH__" "$path_url" "$config_file"
|
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config_file"
|
||||||
ynh_replace_string "__PORT__" "$port" "$config_file"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file"
|
||||||
ynh_replace_string "__ENCRYPT__" "$always_encrypt" "$config_file"
|
ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$config_file"
|
||||||
ynh_replace_string "__SECRET__" "$secret" "$config_file"
|
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum "$config_file"
|
ynh_store_file_checksum --file="$config_file"
|
||||||
|
|
||||||
ynh_script_progression --message="Restart Lutim" --weight=5
|
ynh_script_progression --message="Restarting Lutim..." --weight=5
|
||||||
|
|
||||||
# Wait for lutim to be fully started
|
# Wait for lutim to be fully started
|
||||||
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
||||||
|
|
|
@ -19,55 +19,55 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings" --weight=2
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backup the app main dir" --weight=4
|
ynh_script_progression --message="Backing up the main app directory..."
|
||||||
|
|
||||||
CHECK_SIZE "$final_path"
|
CHECK_SIZE "$final_path"
|
||||||
ynh_backup "$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP NGINX CONFIGURATION
|
# BACKUP NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backup nginx configuration"
|
ynh_script_progression --message="Backing up nginx web server configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP LOGROTATE
|
# BACKUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backup logrotate configuration"
|
ynh_script_progression --message="Backing up logrotate configuration"
|
||||||
|
|
||||||
ynh_backup "/etc/logrotate.d/$app"
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backup systemd configuration"
|
ynh_script_progression --message="Backing up systemd configuration"
|
||||||
|
|
||||||
ynh_backup "/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP A CRON FILE
|
# BACKUP A CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backup cron file"
|
ynh_script_progression --message="Backing up cron file"
|
||||||
|
|
||||||
ynh_backup "/etc/cron.d/$app"
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Backup script completed. Please wait for YunoHost to create the backup." --last
|
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
|
||||||
|
|
|
@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest"
|
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
old_path=$YNH_APP_OLD_PATH
|
old_path=$YNH_APP_OLD_PATH
|
||||||
|
@ -25,11 +24,11 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings" --weight=2
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
is_public=$(ynh_app_setting_get $app is_public)
|
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
@ -51,7 +50,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Activate maintenance mode"
|
ynh_script_progression --message="Activating maintenance mode..."
|
||||||
|
|
||||||
path_url=$old_path
|
path_url=$old_path
|
||||||
domain=$old_domain
|
domain=$old_domain
|
||||||
|
@ -89,7 +88,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modify url in nginx configuration" --weight=2
|
ynh_script_progression --message="Updating nginx web server configuration..." --weight=2
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -97,15 +96,12 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original nginx config file if modified
|
||||||
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
|
|
||||||
# Set global variables for nginx helper
|
# Set global variables for nginx helper
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
|
|
||||||
# Store path_url setting
|
|
||||||
ynh_app_setting_set $app path_url "$path_url"
|
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
fi
|
fi
|
||||||
|
@ -114,17 +110,17 @@ fi
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
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/$new_domain.d/$app.conf
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_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/$new_domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE SSOWAT
|
# UPDATE SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfigure SSOwat"
|
ynh_script_progression --message="Reconfiguring SSOwat..."
|
||||||
|
|
||||||
if [ $is_public -eq 0 ]
|
if [ $is_public -eq 0 ]
|
||||||
then
|
then
|
||||||
|
@ -135,7 +131,7 @@ then
|
||||||
fi
|
fi
|
||||||
# Modify the domain to be used in a regex
|
# Modify the domain to be used in a regex
|
||||||
domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
|
domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
|
||||||
ynh_app_setting_set $app protected_regex "$domain_regex$new_path/stats/?$","$domain_regex$new_path/manifest.webapp/?$","$domain_regex$new_path/?$","$domain_regex$new_path/[d-m]/.*$"
|
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$new_path/stats/?$","$domain_regex$new_path/manifest.webapp/?$","$domain_regex$new_path/?$","$domain_regex$new_path/[d-m]/.*$"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -144,21 +140,21 @@ fi
|
||||||
# REPLACE THE PATH IN THE CONFIG OF LUTIM
|
# REPLACE THE PATH IN THE CONFIG OF LUTIM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_replace_string "\(^ *prefix.*=> '\).*" "\1$new_path'," "$final_path/lutim.conf"
|
ynh_replace_string --match_string="\(^ *prefix.*=> '\).*" --replace_string="\1$new_path'," --target_file="$final_path/lutim.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload nginx" --weight=2
|
ynh_script_progression --message="Reloading nginx web server..."
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START AND CHECK LUTIM BOOTING
|
# START AND CHECK LUTIM BOOTING
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restart Lutim" --weight=3
|
ynh_script_progression --message="Restarting Lutim..." --weight=3
|
||||||
|
|
||||||
# Wait for lutim to be fully started
|
# Wait for lutim to be fully started
|
||||||
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
||||||
|
@ -166,7 +162,7 @@ ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Disable maintenance mode" --weight=5
|
ynh_script_progression --message="Disabling maintenance mode..."
|
||||||
|
|
||||||
path_url=$old_path
|
path_url=$old_path
|
||||||
domain=$old_domain
|
domain=$old_domain
|
||||||
|
@ -176,4 +172,4 @@ ynh_maintenance_mode_OFF
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of url completed" --last
|
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC CODE
|
# SPECIFIC CODE
|
||||||
|
@ -42,7 +42,6 @@ get_config_value() {
|
||||||
|
|
||||||
# always_encrypt
|
# always_encrypt
|
||||||
old_always_encrypt="$(get_config_value always_encrypt)"
|
old_always_encrypt="$(get_config_value always_encrypt)"
|
||||||
old_always_encrypt=$(bool_to_true_false $old_always_encrypt)
|
|
||||||
always_encrypt="${YNH_CONFIG_MAIN_CONFIGURATION_ALWAYS_ENCRYPT:-$old_always_encrypt}"
|
always_encrypt="${YNH_CONFIG_MAIN_CONFIGURATION_ALWAYS_ENCRYPT:-$old_always_encrypt}"
|
||||||
# antiflood
|
# antiflood
|
||||||
old_antiflood="$(get_config_value anti_flood_delay)"
|
old_antiflood="$(get_config_value anti_flood_delay)"
|
||||||
|
@ -63,28 +62,23 @@ fi
|
||||||
delay="${YNH_CONFIG_MAIN_CONFIGURATION_DELAY:-$old_delay}"
|
delay="${YNH_CONFIG_MAIN_CONFIGURATION_DELAY:-$old_delay}"
|
||||||
|
|
||||||
# is_public
|
# is_public
|
||||||
old_is_public="$(ynh_app_setting_get $app is_public)"
|
old_is_public="$(ynh_app_setting_get --app=$app --key=is_public)"
|
||||||
old_is_public=$(bool_to_true_false $old_is_public)
|
|
||||||
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
|
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
|
||||||
|
|
||||||
# Overwrite settings.json file
|
# Overwrite settings.json file
|
||||||
old_overwrite_settings="$(ynh_app_setting_get $app overwrite_settings)"
|
old_overwrite_settings="$(ynh_app_setting_get --app=$app --key=overwrite_settings)"
|
||||||
old_overwrite_settings=$(bool_to_true_false $old_overwrite_settings)
|
|
||||||
overwrite_settings="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS:-$old_overwrite_settings}"
|
overwrite_settings="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS:-$old_overwrite_settings}"
|
||||||
|
|
||||||
# Overwrite nginx configuration
|
# Overwrite nginx configuration
|
||||||
old_overwrite_nginx="$(ynh_app_setting_get $app overwrite_nginx)"
|
old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
|
||||||
old_overwrite_nginx=$(bool_to_true_false $old_overwrite_nginx)
|
|
||||||
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
|
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
|
||||||
|
|
||||||
# Overwrite systemd configuration
|
# Overwrite systemd configuration
|
||||||
old_overwrite_systemd="$(ynh_app_setting_get $app overwrite_systemd)"
|
old_overwrite_systemd="$(ynh_app_setting_get --app=$app --key=overwrite_systemd)"
|
||||||
old_overwrite_systemd=$(bool_to_true_false $old_overwrite_systemd)
|
|
||||||
overwrite_systemd="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SYSTEMD:-$old_overwrite_systemd}"
|
overwrite_systemd="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SYSTEMD:-$old_overwrite_systemd}"
|
||||||
|
|
||||||
# Type of admin mail configuration
|
# Type of admin mail configuration
|
||||||
old_admin_mail_html="$(ynh_app_setting_get $app admin_mail_html)"
|
old_admin_mail_html="$(ynh_app_setting_get --app=$app --key=admin_mail_html)"
|
||||||
old_admin_mail_html=$(bool_to_true_false $old_admin_mail_html)
|
|
||||||
admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}"
|
admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -119,20 +113,19 @@ apply_config() {
|
||||||
# always_encrypt
|
# always_encrypt
|
||||||
if [ "$always_encrypt" != "$old_always_encrypt" ]
|
if [ "$always_encrypt" != "$old_always_encrypt" ]
|
||||||
then
|
then
|
||||||
always_encrypt=$(bool_to_01 $always_encrypt)
|
ynh_replace_string --match_string=".*always_encrypt *=>.*" --replace_string=" always_encrypt => $always_encrypt," --target_file="$config_file"
|
||||||
ynh_replace_string ".*always_encrypt *=>.*" " always_encrypt => $always_encrypt," "$config_file"
|
|
||||||
restart_lutim=1
|
restart_lutim=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# antiflood
|
# antiflood
|
||||||
if [ "$antiflood" != "$old_antiflood" ]
|
if [ "$antiflood" != "$old_antiflood" ]
|
||||||
then
|
then
|
||||||
ynh_replace_string ".*anti_flood_delay *=>.*" " anti_flood_delay => $antiflood," "$config_file"
|
ynh_replace_string --match_string=".*anti_flood_delay *=>.*" --replace_string=" anti_flood_delay => $antiflood," --target_file="$config_file"
|
||||||
# Disable anti_flood_delay if the delay is 0
|
# Disable anti_flood_delay if the delay is 0
|
||||||
if [ $antiflood = 0 ]; then
|
if [ $antiflood = 0 ]; then
|
||||||
ynh_replace_string "\(anti_flood_delay *=>.*\)" "#\1" "$config_file"
|
ynh_replace_string --match_string="\(anti_flood_delay *=>.*\)" --replace_string="#\1" --target_file="$config_file"
|
||||||
fi
|
fi
|
||||||
ynh_app_setting_set $app antiflood "$antiflood"
|
ynh_app_setting_set --app=$app --key=antiflood --value="$antiflood"
|
||||||
restart_lutim=1
|
restart_lutim=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -150,8 +143,8 @@ apply_config() {
|
||||||
else
|
else
|
||||||
delay=360
|
delay=360
|
||||||
fi
|
fi
|
||||||
ynh_replace_string ".*default_delay *=>.*" " default_delay => $delay," "$config_file"
|
ynh_replace_string --match_string=".*default_delay *=>.*" --replace_string=" default_delay => $delay," --target_file="$config_file"
|
||||||
ynh_app_setting_set $app delay "$delay"
|
ynh_app_setting_set --app=$app --key=delay --value="$delay"
|
||||||
restart_lutim=1
|
restart_lutim=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -170,18 +163,14 @@ apply_config() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set overwrite_settings
|
# Set overwrite_settings
|
||||||
overwrite_settings=$(bool_to_01 $overwrite_settings)
|
ynh_app_setting_set --app=$app --key=overwrite_settings --value="$overwrite_settings"
|
||||||
ynh_app_setting_set $app overwrite_settings "$overwrite_settings"
|
|
||||||
# Set overwrite_nginx
|
# Set overwrite_nginx
|
||||||
overwrite_nginx=$(bool_to_01 $overwrite_nginx)
|
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
|
||||||
ynh_app_setting_set $app overwrite_nginx "$overwrite_nginx"
|
|
||||||
# Set overwrite_systemd
|
# Set overwrite_systemd
|
||||||
overwrite_systemd=$(bool_to_01 $overwrite_systemd)
|
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="$overwrite_systemd"
|
||||||
ynh_app_setting_set $app overwrite_systemd "$overwrite_systemd"
|
|
||||||
|
|
||||||
# Set admin_mail_html
|
# Set admin_mail_html
|
||||||
admin_mail_html=$(bool_to_01 $admin_mail_html)
|
ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html"
|
||||||
ynh_app_setting_set $app admin_mail_html "$admin_mail_html"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -24,7 +24,6 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest"
|
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
|
@ -36,61 +35,59 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Check if the app can be installed" --weight=2
|
ynh_script_progression --message="Validating installation parameters..." --weight=2
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
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"
|
||||||
|
|
||||||
# Normalize the url path syntax
|
|
||||||
path_url=$(ynh_normalize_url_path $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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Store settings from manifest" --weight=2
|
ynh_script_progression --message="Storing installation settings..." --weight=2
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||||
ynh_app_setting_set $app always_encrypt $always_encrypt
|
ynh_app_setting_set --app=$app --key=always_encrypt --value=$always_encrypt
|
||||||
|
|
||||||
ynh_app_setting_set $app overwrite_settings "1"
|
ynh_app_setting_set --app=$app --key=overwrite_settings --value=1
|
||||||
ynh_app_setting_set $app overwrite_nginx "1"
|
ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1
|
||||||
ynh_app_setting_set $app overwrite_systemd "1"
|
ynh_app_setting_set --app=$app --key=overwrite_systemd --value=1
|
||||||
ynh_app_setting_set $app admin_mail_html "1"
|
ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Find a free port" --weight=3
|
ynh_script_progression --message="Configuring firewall..." --weight=3
|
||||||
|
|
||||||
# Find a free port
|
# Find a free port
|
||||||
port=$(ynh_find_port 8095)
|
port=$(ynh_find_port --port=8095)
|
||||||
ynh_app_setting_set $app port $port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up source files..."
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity and uncompress the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install dependencies" --weight=60
|
ynh_script_progression --message="Installing dependencies..." --weight=60
|
||||||
|
|
||||||
ynh_install_app_dependencies $app_depencencies
|
ynh_install_app_dependencies $app_depencencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configure nginx" --weight=2
|
ynh_script_progression --message="Configuring nginx web server..." --weight=2
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -98,7 +95,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create a dedicated user" --weight=2
|
ynh_script_progression --message="Configuring system user..." --weight=2
|
||||||
|
|
||||||
# Create a dedicated system user
|
# Create a dedicated system user
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -112,20 +109,20 @@ ynh_script_progression --message="Configure Lutim" --weight=2
|
||||||
|
|
||||||
# Configure Lutim
|
# Configure Lutim
|
||||||
cp ../conf/lutim.conf.template "$final_path/lutim.conf"
|
cp ../conf/lutim.conf.template "$final_path/lutim.conf"
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/lutim.conf"
|
||||||
ynh_replace_string "__PATH__" "$path_url" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/lutim.conf"
|
||||||
ynh_replace_string "__PORT__" "$port" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/lutim.conf"
|
||||||
ynh_replace_string "__ENCRYPT__" "$always_encrypt" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$final_path/lutim.conf"
|
||||||
secret=$(ynh_string_random)
|
secret=$(ynh_string_random)
|
||||||
ynh_replace_string "__SECRET__" "$secret" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$final_path/lutim.conf"
|
||||||
ynh_app_setting_set $app secret "$secret"
|
ynh_app_setting_set --app=$app --key=secret --value="$secret"
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum "$final_path/lutim.conf"
|
ynh_store_file_checksum --file="$final_path/lutim.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configure systemd" --weight=2
|
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
@ -135,13 +132,13 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
cp ../conf/cron_lutim /etc/cron.d/$app
|
cp ../conf/cron_lutim /etc/cron.d/$app
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file=/etc/cron.d/$app
|
||||||
chmod +x $final_path/script/lutim
|
chmod +x $final_path/script/lutim
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL LUTIM WITH CARTON
|
# INSTALL LUTIM WITH CARTON
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install Lutim with Carton" --weight=60
|
ynh_script_progression --message="Installing Lutim with Carton..." --weight=60
|
||||||
|
|
||||||
mkdir -p /var/log/$app/
|
mkdir -p /var/log/$app/
|
||||||
(cd $final_path
|
(cd $final_path
|
||||||
|
@ -151,9 +148,9 @@ carton install 2>&1 | tee -a "/var/log/$app/setup_carton.log")
|
||||||
arch_dir=$(ls -1 $final_path/local/lib/perl5/ | grep linux-gnu)
|
arch_dir=$(ls -1 $final_path/local/lib/perl5/ | grep linux-gnu)
|
||||||
if [ "$?" -ne 0 ]
|
if [ "$?" -ne 0 ]
|
||||||
then
|
then
|
||||||
ynh_die "Unable to find the perl directory for your architecture."
|
ynh_die --message="Unable to find the perl directory for your architecture."
|
||||||
fi
|
fi
|
||||||
ynh_replace_string "__ARCHDIR__" "$arch_dir" "$final_path/script/lutim"
|
ynh_replace_string --match_string="__ARCHDIR__" --replace_string="$arch_dir" --target_file="$final_path/script/lutim"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOG FILE
|
# SETUP LOG FILE
|
||||||
|
@ -176,7 +173,7 @@ chown -R $app: $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configure logrotate" --weight=2
|
ynh_script_progression --message="Configuring log rotation..." --weight=2
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
@ -185,14 +182,14 @@ ynh_use_logrotate
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
yunohost service add lutim --log $final_path/log/production.log
|
yunohost service add $app --log $final_path/log/production.log
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setup SSOwat"
|
ynh_script_progression --message="Configuring SSOwat..."
|
||||||
|
|
||||||
ynh_app_setting_set $app skipped_uris "/"
|
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||||
if [ $is_public -eq 0 ]
|
if [ $is_public -eq 0 ]
|
||||||
then
|
then
|
||||||
# If the app is private, viewing images stays publicly accessible.
|
# If the app is private, viewing images stays publicly accessible.
|
||||||
|
@ -202,20 +199,20 @@ then
|
||||||
fi
|
fi
|
||||||
# Modify the domain to be used in a regex
|
# Modify the domain to be used in a regex
|
||||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||||
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/stats/?$","$domain_regex$path_url/manifest.webapp/?$","$domain_regex$path_url/?$","$domain_regex$path_url/[d-m]/.*$"
|
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/stats/?$","$domain_regex$path_url/manifest.webapp/?$","$domain_regex$path_url/?$","$domain_regex$path_url/[d-m]/.*$"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload nginx" --weight=2
|
ynh_script_progression --message="Reloading nginx web server..." --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK LUTIM BOOTING
|
# CHECK LUTIM BOOTING
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restart Lutim" --weight=6
|
ynh_script_progression --message="Restarting Lutim..." --weight=6
|
||||||
|
|
||||||
# Wait for lutim to be fully started
|
# Wait for lutim to be fully started
|
||||||
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
||||||
|
@ -237,10 +234,10 @@ You can also find some specific actions for this app by using the experimental _
|
||||||
|
|
||||||
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__." > mail_to_send
|
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__." > mail_to_send
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="install"
|
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=install
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation completed" --last
|
ynh_script_progression --message="Installation of $app completed" --time --last
|
||||||
|
|
|
@ -12,18 +12,19 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings" --weight=2
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP AND REMOVE SERVICE
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stop and remove the service" --weight=6
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=6
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
@ -35,14 +36,14 @@ ynh_remove_systemd_config
|
||||||
# Check if the service is declared in YunoHost
|
# Check if the service is declared in YunoHost
|
||||||
if ynh_exec_fully_quiet yunohost service status $app
|
if ynh_exec_fully_quiet yunohost service status $app
|
||||||
then
|
then
|
||||||
ynh_print_info "Remove $app service" >&2
|
ynh_script_progression --message="Removing $app service..."
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove dependencies" --weight=20
|
ynh_script_progression --message="Removing dependencies..." --weight=20
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
@ -50,15 +51,15 @@ ynh_remove_app_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove app main directory" --weight=2
|
ynh_script_progression --message="Removing app main directory..." --weight=2
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "/var/www/$app"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove nginx configuration"
|
ynh_script_progression --message="Removing nginx web server configuration..."
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -66,7 +67,7 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove logrotate configuration"
|
ynh_script_progression --message="Removing logrotate configuration..."
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
@ -77,20 +78,20 @@ ynh_remove_logrotate
|
||||||
# REMOVE CRON JOB
|
# REMOVE CRON JOB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_secure_remove "/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove the dedicated user" --weight=5
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=5
|
||||||
|
|
||||||
# Delete dedicated system user
|
# Delete dedicated system user
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Deletion completed" --last
|
ynh_script_progression --message="Removal of $app completed" --time --last
|
||||||
|
|
|
@ -25,27 +25,28 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings" --weight=2
|
ynh_script_progression --message="Loading settings..." --weight=2
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Validating restoration parameters..."
|
||||||
|
|
||||||
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 "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Activate maintenance mode" --weight=2
|
ynh_script_progression --message="Activating maintenance mode..." --weight=2
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
|
@ -55,22 +56,22 @@ ynh_maintenance_mode_ON
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restore the app main directory"
|
ynh_script_progression --message="Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file "$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreate the dedicated user" --weight=2
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
|
||||||
|
|
||||||
# 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 USER RIGHTS
|
# RESTORE USER RIGHTS
|
||||||
|
@ -84,7 +85,7 @@ chown -R $app: $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstall dependencies" --weight=60
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=60
|
||||||
|
|
||||||
ynh_install_app_dependencies $app_depencencies
|
ynh_install_app_dependencies $app_depencencies
|
||||||
|
|
||||||
|
@ -92,21 +93,21 @@ ynh_install_app_dependencies $app_depencencies
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
yunohost service add $app --log "/var/log/$app/APP.log"
|
yunohost service add $app --log $final_path/log/production.log
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restore the systemd configuration"
|
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||||
|
|
||||||
ynh_restore_file "/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service
|
systemctl enable $app.service
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE CRON FILE
|
# RESTORE THE CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOG FILE
|
# SETUP LOG FILE
|
||||||
|
@ -121,21 +122,21 @@ chown $app -R /var/log/$app
|
||||||
# RESTORE LOGROTATE CONFIGURATION
|
# RESTORE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload nginx" --weight=2
|
ynh_script_progression --message="Reloading nginx web server..." --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START AND CHECK LUTIM BOOTING
|
# START AND CHECK LUTIM BOOTING
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restart Lutim" --weight=3
|
ynh_script_progression --message="Restarting Lutim..." --weight=3
|
||||||
|
|
||||||
# Wait for lutim to be fully started
|
# Wait for lutim to be fully started
|
||||||
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
||||||
|
@ -143,7 +144,7 @@ ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Disable maintenance mode" --weight=7
|
ynh_script_progression --message="Disabling maintenance mode..." --weight=7
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF
|
ynh_maintenance_mode_OFF
|
||||||
|
|
||||||
|
@ -161,10 +162,10 @@ You can also find some specific actions for this app by using the experimental _
|
||||||
|
|
||||||
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__." > mail_to_send
|
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__." > mail_to_send
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="restore"
|
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=restore
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed" --last
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
115
scripts/upgrade
115
scripts/upgrade
|
@ -14,24 +14,26 @@ source _variables
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings" --weight=4
|
ynh_script_progression --message="Loading installation settings..." --weight=4
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
is_public=$(ynh_app_setting_get $app is_public)
|
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
always_encrypt=$(ynh_app_setting_get $app always_encrypt)
|
always_encrypt=$(ynh_app_setting_get --app=$app --key=always_encrypt)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
secret=$(ynh_app_setting_get $app secret)
|
secret=$(ynh_app_setting_get --app=$app --key=secret)
|
||||||
overwrite_settings=$(ynh_app_setting_get $app overwrite_settings)
|
|
||||||
overwrite_nginx=$(ynh_app_setting_get $app overwrite_nginx)
|
overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
|
||||||
overwrite_systemd=$(ynh_app_setting_get $app overwrite_systemd)
|
overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
|
||||||
|
overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
|
||||||
|
admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html)
|
||||||
|
|
||||||
# Optional parameters from config-panel feature
|
# Optional parameters from config-panel feature
|
||||||
antiflood=$(ynh_app_setting_get $app antiflood)
|
antiflood=$(ynh_app_setting_get --app=$app --key=antiflood)
|
||||||
delay=$(ynh_app_setting_get $app delay)
|
delay=$(ynh_app_setting_get --app=$app --key=delay)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -42,55 +44,54 @@ upgrade_type=$(ynh_check_app_version_changed)
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensure downward compatibility" --weight=2
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
|
||||||
|
|
||||||
# Fix is_public as a boolean
|
# Fix is_public as a boolean
|
||||||
if [ "$is_public" = "Yes" ]; then
|
if [ "$is_public" = "Yes" ]; then
|
||||||
ynh_app_setting_set $app is_public 1
|
ynh_app_setting_set --app=$app --key=is_public --value=1
|
||||||
is_public=1
|
is_public=1
|
||||||
elif [ "$is_public" = "No" ]; then
|
elif [ "$is_public" = "No" ]; then
|
||||||
ynh_app_setting_set $app is_public 0
|
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||||
is_public=0
|
is_public=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if final_path isn't set, which can happens with old scripts, set final_path.
|
# if final_path isn't set, which can happens with old scripts, set final_path.
|
||||||
if [ "${#final_path}" -eq 0 ]
|
if [ -z "$final_path" ]; then
|
||||||
then
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Fix always_encrypt as a boolean
|
# Fix always_encrypt as a boolean
|
||||||
if [ "$always_encrypt" = "Yes" ]; then
|
if [ "$always_encrypt" = "Yes" ]; then
|
||||||
ynh_app_setting_set $app always_encrypt 1
|
ynh_app_setting_set --app=$app --key=always_encrypt --value=1
|
||||||
always_encrypt=1
|
always_encrypt=1
|
||||||
elif [ "$always_encrypt" = "No" ]; then
|
elif [ "$always_encrypt" = "No" ]; then
|
||||||
ynh_app_setting_set $app always_encrypt 0
|
ynh_app_setting_set --app=$app --key=always_encrypt --value=0
|
||||||
always_encrypt=0
|
always_encrypt=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If overwrite_settings doesn't exist, create it
|
# If overwrite_settings doesn't exist, create it
|
||||||
if [ -z "$overwrite_settings" ]; then
|
if [ -z "$overwrite_settings" ]; then
|
||||||
overwrite_settings=1
|
overwrite_settings=1
|
||||||
ynh_app_setting_set $app overwrite_settings $overwrite_settings
|
ynh_app_setting_set --app=$app --key=overwrite_settings --value=$overwrite_settings
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If overwrite_nginx doesn't exist, create it
|
# If overwrite_nginx doesn't exist, create it
|
||||||
if [ -z "$overwrite_nginx" ]; then
|
if [ -z "$overwrite_nginx" ]; then
|
||||||
overwrite_nginx=1
|
overwrite_nginx=1
|
||||||
ynh_app_setting_set $app overwrite_nginx $overwrite_nginx
|
ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If overwrite_systemd doesn't exist, create it
|
# If overwrite_systemd doesn't exist, create it
|
||||||
if [ -z "$overwrite_systemd" ]; then
|
if [ -z "$overwrite_systemd" ]; then
|
||||||
overwrite_systemd=1
|
overwrite_systemd=1
|
||||||
ynh_app_setting_set $app overwrite_systemd $overwrite_systemd
|
ynh_app_setting_set --app=$app --key=overwrite_systemd --value=$overwrite_systemd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If secret doesn't exist, create it
|
# If secret doesn't exist, create it
|
||||||
if [ -z "$secret" ]; then
|
if [ -z "$secret" ]; then
|
||||||
secret=$(grep "secrets *=>" "$final_path/lutim.conf" | cut -d\' -f2)
|
secret=$(grep "secrets *=>" "$final_path/lutim.conf" | cut -d\' -f2)
|
||||||
ynh_app_setting_set $app secret $secret
|
ynh_app_setting_set --app=$app --key=secret --value=$secret
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Close opened port
|
# Close opened port
|
||||||
|
@ -102,7 +103,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backup the app before upgrading" --weight=15
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=15
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -120,12 +121,12 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Normalize the URL path syntax
|
# Normalize the URL path syntax
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Activate maintenance mode" --weight=2
|
ynh_script_progression --message="Activating maintenance mode..." --weight=2
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
|
@ -137,15 +138,15 @@ ynh_maintenance_mode_ON
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Download, check and unpack source"
|
ynh_script_progression --message="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 "$final_path"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrade dependencies" --weight=9
|
ynh_script_progression --message="Upgrading dependencies..." --weight=9
|
||||||
|
|
||||||
ynh_install_app_dependencies $app_depencencies
|
ynh_install_app_dependencies $app_depencencies
|
||||||
|
|
||||||
|
@ -156,17 +157,17 @@ ynh_install_app_dependencies $app_depencencies
|
||||||
# Overwrite the nginx configuration only if it's allowed
|
# Overwrite the nginx configuration only if it's allowed
|
||||||
if [ $overwrite_nginx -eq 1 ]
|
if [ $overwrite_nginx -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Reconfigure nginx" --weight=2
|
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create a dedicated user"
|
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
@ -180,26 +181,26 @@ if [ $overwrite_settings -eq 1 ]
|
||||||
then
|
then
|
||||||
# Configure Lutim
|
# Configure Lutim
|
||||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||||
ynh_backup_if_checksum_is_different "$final_path/lutim.conf"
|
ynh_backup_if_checksum_is_different --file="$final_path/lutim.conf"
|
||||||
cp ../conf/lutim.conf.template "$final_path/lutim.conf"
|
cp ../conf/lutim.conf.template "$final_path/lutim.conf"
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/lutim.conf"
|
||||||
ynh_replace_string "__PATH__" "$path_url" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/lutim.conf"
|
||||||
ynh_replace_string "__PORT__" "$port" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/lutim.conf"
|
||||||
ynh_replace_string "__ENCRYPT__" "$always_encrypt" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$final_path/lutim.conf"
|
||||||
ynh_replace_string "__SECRET__" "$secret" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$final_path/lutim.conf"
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
ynh_store_file_checksum "$final_path/lutim.conf"
|
ynh_store_file_checksum --file="$final_path/lutim.conf"
|
||||||
|
|
||||||
# Optional parameters from config-panel feature
|
# Optional parameters from config-panel feature
|
||||||
if [ -n "$antiflood" ]; then
|
if [ -n "$antiflood" ]; then
|
||||||
ynh_replace_string ".*anti_flood_delay *=>.*" " anti_flood_delay => $antiflood," "$final_path/lutim.conf"
|
ynh_replace_string --match_string=".*anti_flood_delay *=>.*" --replace_string=" anti_flood_delay => $antiflood," --target_file="$final_path/lutim.conf"
|
||||||
# Disable anti_flood_delay if the delay is 0
|
# Disable anti_flood_delay if the delay is 0
|
||||||
if [ $antiflood = 0 ]; then
|
if [ $antiflood = 0 ]; then
|
||||||
ynh_replace_string "\(anti_flood_delay *=>.*\)" "#\1" "$final_path/lutim.conf"
|
ynh_replace_string --match_string="\(anti_flood_delay *=>.*\)" --replace_string="#\1" --target_file="$final_path/lutim.conf"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -n "$delay" ]; then
|
if [ -n "$delay" ]; then
|
||||||
ynh_replace_string ".*default_delay *=>.*" " default_delay => $delay," "$final_path/lutim.conf"
|
ynh_replace_string --match_string=".*default_delay *=>.*" --replace_string=" default_delay => $delay," --target_file="$final_path/lutim.conf"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -210,7 +211,7 @@ fi
|
||||||
# Overwrite the systemd configuration only if it's allowed
|
# Overwrite the systemd configuration only if it's allowed
|
||||||
if [ $overwrite_systemd -eq 1 ]
|
if [ $overwrite_systemd -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Reconfigure systemd" --weight=2
|
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -219,7 +220,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
cp ../conf/cron_lutim /etc/cron.d/$app
|
cp ../conf/cron_lutim /etc/cron.d/$app
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file=/etc/cron.d/$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE LUTIM WITH CARTON
|
# UPDATE LUTIM WITH CARTON
|
||||||
|
@ -227,7 +228,7 @@ ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrade Lutim with carton" --weight=4
|
ynh_script_progression --message="Upgrading Lutim with carton..." --weight=4
|
||||||
(cd $final_path
|
(cd $final_path
|
||||||
carton install 2>&1 | tee -a "/var/log/$app/setup_carton.log")
|
carton install 2>&1 | tee -a "/var/log/$app/setup_carton.log")
|
||||||
fi
|
fi
|
||||||
|
@ -244,7 +245,7 @@ chown -R $app: $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfigure logrotate"
|
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||||
|
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
chown $app -R /var/log/$app
|
chown $app -R /var/log/$app
|
||||||
|
@ -252,28 +253,28 @@ chown $app -R /var/log/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfigure SSOwat"
|
ynh_script_progression --message="Upgrading SSOwat configuration..."
|
||||||
|
|
||||||
ynh_app_setting_set $app skipped_uris "/"
|
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||||
if [ $is_public -eq 0 ]
|
if [ $is_public -eq 0 ]
|
||||||
then
|
then
|
||||||
# If the app is private, viewing images stays publicly accessible.
|
# If the app is private, viewing images stays publicly accessible.
|
||||||
# Modify the domain to be used in a regex
|
# Modify the domain to be used in a regex
|
||||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||||
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/stats/?$","$domain_regex$path_url/manifest.webapp/?$","$domain_regex$path_url/?$","$domain_regex$path_url/[d-m]/.*$"
|
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/stats/?$","$domain_regex$path_url/manifest.webapp/?$","$domain_regex$path_url/?$","$domain_regex$path_url/[d-m]/.*$"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload nginx"
|
ynh_script_progression --message="Reloading nginx web server..."
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START AND CHECK LUTIM BOOTING
|
# START AND CHECK LUTIM BOOTING
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restart Lutim" --weight=4
|
ynh_script_progression --message="Restarting Lutim..." --weight=4
|
||||||
|
|
||||||
# Wait for lutim to be fully started
|
# Wait for lutim to be fully started
|
||||||
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
||||||
|
@ -281,7 +282,7 @@ ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Disable maintenance mode" --weight=7
|
ynh_script_progression --message="Disabling maintenance mode..." --weight=7
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF
|
ynh_maintenance_mode_OFF
|
||||||
|
|
||||||
|
@ -307,10 +308,10 @@ If you're facing an issue or want to improve this app, please open a new issue i
|
||||||
Changelog since your last upgrade:
|
Changelog since your last upgrade:
|
||||||
$(cat changelog)" > mail_to_send
|
$(cat changelog)" > mail_to_send
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="upgrade"
|
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=upgrade
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade completed" --last
|
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||||
|
|
Loading…
Add table
Reference in a new issue