This commit is contained in:
Slaviša Arežina 2025-04-03 07:44:05 +02:00 committed by GitHub
parent 9c7858601e
commit 47fb1c03de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,12 +33,12 @@ function update_script() {
fi
if [[ ! -f "/usr/bin/node" ]]; then
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
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
$STD apt-get update
$STD apt-get install -y nodejs
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
RELEASE=$(curl -fsSL "https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest" | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping $APP"
systemctl stop gomft
@ -47,16 +47,16 @@ function update_script() {
msg_info "Updating $APP to ${RELEASE}"
rm -f /opt/gomft/gomft
temp_file=$(mktemp)
curl -fsSL "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.tar.gz" -o $temp_file
tar -xzf $temp_file
cp -rf GoMFT-${RELEASE}/* /opt/gomft
cd /opt/gomft
rm -f /opt/gomft/node_modules
curl -fsSL "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
tar -xzf "$temp_file"
cp -rf "GoMFT-${RELEASE}"/* /opt/gomft/
cd /opt/gomft || exit
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 $HOME/go/bin/templ generate
$STD "$HOME"/go/bin/templ generate
export CGO_ENABLED=1
export GOOS=linux
$STD go build -o gomft
@ -65,8 +65,8 @@ function update_script() {
msg_ok "Updated $APP to ${RELEASE}"
msg_info "Cleaning Up"
rm -f $temp_file
rm -rf $HOME/GoMFT-v.${RELEASE}
rm -f "$temp_file"
rm -rf "$HOME/GoMFT-v.${RELEASE}/"
msg_ok "Cleanup Complete"
msg_info "Starting $APP"