mirror of
https://github.com/YunoHost-Apps/peertube_ynh.git
synced 2024-09-03 19:56:29 +02:00
Update ynh_send_readme_to_admin
This commit is contained in:
parent
07dd5a839e
commit
730510ef71
4 changed files with 10 additions and 20 deletions
|
@ -275,7 +275,6 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Sending a readme for the admin..."
|
ynh_script_progression --message="Sending a readme for the admin..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/message_install" --destination="../conf/msg_install"
|
|
||||||
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install'
|
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install'
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -121,7 +121,6 @@ ynh_system_user_delete --username=$app
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Sending a readme for the admin..."
|
ynh_script_progression --message="Sending a readme for the admin..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/message_remove" --destination="../conf/msg_remove"
|
|
||||||
ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_email --type='remove'
|
ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_email --type='remove'
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -76,6 +76,9 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab
|
||||||
ynh_secure_remove --file="/etc/apt/sources.list.d/jessie-backports.list"
|
ynh_secure_remove --file="/etc/apt/sources.list.d/jessie-backports.list"
|
||||||
ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list"
|
ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list"
|
||||||
|
|
||||||
|
# Remove not needed checksum
|
||||||
|
ynh_delete_file_checksum --file="../conf/msg_install"
|
||||||
|
|
||||||
if [ -z "$rtmp_port" ];
|
if [ -z "$rtmp_port" ];
|
||||||
then
|
then
|
||||||
rtmp_port=1935
|
rtmp_port=1935
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
# 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'
|
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
|
||||||
|
#
|
||||||
|
# Requires YunoHost version 4.1.0 or higher.
|
||||||
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= [t]=type= )
|
declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
|
||||||
|
@ -68,21 +70,15 @@ ynh_send_readme_to_admin() {
|
||||||
mail_subject="$mail_subject has just been installed!"
|
mail_subject="$mail_subject has just been installed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ynh_add_config --template="$app_message" --destination="../conf/msg__to_send"
|
||||||
|
|
||||||
|
ynh_delete_file_checksum --file="../conf/msg__to_send"
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
Specific information for the application $app.
|
Specific information for the application $app.
|
||||||
|
|
||||||
$(if [ -n "$app_message" ]
|
$(cat "../conf/msg__to_send")"
|
||||||
then
|
|
||||||
cat "$app_message"
|
|
||||||
else
|
|
||||||
echo "...No specific information..."
|
|
||||||
fi)
|
|
||||||
|
|
||||||
---
|
|
||||||
Automatic diagnosis data from YunoHost
|
|
||||||
|
|
||||||
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
|
|
||||||
|
|
||||||
# Store the message into a file for further modifications.
|
# Store the message into a file for further modifications.
|
||||||
echo "$mail_message" > mail_to_send
|
echo "$mail_message" > mail_to_send
|
||||||
|
@ -103,10 +99,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
||||||
# Insert url links tags
|
# Insert url links tags
|
||||||
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
|
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
|
||||||
|
|
||||||
# Insert pre tags
|
|
||||||
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
|
|
||||||
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
|
|
||||||
|
|
||||||
# Insert finishing HTML tags
|
# Insert finishing HTML tags
|
||||||
echo -e "\n</body>\n</html>" >> mail_to_send
|
echo -e "\n</body>\n</html>" >> mail_to_send
|
||||||
|
|
||||||
|
@ -115,9 +107,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
||||||
# Remove URL tags
|
# Remove URL tags
|
||||||
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
|
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
|
||||||
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
|
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
|
||||||
|
|
||||||
# Remove PRE tags
|
|
||||||
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Define binary to use for mail command
|
# Define binary to use for mail command
|
||||||
|
|
Loading…
Reference in a new issue