1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/archivist_ynh.git synced 2024-09-03 18:15:55 +02:00

Advertise config-panel and actions

This commit is contained in:
Maniack Crudelis 2019-01-19 18:55:14 +01:00
parent e5e6f62628
commit 1c65be49c6
5 changed files with 64 additions and 9 deletions

View file

@ -6,7 +6,7 @@
"en": "Automatic backups.", "en": "Automatic backups.",
"fr": "Sauvegardes automatiques." "fr": "Sauvegardes automatiques."
}, },
"version": "0.7~ynh1", "version": "0.7~ynh2",
"url": "https://github.com/maniackcrudelis/archivist", "url": "https://github.com/maniackcrudelis/archivist",
"license": "GPL-3.0", "license": "GPL-3.0",
"maintainer": { "maintainer": {
@ -14,7 +14,7 @@
"email": "maniackc_dev@crudelis.fr" "email": "maniackc_dev@crudelis.fr"
}, },
"requirements": { "requirements": {
"yunohost": ">= 2.7.14" "yunohost": ">= 3.3.3"
}, },
"multi_instance": true, "multi_instance": true,
"services": [], "services": [],

View file

@ -630,21 +630,24 @@ ynh_clean_check_starting () {
# Send an email to inform the administrator # Send an email to inform the administrator
# #
# usage: ynh_send_readme_to_admin app_message [recipients] # usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
# | arg: -m --app_message= - The message to send to the administrator. # | arg: -m --app_message= - The message to send to the administrator.
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root # | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
# example: "root admin@domain" # example: "root admin@domain"
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you # If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
# example: "root admin@domain user1 user2" # example: "root admin@domain user1 user2"
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
ynh_send_readme_to_admin() { ynh_send_readme_to_admin() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
declare -Ar args_array=( [m]=app_message= [r]=recipients= ) declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
local app_message local app_message
local recipients local recipients
local type
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
local app_message="${app_message:-...No specific information...}" app_message="${app_message:-...No specific information...}"
local recipients="${recipients:-root}" recipients="${recipients:-root}"
type="${type:-install}"
# Retrieve the email of users # Retrieve the email of users
find_mails () { find_mails () {
@ -670,7 +673,23 @@ ynh_send_readme_to_admin() {
} }
recipients=$(find_mails "$recipients") recipients=$(find_mails "$recipients")
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!" # Subject base
local mail_subject="☁️🆈🅽🅷☁️: \`$app\`"
# Adapt the subject according to the type of mail required.
if [ "$type" = "backup" ]; then
mail_subject="$mail_subject has just been backup."
elif [ "$type" = "change_url" ]; then
mail_subject="$mail_subject has just been moved to a new URL!"
elif [ "$type" = "remove" ]; then
mail_subject="$mail_subject has just been removed!"
elif [ "$type" = "restore" ]; then
mail_subject="$mail_subject has just been restored!"
elif [ "$type" = "upgrade" ]; then
mail_subject="$mail_subject has just been upgraded!"
else # install
mail_subject="$mail_subject has just been installed!"
fi
local mail_message="This is an automated message from your beloved YunoHost server. local mail_message="This is an automated message from your beloved YunoHost server.

View file

@ -205,13 +205,19 @@ else
encrypt_message="" encrypt_message=""
fi fi
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
message="${encrypt_message}Archivist is going to run $run_freq. message="${encrypt_message}Archivist is going to run $run_freq.
If you want to change the frequency, have a look to the file /etc/cron.d/$app. If you want to change the frequency, have a look to the file /etc/cron.d/$app.
$Informations $Informations
Please read the documentation (https://github.com/maniackcrudelis/archivist/blob/master/Configuration.md) about the configuration of archivist for more information. Please read the documentation (https://github.com/maniackcrudelis/archivist/blob/master/Configuration.md) about the configuration of archivist for more information.
You can configure this app easily by using the experimental [config-panel feature]($admin_panel/config-panel).
You can also find some specific actions for this app by using the experimental [action feature]($admin_panel/actions).
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/archivist_ynh" If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/archivist_ynh"
ynh_send_readme_to_admin --app_message="$message" --recipients="root" ynh_send_readme_to_admin --app_message="$message" --recipients="root" --type="install"
ynh_print_ON ynh_print_ON

View file

@ -86,11 +86,17 @@ mkdir -p "/home/yunohost.app/${app}/backup"
# SEND A README FOR THE ADMIN # SEND A README FOR THE ADMIN
#================================================= #=================================================
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
message="If you want to change the frequency of Archivist, have a look to the file /etc/cron.d/$app. message="If you want to change the frequency of Archivist, have a look to the file /etc/cron.d/$app.
The configuration file of Archivist has been restored at $final_path/Backup_list.conf The configuration file of Archivist has been restored at $final_path/Backup_list.conf
Please read the documentation (https://github.com/maniackcrudelis/archivist/blob/master/Configuration.md) about the configuration of archivist for more information. Please read the documentation (https://github.com/maniackcrudelis/archivist/blob/master/Configuration.md) about the configuration of archivist for more information.
You can configure this app easily by using the experimental config-panel feature: $admin_panel/config-panel.
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/archivist_ynh" If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/archivist_ynh"
ynh_send_readme_to_admin --app_message="$message" --recipients="root" ynh_send_readme_to_admin --app_message="$message" --recipients="root" --type="restore"

View file

@ -121,14 +121,19 @@ then
ynh_replace_string "__APP__" "$app" /etc/cron.d/$app ynh_replace_string "__APP__" "$app" /etc/cron.d/$app
if [ "$frequency" = "Daily" ]; then if [ "$frequency" = "Daily" ]; then
cron_freq="0 2 * * *" cron_freq="0 2 * * *"
run_freq="every day"
elif [ "$frequency" = "Each 3 days" ]; then elif [ "$frequency" = "Each 3 days" ]; then
cron_freq="0 2 */3 * *" cron_freq="0 2 */3 * *"
run_freq="each 3 days"
elif [ "$frequency" = "Weekly" ]; then elif [ "$frequency" = "Weekly" ]; then
cron_freq="0 2 * * 0" cron_freq="0 2 * * 0"
run_freq="once a week on sunday"
elif [ "$frequency" = "Biweekly" ]; then elif [ "$frequency" = "Biweekly" ]; then
cron_freq="0 2 * * 0/2" cron_freq="0 2 * * 0/2"
run_freq="one sunday out of two"
else # Monthly else # Monthly
cron_freq="0 2 1 * *" cron_freq="0 2 1 * *"
run_freq="once a month on the first sunday"
fi fi
ynh_replace_string "__FREQUENCY__" "$cron_freq" /etc/cron.d/$app ynh_replace_string "__FREQUENCY__" "$cron_freq" /etc/cron.d/$app
@ -151,3 +156,22 @@ ynh_use_logrotate --non-append
# Set permissions on app files # Set permissions on app files
chown -R root: $final_path chown -R root: $final_path
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
message="Archivist is going to run $run_freq.
If you want to change the frequency, have a look to the file /etc/cron.d/$app.
Please read the documentation (https://github.com/maniackcrudelis/archivist/blob/master/Configuration.md) about the configuration of archivist for more information.
You can configure this app easily by using the experimental config-panel feature: $admin_panel/config-panel.
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/archivist_ynh"
ynh_send_readme_to_admin --app_message="$message" --recipients="root" --type="upgrade"