mirror of
https://github.com/YunoHost-Apps/pleroma_ynh.git
synced 2024-09-03 20:15:59 +02:00
Adding password and remove send_readme_to_admin
This commit is contained in:
parent
6c6b39678e
commit
bca30cfd33
3 changed files with 0 additions and 117 deletions
|
@ -7,7 +7,6 @@
|
|||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source ynh_send_readme_to_admin
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -148,52 +148,6 @@ ynh_system_user_create $app
|
|||
# ...
|
||||
#=================================================
|
||||
|
||||
#===================================================
|
||||
# Add PostgreSQL extension pg_trgm and citext
|
||||
#===================================================
|
||||
|
||||
#ynh_psql_execute_as_root "\connect $db_name
|
||||
#CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||
#ynh_psql_execute_as_root "\connect $db_name
|
||||
#CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS citext;"
|
||||
|
||||
# Open this port
|
||||
#yunohost firewall allow Both "$port" 2>&1
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
#cp -f ../conf/prod.secret.exs "$final_path/$app/config/prod.secret.exs"
|
||||
#cp -f ../conf/setup_db.psql "$final_path/$app/config/setup_db.psql"
|
||||
|
||||
#ynh_replace_string "__DOMAIN__" "$domain" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__KEY__" "$random_key" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__INSTANCE_NAME__" "$name" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__DB_NAME__" "$app" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__ADMIN_EMAIL__" "$admin_email" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__PORT__" "$port" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__DB_NAME__" "$app" "$final_path/$app/config/setup_db.psql"
|
||||
#ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/$app/config/setup_db.psql"
|
||||
#if [ $cache -eq 1 ]
|
||||
#then
|
||||
# ynh_replace_string "__MEDIA_CACHE__" "true" "$final_path/$app/config/prod.secret.exs"
|
||||
#else
|
||||
# ynh_replace_string "__MEDIA_CACHE__" "false" "$final_path/$app/config/prod.secret.exs"
|
||||
#fi
|
||||
|
||||
# Set registrations open/closed
|
||||
#if [ $registration -eq 1 ]
|
||||
#then
|
||||
# ynh_replace_string "__REG__" "true" "$final_path/$app/config/prod.secret.exs"
|
||||
#else
|
||||
# ynh_replace_string "__REG__" "false" "$final_path/$app/config/prod.secret.exs"
|
||||
#fi
|
||||
|
||||
# Recalculate and store the config file checksum into the app settings
|
||||
#ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs"
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# MAKE UPGRADE
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Need also the helper https://github.com/YunoHost-Apps/Experimental_helpers/blob/master/ynh_handle_getopts_args/ynh_handle_getopts_args
|
||||
|
||||
# Send an email to inform the administrator
|
||||
#
|
||||
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||
# | 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
|
||||
# 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
|
||||
# example: "root admin@domain user1 user2"
|
||||
ynh_send_readme_to_admin() {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [m]=app_message= [r]=recipients= )
|
||||
local app_message
|
||||
local recipients
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
local app_message="${app_message:-...No specific information...}"
|
||||
local recipients="${recipients:-root}"
|
||||
|
||||
# Retrieve the email of users
|
||||
find_mails () {
|
||||
local list_mails="$1"
|
||||
local mail
|
||||
local recipients=" "
|
||||
# Read each mail in argument
|
||||
for mail in $list_mails
|
||||
do
|
||||
# Keep root or a real email address as it is
|
||||
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
else
|
||||
# But replace an user name without a domain after by its email
|
||||
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "$recipients"
|
||||
}
|
||||
recipients=$(find_mails "$recipients")
|
||||
|
||||
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
|
||||
|
||||
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||
|
||||
Specific information for the application $app.
|
||||
|
||||
$app_message
|
||||
|
||||
---
|
||||
Automatic diagnosis data from YunoHost
|
||||
|
||||
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
||||
|
||||
# Define binary to use for mail command
|
||||
if [ -e /usr/bin/bsd-mailx ]
|
||||
then
|
||||
local mail_bin=/usr/bin/bsd-mailx
|
||||
else
|
||||
local mail_bin=/usr/bin/mail.mailutils
|
||||
fi
|
||||
|
||||
# Send the email to the recipients
|
||||
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||
}
|
Loading…
Add table
Reference in a new issue