From 38cf296a4c8c95632c1c59df2a86846d1785f7a9 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Mon, 12 May 2025 20:22:48 +0200 Subject: [PATCH] homarr: fetch versions dynamically from source repo (#4409) * pull homarr version dynamically from source repo * fix homarr install to directly fetch pnpm and node version --- ct/homarr.sh | 15 ++++++++------- install/homarr-install.sh | 20 +++++--------------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/ct/homarr.sh b/ct/homarr.sh index d02863df7..dcb00b1e5 100644 --- a/ct/homarr.sh +++ b/ct/homarr.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) -# Copyright (c) 2021-2025 tteck -# Author: tteck (tteckster) | Co-Author: MickLesk (Canbiz) | Co-Author: CrazyWolf13 +# Copyright (c) 2021-2025 community-scripts ORG +# Author: CrazyWolf13 # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://homarr.dev/ @@ -117,11 +117,12 @@ node apps/nextjs/server.js & PID=$! wait $PID EOF chmod +x /opt/run_homarr.sh -curl -fsSL "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip") - unzip -q v${RELEASE}.zip - rm -rf v${RELEASE}.zip + $STD command -v jq || $STD apt-get update && $STD apt-get install -y jq + NODE_VERSION=$(curl -s https://raw.githubusercontent.com/homarr-labs/homarr/dev/package.json | jq -r '.engines.node | split(">=")[1] | split(".")[0]') + NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/homarr-labs/homarr/dev/package.json | jq -r '.packageManager | split("@")[1]')" + install_node_and_modules rm -rf /opt/homarr - mv homarr-${RELEASE} /opt/homarr + fetch_and_deploy_gh_release "homarr-labs/homarr" mv /opt/homarr-data-backup/.env /opt/homarr/.env cd /opt/homarr $STD pnpm install @@ -167,4 +168,4 @@ description msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" -echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7575${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7575${CL}" diff --git a/install/homarr-install.sh b/install/homarr-install.sh index efb41c662..fcf7f32f5 100644 --- a/install/homarr-install.sh +++ b/install/homarr-install.sh @@ -23,27 +23,17 @@ $STD apt-get install -y \ build-essential \ nginx \ gettext \ + jq \ openssl msg_ok "Installed Dependencies" -msg_info "Setting up Node.js Repository" -mkdir -p /etc/apt/keyrings -curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg -echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list -msg_ok "Set up Node.js Repository" - -msg_info "Installing Node.js/pnpm" -$STD apt-get update -$STD apt-get install -y nodejs -$STD npm install -g pnpm@latest -msg_ok "Installed Node.js/pnpm" +NODE_VERSION=$(curl -s https://raw.githubusercontent.com/homarr-labs/homarr/dev/package.json | jq -r '.engines.node | split(">=")[1] | split(".")[0]') +NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/homarr-labs/homarr/dev/package.json | jq -r '.packageManager | split("@")[1]')" +install_node_and_modules +fetch_and_deploy_gh_release "homarr-labs/homarr" msg_info "Installing Homarr (Patience)" cd /opt -RELEASE=$(curl -fsSL https://api.github.com/repos/homarr-labs/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -curl -fsSL "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip") -unzip -q v${RELEASE}.zip -mv homarr-${RELEASE} /opt/homarr mkdir -p /opt/homarr_db touch /opt/homarr_db/db.sqlite SECRET_ENCRYPTION_KEY="$(openssl rand -hex 32)"