From bca30cfd33d1ab2e1a85ccb2984327f00c42f714 Mon Sep 17 00:00:00 2001 From: Yalh Date: Mon, 28 Jan 2019 03:20:30 +0100 Subject: [PATCH] Adding password and remove send_readme_to_admin --- scripts/install | 1 - scripts/upgrade | 46 --------------------- scripts/ynh_send_readme_to_admin | 70 -------------------------------- 3 files changed, 117 deletions(-) delete mode 100644 scripts/ynh_send_readme_to_admin diff --git a/scripts/install b/scripts/install index fe1ab42..45d068b 100755 --- a/scripts/install +++ b/scripts/install @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_send_readme_to_admin source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e02689b..38533da 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 diff --git a/scripts/ynh_send_readme_to_admin b/scripts/ynh_send_readme_to_admin deleted file mode 100644 index b164f0e..0000000 --- a/scripts/ynh_send_readme_to_admin +++ /dev/null @@ -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" -}