Refactor: Mafl (#5702)

* Refactor: Mafl

* Update mafl.sh
This commit is contained in:
Slaviša Arežina
2025-07-04 22:24:12 +02:00
committed by GitHub
parent 3e504cf48f
commit 3d69931675
2 changed files with 28 additions and 20 deletions

View File

@ -27,18 +27,31 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
RELEASE=$(curl -fsSL https://api.github.com/repos/hywax/mafl/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -fsSL https://api.github.com/repos/hywax/mafl/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
msg_info "Updating Mafl to v${RELEASE} (Patience)" if [[ "${RELEASE}" != "$(cat ~/.mafl 2>/dev/null)" ]] || [[ ! -f ~/.mafl ]]; then
msg_info "Stopping Mafl service"
systemctl stop mafl systemctl stop mafl
curl -fsSL "https://github.com/hywax/mafl/archive/refs/tags/v${RELEASE}.tar.gz" -o $(basename "https://github.com/hywax/mafl/archive/refs/tags/v${RELEASE}.tar.gz") msg_ok "Service stopped"
tar -xzf v${RELEASE}.tar.gz
cp -r mafl-${RELEASE}/* /opt/mafl/ msg_info "Performing backup"
rm -rf mafl-${RELEASE} mkdir -p /opt/mafl-backup/data
mv /opt/mafl/data /opt/mafl-backup/data
rm /opt/mafl
msg_ok "Backup complete"
fetch_and_deploy_gh_release "mafl" "hywax/mafl"
msg_info "Updating Mafl to v${RELEASE}"
cd /opt/mafl cd /opt/mafl
yarn install yarn install
yarn build yarn build
systemctl start mafl systemctl start mafl
mv /opt/mafl-backup/data /opt/mafl/data
msg_ok "Updated Mafl to v${RELEASE}" msg_ok "Updated Mafl to v${RELEASE}"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi
exit exit
} }

View File

@ -14,22 +14,17 @@ network_check
update_os update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y make $STD apt-get install -y \
$STD apt-get install -y g++ ca-certificates \
$STD apt-get install -y gcc build-essential
$STD apt-get install -y ca-certificates
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
NODE_VERSION="22" NODE_MODULE="yarn@latest" setup_nodejs NODE_VERSION="22" NODE_MODULE="yarn@latest" setup_nodejs
fetch_and_deploy_gh_release "mafl" "hywax/mafl"
RELEASE=$(curl -fsSL https://api.github.com/repos/hywax/mafl/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
msg_info "Installing Mafl v${RELEASE}" msg_info "Installing Mafl v${RELEASE}"
curl -fsSL "https://github.com/hywax/mafl/archive/refs/tags/v${RELEASE}.tar.gz" -o "v${RELEASE}.tar.gz"
tar -xzf v${RELEASE}.tar.gz
mkdir -p /opt/mafl/data mkdir -p /opt/mafl/data
curl -fsSL "https://raw.githubusercontent.com/hywax/mafl/main/.example/config.yml" -o "/opt/mafl/data/config.yml" curl -fsSL "https://raw.githubusercontent.com/hywax/mafl/main/.example/config.yml" -o "/opt/mafl/data/config.yml"
mv mafl-${RELEASE}/* /opt/mafl
rm -rf mafl-${RELEASE}
cd /opt/mafl cd /opt/mafl
export NUXT_TELEMETRY_DISABLED=true export NUXT_TELEMETRY_DISABLED=true
$STD yarn install $STD yarn install