mirror of
https://github.com/YunoHost/example_ynh.git
synced 2024-09-03 20:06:13 +02:00
adding additional ynh_script_progression
This commit is contained in:
parent
580f3df1a3
commit
a6f6cc142e
4 changed files with 13 additions and 0 deletions
|
@ -96,6 +96,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
|
|||
#=================================================
|
||||
# BACKUP A CRON FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up cron file..." --time --weight=1
|
||||
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
|
||||
|
|
|
@ -235,6 +235,7 @@ fi
|
|||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..." --time --weight=1
|
||||
|
||||
### `ynh_replace_string` is used to replace a string in a file.
|
||||
### (It's compatible with sed regular expressions syntax)
|
||||
|
@ -244,6 +245,7 @@ ynh_replace_string --match_string="match_string" --replace_string="replace_strin
|
|||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing the config file checksum..." --time --weight=1
|
||||
|
||||
### `ynh_store_file_checksum` is used to store the checksum of a file.
|
||||
### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`,
|
||||
|
@ -257,6 +259,7 @@ ynh_store_file_checksum --file="$final_path/CONFIG_FILE"
|
|||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Securing files and directories..." --time --weight=1
|
||||
|
||||
### For security reason, any app should set the permissions to root: before anything else.
|
||||
### Then, if write authorization is needed, any access should be given only to directories
|
||||
|
@ -284,6 +287,7 @@ ynh_use_logrotate
|
|||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Advertising service in admin panel..." --time --weight=1
|
||||
|
||||
### `yunohost service add` is a CLI yunohost command to add a service in the admin panel.
|
||||
### You'll find the service in the 'services' section of YunoHost admin panel.
|
||||
|
|
|
@ -48,6 +48,7 @@ test ! -d $final_path \
|
|||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the nginx web server configuration..." --time --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
@ -69,6 +70,7 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system user..." --time --weight=1
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R root: $final_path
|
||||
|
@ -76,6 +78,7 @@ chown -R root: $final_path
|
|||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring php-fpm..." --time --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||
|
||||
|
@ -118,6 +121,7 @@ systemctl enable $app.service
|
|||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Advertising service in admin panel..." --time --weight=1
|
||||
|
||||
yunohost service add $app --log "/var/log/$app/$app.log"
|
||||
|
||||
|
@ -131,12 +135,14 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
|||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the cron file..." --time --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing the config file checksum..." --time --weight=1
|
||||
|
||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||
|
@ -185,6 +186,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg
|
|||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Securing files and directories..." --time --weight=1
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R root: $final_path
|
||||
|
|
Loading…
Add table
Reference in a new issue