From 3c909cabb656b1a271c574057a142a5d39fd5db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Thu, 17 Apr 2025 15:09:07 +0200 Subject: [PATCH] Fix install and update process (final time) (#3922) --- ct/gomft.sh | 7 ++----- install/gomft-install.sh | 20 +++++++------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/ct/gomft.sh b/ct/gomft.sh index 10c1cce2d..b16388217 100644 --- a/ct/gomft.sh +++ b/ct/gomft.sh @@ -51,11 +51,8 @@ function update_script() { tar -xzf "$temp_file" cp -rf "GoMFT-${RELEASE}"/* /opt/gomft/ cd /opt/gomft - rm -rf /opt/gomft/node_modules - $STD npm ci - $STD node build.js - $STD go mod download - $STD go get -u github.com/a-h/templ + $STD npm install + $STD npm run build $STD "$HOME"/go/bin/templ generate export CGO_ENABLED=1 export GOOS=linux diff --git a/install/gomft-install.sh b/install/gomft-install.sh index d0b72b59e..878365376 100644 --- a/install/gomft-install.sh +++ b/install/gomft-install.sh @@ -47,19 +47,13 @@ msg_ok "Installed Node.js" msg_info "Setup ${APPLICATION} (Patience)" temp_file=$(mktemp) RELEASE=$(curl -fsSL https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -curl -fsSL "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.tar.gz" -o $temp_file -tar -xzf $temp_file -mv GoMFT-${RELEASE}/ /opt/gomft +curl -fsSL "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" +tar -xzf "$temp_file" +mv GoMFT-"${RELEASE}"/ /opt/gomft cd /opt/gomft -$STD npm ci -$STD node build.js -$STD go mod download $STD go install github.com/a-h/templ/cmd/templ@latest -$STD go get -u github.com/a-h/templ -$STD $HOME/go/bin/templ generate -export CGO_ENABLED=1 -export GOOS=linux -$STD go build -o gomft +$STD "$HOME"/go/bin/templ generate +$STD go build -o gomft main.go chmod +x /opt/gomft/gomft JWT_SECRET_KEY=$(openssl rand -base64 24 | tr -d '/+=') @@ -83,7 +77,7 @@ EMAIL_USERNAME=smtp_username EMAIL_PASSWORD=smtp_password EOF -echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +echo "${RELEASE}" >/opt/"${APPLICATION}"_version.txt msg_ok "Setup ${APPLICATION}" msg_info "Creating Service" @@ -109,7 +103,7 @@ motd_ssh customize msg_info "Cleaning up" -rm -f $temp_file +rm -f "$temp_file" $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"