From 4a5cc06615f53e2d2322716f24aa02b98958d764 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 24 Sep 2022 18:22:25 +0200 Subject: [PATCH] Remove setup and ImageMagick --- check_process | 4 +++ conf/imagemagick.src | 7 ------ conf/lemmy-ui.service | 2 +- conf/lemmy.hjson | 23 ----------------- conf/lemmy.service | 2 +- doc/DISCLAIMER.md | 1 - manifest.json | 13 ---------- scripts/_common.sh | 58 +------------------------------------------ scripts/install | 45 +++------------------------------ scripts/remove | 15 ----------- scripts/restore | 25 ++----------------- scripts/upgrade | 24 ++---------------- 12 files changed, 14 insertions(+), 205 deletions(-) delete mode 100644 conf/imagemagick.src diff --git a/check_process b/check_process index 38721aa..3fe9751 100644 --- a/check_process +++ b/check_process @@ -21,3 +21,7 @@ ;;; Options Email= Notification=none +;;; Upgrade options + ; commit=206df4db0b99c52f07ea1a2d5daf799d4b8357fd + name=0.15.2~ynh3 + manifest_arg=domain=DOMAIN&admin=USER&sitename=lemmy_website& diff --git a/conf/imagemagick.src b/conf/imagemagick.src deleted file mode 100644 index 16c0fed..0000000 --- a/conf/imagemagick.src +++ /dev/null @@ -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 diff --git a/conf/lemmy-ui.service b/conf/lemmy-ui.service index 5e97a05..45da3dc 100644 --- a/conf/lemmy-ui.service +++ b/conf/lemmy-ui.service @@ -1,5 +1,5 @@ [Unit] -Description=__APP__ Lemmy UI Daemon +Description=__APP__ UI Daemon After=network.target [Service] diff --git a/conf/lemmy.hjson b/conf/lemmy.hjson index c2bf8a6..a28053b 100644 --- a/conf/lemmy.hjson +++ b/conf/lemmy.hjson @@ -79,29 +79,6 @@ # Whether or not smtp connections should use tls. Can be none, tls, or starttls 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) hostname: "__DOMAIN__" # Address where lemmy should listen for incoming requests diff --git a/conf/lemmy.service b/conf/lemmy.service index 02e1fd0..3cfc327 100644 --- a/conf/lemmy.service +++ b/conf/lemmy.service @@ -1,5 +1,5 @@ [Unit] -Description=__APP__ Lemmy Daemon +Description=__APP__ Daemon After=network.target [Service] diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index f216c43..ff56e98 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,3 +1,2 @@ * 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 diff --git a/manifest.json b/manifest.json index 7e99529..7a9cffe 100644 --- a/manifest.json +++ b/manifest.json @@ -32,19 +32,6 @@ { "name": "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" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 1a51dbf..07ff72a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,11 +7,8 @@ # dependencies used by the app lemmy_dependencies="postgresql postgresql-contrib" 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_build_dependencies="$imagemagick_build_dependencies" +pkg_dependencies="$lemmy_dependencies $lemmyui_dependencies" NODEJS_VERSION=12 @@ -26,56 +23,3 @@ NODEJS_VERSION=12 #================================================= # 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" -} \ No newline at end of file diff --git a/scripts/install b/scripts/install index a954b84..f802ce4 100755 --- a/scripts/install +++ b/scripts/install @@ -25,14 +25,9 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" -admin=$YNH_APP_ARG_ADMIN -sitename=$YNH_APP_ARG_SITENAME 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 #================================================= @@ -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=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 @@ -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_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_use_nodejs 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-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/build-imagemagick/" --source_id="imagemagick" chmod 750 "$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" 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 -R o-rwx "$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 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path=systemd -ynh_systemd_action --service_name=$app-ui --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="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log" #================================================= # SETUP SSOWAT @@ -247,23 +225,6 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1 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 #================================================= diff --git a/scripts/remove b/scripts/remove index 45241ac..e9f6065 100755 --- a/scripts/remove +++ b/scripts/remove @@ -65,21 +65,6 @@ ynh_script_progression --message="Removing the PostgreSQL database..." --weight= # Remove a database if it exists, along with the associated user 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 #================================================= diff --git a/scripts/restore b/scripts/restore index c66ec2f..2e62c14 100755 --- a/scripts/restore +++ b/scripts/restore @@ -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_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 #================================================= @@ -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_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path=systemd -ynh_systemd_action --service_name=$app-ui --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="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 343bd36..f90b6d2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,12 +24,8 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) 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_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 @@ -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-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/build-imagemagick/" --source_id="imagemagick" fi chmod 750 "$final_path" @@ -147,8 +142,6 @@ ynh_script_progression --message="Making upgrade..." --weight=1 if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $pkg_build_dependencies - # Install lemmy-ui pushd $final_path/build-lemmy-ui ./docker-image-extract dessalines/lemmy-ui:$(ynh_app_upstream_version) @@ -164,19 +157,6 @@ then mkdir -p "$final_path/lemmy/" mv -f "$final_path/build-lemmy/output/app/lemmy" "$final_path/lemmy/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 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_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path=systemd -ynh_systemd_action --service_name=$app-ui --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="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log" #================================================= # RELOAD NGINX