From 986727cc6f82d179714bcf967987faa8b3e5d2a5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 05:19:39 +0000 Subject: [PATCH 1/7] Initial plan From 542e0b93cb3357d466ca9325fae22761121eb296 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 05:25:14 +0000 Subject: [PATCH 2/7] Fix HOME environment variable issue in Bun installation Set HOME environment variable before running Bun installation script to prevent "unbound variable" errors in YunoHost environment. This fixes the installation failure where the Bun installer expects $HOME to be set. Applies fix to install, restore, and upgrade scripts. Co-authored-by: MrTakedi <3440483+MrTakedi@users.noreply.github.com> --- scripts/install | 1 + scripts/restore | 1 + scripts/upgrade | 1 + 3 files changed, 3 insertions(+) diff --git a/scripts/install b/scripts/install index 3e3e9e1b5..cd354103b 100755 --- a/scripts/install +++ b/scripts/install @@ -11,6 +11,7 @@ ynh_script_progression "Installing Bun runtime..." # This is the recommended installation method per https://bun.sh/docs/installation if ! command -v bun &> /dev/null; then export BUN_INSTALL="$install_dir/.bun" + export HOME="$data_dir" curl -fsSL https://bun.sh/install | bash export PATH="$BUN_INSTALL/bin:$PATH" fi diff --git a/scripts/restore b/scripts/restore index f9512c2b2..a63f1251f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -31,6 +31,7 @@ ynh_script_progression "Reinstalling Bun runtime..." # This is the recommended installation method per https://bun.sh/docs/installation if ! command -v bun &> /dev/null; then export BUN_INSTALL="$install_dir/.bun" + export HOME="$data_dir" curl -fsSL https://bun.sh/install | bash export PATH="$BUN_INSTALL/bin:$PATH" fi diff --git a/scripts/upgrade b/scripts/upgrade index dd7071d02..2536a6193 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,6 +18,7 @@ ynh_script_progression "Upgrading Bun runtime..." # This is the recommended installation method per https://bun.sh/docs/installation if ! command -v bun &> /dev/null; then export BUN_INSTALL="$install_dir/.bun" + export HOME="$data_dir" curl -fsSL https://bun.sh/install | bash export PATH="$BUN_INSTALL/bin:$PATH" fi From 799066d42baf6371a2b2e2f6d0a7d7fe352170c5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 05:30:54 +0000 Subject: [PATCH 3/7] Initial plan From 5df1cdacee5f2c9659824268c43c95ab5ec626a5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 05:36:55 +0000 Subject: [PATCH 4/7] Replace ynh_hide_warnings with ynh_exec_as_app in install and upgrade scripts Co-authored-by: MrTakedi <3440483+MrTakedi@users.noreply.github.com> --- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index cd354103b..5fc71c551 100755 --- a/scripts/install +++ b/scripts/install @@ -34,8 +34,8 @@ chmod -R 750 "$install_dir" ynh_script_progression "Building application..." pushd "$install_dir" - ynh_hide_warnings "$install_dir/.bun/bin/bun" install --frozen-lockfile - ynh_hide_warnings "$install_dir/.bun/bin/bun" run build + ynh_exec_as_app "$install_dir/.bun/bin/bun" install --frozen-lockfile + ynh_exec_as_app "$install_dir/.bun/bin/bun" run build popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2536a6193..67cf7b045 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,8 +41,8 @@ chmod -R 750 "$install_dir" ynh_script_progression "Building application..." pushd "$install_dir" - ynh_hide_warnings "$install_dir/.bun/bin/bun" install --frozen-lockfile - ynh_hide_warnings "$install_dir/.bun/bin/bun" run build + ynh_exec_as_app "$install_dir/.bun/bin/bun" install --frozen-lockfile + ynh_exec_as_app "$install_dir/.bun/bin/bun" run build popd #================================================= From b0d807308b0346946777442ab1ecfe7909e7bb01 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 05:39:03 +0000 Subject: [PATCH 5/7] Use sudo -u instead of ynh_exec_as_app for clearer command execution Co-authored-by: MrTakedi <3440483+MrTakedi@users.noreply.github.com> --- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 5fc71c551..9945ec57a 100755 --- a/scripts/install +++ b/scripts/install @@ -34,8 +34,8 @@ chmod -R 750 "$install_dir" ynh_script_progression "Building application..." pushd "$install_dir" - ynh_exec_as_app "$install_dir/.bun/bin/bun" install --frozen-lockfile - ynh_exec_as_app "$install_dir/.bun/bin/bun" run build + sudo -u "$app" env PATH="$PATH" "$install_dir/.bun/bin/bun" install --frozen-lockfile + sudo -u "$app" env PATH="$PATH" "$install_dir/.bun/bin/bun" run build popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 67cf7b045..187c7436f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,8 +41,8 @@ chmod -R 750 "$install_dir" ynh_script_progression "Building application..." pushd "$install_dir" - ynh_exec_as_app "$install_dir/.bun/bin/bun" install --frozen-lockfile - ynh_exec_as_app "$install_dir/.bun/bin/bun" run build + sudo -u "$app" env PATH="$PATH" "$install_dir/.bun/bin/bun" install --frozen-lockfile + sudo -u "$app" env PATH="$PATH" "$install_dir/.bun/bin/bun" run build popd #================================================= From a5e1588b5c93f2ac6482ae1e206508b00994b80a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 05:44:43 +0000 Subject: [PATCH 6/7] Initial plan From 4d346ea000a71da4fca9ebb57140038fd99fab38 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 05:49:40 +0000 Subject: [PATCH 7/7] Fix YunoHost helper function names for version 12.x compatibility Co-authored-by: MrTakedi <3440483+MrTakedi@users.noreply.github.com> --- manifest.toml | 2 +- scripts/change_url | 2 +- scripts/install | 6 +++--- scripts/remove | 6 +++--- scripts/upgrade | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest.toml b/manifest.toml index ee93fa731..72cdfb323 100644 --- a/manifest.toml +++ b/manifest.toml @@ -15,7 +15,7 @@ website = "https://github.com/ericc-ch/copilot-api" code = "https://github.com/ericc-ch/copilot-api" [integration] -yunohost = ">= 11.2" +yunohost = ">= 12.0" architectures = "all" multi_instance = true ldap = false diff --git a/scripts/change_url b/scripts/change_url index 29998a65c..572d49c6c 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,7 +14,7 @@ ynh_systemctl --service="$app" --action="stop" --log_path="/var/log/$app/$app.lo #================================================= ynh_script_progression "Updating NGINX web server configuration..." -ynh_config_change_url_nginx +ynh_change_url_nginx_config #================================================= # START SYSTEMD SERVICE diff --git a/scripts/install b/scripts/install index 9945ec57a..193bc302a 100755 --- a/scripts/install +++ b/scripts/install @@ -44,13 +44,13 @@ popd ynh_script_progression "Adding system configurations related to $app..." # Create a dedicated NGINX config using the conf/nginx.conf template -ynh_config_add_nginx +ynh_add_nginx_config # Create a dedicated systemd config -ynh_config_add_systemd +ynh_add_systemd_config # Use logrotate to manage application logfile(s) -ynh_config_add_logrotate +ynh_use_logrotate yunohost service add "$app" --description="Copilot API Proxy" --log="/var/log/$app/$app.log" diff --git a/scripts/remove b/scripts/remove index 11f71e0f4..340eed19a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -13,7 +13,7 @@ if yunohost service status "$app" >/dev/null 2>&1; then fi # Remove the dedicated systemd config -ynh_config_remove_systemd +ynh_remove_systemd_config #================================================= # REMOVE LOGROTATE CONFIGURATION @@ -21,7 +21,7 @@ ynh_config_remove_systemd ynh_script_progression "Removing logrotate configuration..." # Remove the app-specific logrotate config -ynh_config_remove_logrotate +ynh_remove_logrotate #================================================= # REMOVE NGINX CONFIGURATION @@ -29,7 +29,7 @@ ynh_config_remove_logrotate ynh_script_progression "Removing NGINX web server configuration..." # Remove the dedicated NGINX config -ynh_config_remove_nginx +ynh_remove_nginx_config #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 187c7436f..47b67f04f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -51,13 +51,13 @@ popd ynh_script_progression "Updating configuration..." # Update NGINX configuration -ynh_config_add_nginx +ynh_add_nginx_config # Update systemd configuration -ynh_config_add_systemd +ynh_add_systemd_config # Update logrotate configuration -ynh_config_add_logrotate +ynh_use_logrotate #================================================= # START SYSTEMD SERVICE