mirror of
https://github.com/YunoHost-Apps/lemmy_ynh.git
synced 2024-09-03 19:36:09 +02:00
Fix install and upgrade
This commit is contained in:
parent
a909f57c5b
commit
7c9c3c365d
3 changed files with 76 additions and 6 deletions
|
@ -18,3 +18,56 @@ pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTURE OFFICIAL HELPERS
|
# FUTURE OFFICIAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Send an email to inform the administrator
|
||||||
|
#
|
||||||
|
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||||
|
# | arg: app_message - The message to send to the administrator.
|
||||||
|
# | arg: 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() {
|
||||||
|
local app_message="${1:-...No specific information...}"
|
||||||
|
local recipients="${2:-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\` has important message for you"
|
||||||
|
|
||||||
|
local mail_message="This is an automated message from your beloved YunoHost server. Specific information for $app.
|
||||||
|
$app_message"
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
}
|
|
@ -95,9 +95,9 @@ ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
|
|
||||||
mkdir "$final_path"
|
mkdir "$final_path"
|
||||||
cp -f ../conf/default.yml "$final_path/docker-compose.yml"
|
cp -f ../conf/docker-compose.yml "$final_path/docker-compose.yml"
|
||||||
cp -f ../conf/default.yml "$final_path/lemmy.hjson"
|
cp -f ../conf/lemmy.hjson "$final_path/lemmy.hjson"
|
||||||
cp -f ../conf/default.yml "$final_path/iframely.config.local.js"
|
cp -f ../conf/iframely.config.local.js "$final_path/iframely.config.local.js"
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
mkdir -p volumes/pictrs
|
mkdir -p volumes/pictrs
|
||||||
chown -R 991:991 volumes/pictrs
|
chown -R 991:991 volumes/pictrs
|
||||||
|
@ -151,6 +151,23 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
cd "$final_path" && docker-compose up -d
|
cd "$final_path" && docker-compose up -d
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SEND A README FOR THE ADMIN
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
message="Lemmy was successfully installed :)
|
||||||
|
|
||||||
|
Please open https://$domain$path_url
|
||||||
|
|
||||||
|
Your credentials for the admin panel are:
|
||||||
|
- admin username: $admin
|
||||||
|
- admin password: $password
|
||||||
|
|
||||||
|
If you facing an issue or want to improve Lemmy, please open a new issue in this project: https://github.com/YunoHost-Apps/lemmy_ynh/issues"
|
||||||
|
|
||||||
|
ynh_send_readme_to_admin "$message"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -58,9 +58,9 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
cp -f ../conf/default.yml "$final_path/docker-compose.yml"
|
cp -f ../conf/docker-compose.yml "$final_path/docker-compose.yml"
|
||||||
cp -f ../conf/default.yml "$final_path/lemmy.hjson"
|
cp -f ../conf/lemmy.hjson "$final_path/lemmy.hjson"
|
||||||
cp -f ../conf/default.yml "$final_path/iframely.config.local.js"
|
cp -f ../conf/iframely.config.local.js "$final_path/iframely.config.local.js"
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
chown -R 991:991 volumes/pictrs
|
chown -R 991:991 volumes/pictrs
|
||||||
popd
|
popd
|
||||||
|
|
Loading…
Reference in a new issue