1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lemmy_ynh.git synced 2024-09-03 19:36:09 +02:00

Remove setup and ImageMagick

This commit is contained in:
yalh76 2022-09-24 18:22:25 +02:00
parent 9a71868f0f
commit 4a5cc06615
12 changed files with 14 additions and 205 deletions

View file

@ -21,3 +21,7 @@
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options
; commit=206df4db0b99c52f07ea1a2d5daf799d4b8357fd
name=0.15.2~ynh3
manifest_arg=domain=DOMAIN&admin=USER&sitename=lemmy_website&

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.0-22.tar.gz
SOURCE_SUM=9cf8407c59ddb596f3ef39a1d50a113bb7d0a723a4693efc066ff8c6b789c5f6
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=__APP__ Lemmy UI Daemon Description=__APP__ UI Daemon
After=network.target After=network.target
[Service] [Service]

View file

@ -79,29 +79,6 @@
# Whether or not smtp connections should use tls. Can be none, tls, or starttls # Whether or not smtp connections should use tls. Can be none, tls, or starttls
tls_type: "none" tls_type: "none"
} }
# Parameters for automatic configuration of new instance (only used at first start)
setup: {
# Username for the admin user
admin_username: "__ADMIN__"
# Password for the admin user. It must be at least 10 characters.
admin_password: "__PASSWORD__"
# Name of the site (can be changed later)
site_name: "__SITENAME__"
# Email for the admin user (optional, can be omitted and set later through the website)
admin_email: "__ADMIN_EMAIL__"
sidebar: "string"
description: "string"
icon: "string"
banner: "string"
enable_downvotes: true
open_registration: true
enable_nsfw: true
community_creation_admin_only: true
require_email_verification: true
require_application: true
application_question: "string"
private_instance: false
}
# the domain name of your instance (mandatory) # the domain name of your instance (mandatory)
hostname: "__DOMAIN__" hostname: "__DOMAIN__"
# Address where lemmy should listen for incoming requests # Address where lemmy should listen for incoming requests

View file

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=__APP__ Lemmy Daemon Description=__APP__ Daemon
After=network.target After=network.target
[Service] [Service]

View file

@ -1,3 +1,2 @@
* Lemmy require full domain path to be installed. Eg. lemmy.domain.tld * Lemmy require full domain path to be installed. Eg. lemmy.domain.tld
* The admin username and password will be sent to the admin of the YunoHost through mail.
* pict-rs image hosting service has been removed, it caused too much issue during compilation * pict-rs image hosting service has been removed, it caused too much issue during compilation

View file

@ -32,19 +32,6 @@
{ {
"name": "domain", "name": "domain",
"type": "domain" "type": "domain"
},
{
"name": "admin",
"type": "user"
},
{
"name": "sitename",
"type": "string",
"ask": {
"en": "Enter site name",
"fr": "Entrez le nom du site"
},
"example": "lemmy website"
} }
] ]
} }

View file

@ -7,11 +7,8 @@
# dependencies used by the app # dependencies used by the app
lemmy_dependencies="postgresql postgresql-contrib" lemmy_dependencies="postgresql postgresql-contrib"
lemmyui_dependencies="espeak" lemmyui_dependencies="espeak"
imagemagick_build_dependencies="libltdl-dev libjpeg-dev libpng-dev libwebp-dev liblzma-dev libxml2-dev"
imagemagick_dependencies=""
pkg_dependencies="$lemmy_dependencies $lemmyui_dependencies $imagemagick_dependencies" pkg_dependencies="$lemmy_dependencies $lemmyui_dependencies"
pkg_build_dependencies="$imagemagick_build_dependencies"
NODEJS_VERSION=12 NODEJS_VERSION=12
@ -26,56 +23,3 @@ NODEJS_VERSION=12
#================================================= #=================================================
# 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"
}

View file

@ -25,14 +25,9 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url="/"
admin=$YNH_APP_ARG_ADMIN
sitename=$YNH_APP_ARG_SITENAME
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
password=$(ynh_string_random --length=12)
admin_email=$(ynh_user_get_info --username=$admin --key="mail")
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
@ -51,9 +46,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=password --value=$password
ynh_app_setting_set --app=$app --key=sitename --value=$sitename
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -75,7 +67,7 @@ ynh_app_setting_set --app=$app --key=port_pictrs --value=$port_pictrs
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1 ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $pkg_build_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs ynh_use_nodejs
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
@ -112,7 +104,6 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="docker-image-extract" ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="docker-image-extract"
ynh_setup_source --dest_dir="$final_path/build-lemmy-ui/" --source_id="docker-image-extract" ynh_setup_source --dest_dir="$final_path/build-lemmy-ui/" --source_id="docker-image-extract"
ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations" ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
ynh_setup_source --dest_dir="$final_path/build-imagemagick/" --source_id="imagemagick"
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
@ -163,19 +154,6 @@ mkdir -p "$final_path/lemmy/"
mv -f "$final_path/build-lemmy/output/app/lemmy" "$final_path/lemmy/lemmy" mv -f "$final_path/build-lemmy/output/app/lemmy" "$final_path/lemmy/lemmy"
ynh_secure_remove --file="$final_path/build-lemmy" ynh_secure_remove --file="$final_path/build-lemmy"
# Install ImageMagick
pushd "$final_path/build-imagemagick/"
ynh_exec_warn_less ./configure --with-modules
ynh_exec_warn_less make
ynh_exec_warn_less make install
ynh_exec_warn_less ldconfig /usr/local/lib
popd
ynh_secure_remove --file="$final_path/build-imagemagick"
# Remove build stuff
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_package_autoremove
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path" chown -R $app:$app "$final_path"
@ -229,8 +207,8 @@ yunohost service add $app-ui --log="/var/log/$app/$app-ui.log"
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path=systemd ynh_systemd_action --service_name=$app --action="start" --line_match="Starting http server at" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app-ui --action="start" --line_match="Started" --log_path=systemd ynh_systemd_action --service_name=$app-ui --action="start" --line_match="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
@ -247,23 +225,6 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# 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
#================================================= #=================================================

View file

@ -65,21 +65,6 @@ ynh_script_progression --message="Removing the PostgreSQL database..." --weight=
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE IMAGEMAGICK
#=================================================
ynh_script_progression --message="Removing ImageMagick..." --weight=1
ynh_setup_source --dest_dir="$final_path/build-imagemagick/" --source_id="imagemagick"
# Install ImageMagick
pushd "$final_path/build-imagemagick/"
ynh_exec_warn_less ./configure
ynh_exec_warn_less make uninstall
popd
ynh_secure_remove --file="$final_path/build-imagemagick"
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================

View file

@ -107,27 +107,6 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name" ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"
#=================================================
# BUILDING IMAGEMAGICK
#=================================================
ynh_script_progression --message="Building ImageMagick..." --weight=1
ynh_setup_source --dest_dir="$final_path/build-imagemagick/" --source_id="imagemagick"
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $imagemagick_build_dependencies
# Install ImageMagick
pushd "$final_path/build-imagemagick/"
ynh_exec_warn_less ./configure --with-modules
ynh_exec_warn_less make
ynh_exec_warn_less make install
ynh_exec_warn_less ldconfig /usr/local/lib
popd
ynh_secure_remove --file="$final_path/build-imagemagick"
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_package_autoremove
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
@ -163,8 +142,8 @@ yunohost service add $app-ui --log="/var/log/$app/$app-ui.log"
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path=systemd ynh_systemd_action --service_name=$app --action="start" --line_match="Starting http server at" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app-ui --action="start" --line_match="Started" --log_path=systemd ynh_systemd_action --service_name=$app-ui --action="start" --line_match="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -24,12 +24,8 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) datadir=$(ynh_app_setting_get --app=$app --key=datadir)
password=$(ynh_app_setting_get --app=$app --key=password)
sitename=$(ynh_app_setting_get --app=$app --key=sitename)
port_lemmy=$(ynh_app_setting_get --app=$app --key=port_lemmy) port_lemmy=$(ynh_app_setting_get --app=$app --key=port_lemmy)
port_ui=$(ynh_app_setting_get --app=$app --key=port_ui) port_ui=$(ynh_app_setting_get --app=$app --key=port_ui)
port_pictrs=$(ynh_app_setting_get --app=$app --key=port_pictrs)
admin_email=$(ynh_user_get_info --username=$admin --key="mail")
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -113,7 +109,6 @@ then
ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="docker-image-extract" ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="docker-image-extract"
ynh_setup_source --dest_dir="$final_path/build-lemmy-ui/" --source_id="docker-image-extract" ynh_setup_source --dest_dir="$final_path/build-lemmy-ui/" --source_id="docker-image-extract"
ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations" ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
ynh_setup_source --dest_dir="$final_path/build-imagemagick/" --source_id="imagemagick"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
@ -147,8 +142,6 @@ ynh_script_progression --message="Making upgrade..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $pkg_build_dependencies
# Install lemmy-ui # Install lemmy-ui
pushd $final_path/build-lemmy-ui pushd $final_path/build-lemmy-ui
./docker-image-extract dessalines/lemmy-ui:$(ynh_app_upstream_version) ./docker-image-extract dessalines/lemmy-ui:$(ynh_app_upstream_version)
@ -164,19 +157,6 @@ then
mkdir -p "$final_path/lemmy/" mkdir -p "$final_path/lemmy/"
mv -f "$final_path/build-lemmy/output/app/lemmy" "$final_path/lemmy/lemmy" mv -f "$final_path/build-lemmy/output/app/lemmy" "$final_path/lemmy/lemmy"
ynh_secure_remove --file="$final_path/build-lemmy" ynh_secure_remove --file="$final_path/build-lemmy"
# Install ImageMagick
pushd "$final_path/build-imagemagick/"
ynh_exec_warn_less ./configure --with-modules
ynh_exec_warn_less make
ynh_exec_warn_less make install
ynh_exec_warn_less ldconfig /usr/local/lib
popd
ynh_secure_remove --file="$final_path/build-imagemagick"
# Remove build stuff
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_package_autoremove
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
@ -238,8 +218,8 @@ yunohost service add $app-ui --log="/var/log/$app/$app-ui.log"
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path=systemd ynh_systemd_action --service_name=$app --action="start" --line_match="Starting http server at" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app-ui --action="start" --line_match="Started" --log_path=systemd ynh_systemd_action --service_name=$app-ui --action="start" --line_match="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX