From ed6deb72d9d55d138e501d3783819db431cf34f5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 2 Jul 2021 17:14:11 +0200 Subject: [PATCH] Fix --- conf/app.src | 8 ++++---- conf/systemd.service | 24 +++++++++++------------- scripts/install | 35 +++++++++-------------------------- 3 files changed, 24 insertions(+), 43 deletions(-) diff --git a/conf/app.src b/conf/app.src index c7ebf8b..ad62ff1 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/thelounge/thelounge/archive/v4.2.0.tar.gz -SOURCE_SUM=6119c0692f03678940848ec19a8095ba67f8fdba42bb12481205314eabc0672d +SOURCE_URL=https://github.com/thelounge/thelounge-deb/releases/download/v4.2.0/thelounge_4.2.0_all.deb +SOURCE_SUM= SOURCE_SUM_PRG=sha256sum -ARCH_FORMAT=tar.gz +ARCH_FORMAT=deb SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= \ No newline at end of file +SOURCE_FILENAME=thelounge_4.2.0_all.deb \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index 0aed22e..9c3bfc1 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,20 +1,18 @@ [Unit] -Description=The Lounge IRC client -After=network.target +Description=The Lounge (IRC client) +After=network-online.target +Wants=network-online.target + [Service] -Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__ -Environment="PATH=__ENV_PATH__" -Environment="THELOUNGE_HOME=/home/yunohost.app/__APP__/" -Environment="NODE_ENV=production" -ExecStart=/usr/bin/yarn start -Restart=on-failure -RestartSec=5 -StartLimitInterval=60s -StartLimitBurst=3 +Type=simple +ExecStart=/usr/bin/thelounge start +ProtectSystem=yes +ProtectHome=yes +NoNewPrivileges=yes +PrivateTmp=yes [Install] -WantedBy=default.target +WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index 28cd8db..6bdd562 100644 --- a/scripts/install +++ b/scripts/install @@ -33,10 +33,6 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_script_progression --message="Validating installation parameters..." -final_path=/var/www/$app -config_path=/home/yunohost.app/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -68,8 +64,8 @@ ynh_script_progression --message="Installing dependencies..." # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -# Install Yarn -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +# # Install Yarn +# ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # CREATE DEDICATED USER @@ -84,9 +80,9 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= ynh_script_progression --message="Setting up source files..." -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir=$final_path +tempdir="$(mktemp -d)" +ynh_setup_source --dest_dir=$tempdir --source_id=app +ynh_exec_warn_less dpkg -i $tempdir/thelounge_4.2.0_all.deb #================================================= # NGINX CONFIGURATION @@ -103,29 +99,15 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Modifying a config file..." -mkdir -p /home/yunohost.app/$app +#mkdir -p /home/yunohost.app/$app -ynh_add_config --template="../conf/config.js" --destination="$config_path/config.js" - -#================================================= -# INSTALL THE LOUNGE -#================================================= -ynh_script_progression --message="Installing The Lounge..." - -pushd $final_path - ynh_use_nodejs - yarn install - ynh_exec_warn_less NODE_ENV=production yarn build -popd +ynh_add_config --template="../conf/config.js" --destination="/etc/thelounge/config.js" #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__NODE__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service" - ynh_add_systemd_config #================================================= @@ -152,7 +134,8 @@ yunohost service add $app --description="Client Web IRC" --log="/var/log/$app/$a ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Available at http" +#ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Available at http" +systemctl enable --now thelounge.service #================================================= # SETUP SSOWAT