Refactor: Mylar3 (#8642)

* Refactor

* Update mylar3.sh
This commit is contained in:
Slaviša Arežina
2025-10-26 12:18:38 +01:00
committed by GitHub
parent 327544c737
commit e208b571b9
2 changed files with 13 additions and 25 deletions

View File

@@ -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 community-scripts ORG
# Author: davalanche
# Author: davalanche | Co-Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/mylar3/mylar3
@@ -25,16 +25,10 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/mylar3/mylar3/releases/latest | jq -r '.tag_name')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Updating ${APP} to ${RELEASE}"
rm -rf /opt/mylar3/* /opt/mylar3/.*
curl -fsSL "https://github.com/mylar3/mylar3/archive/refs/tags/${RELEASE}.tar.gz" | tar -xz --strip-components=1 -C /opt/mylar3
if check_for_gh_release "mylar3" "mylar3/mylar3"; then
fetch_and_deploy_gh_release "mylar3" "mylar3/mylar3" "tarball"
systemctl restart mylar3
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
}
@@ -46,4 +40,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}:8090${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8090${CL}"

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: davalanche
# Author: davalanche | Co-Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/mylar3/mylar3
@@ -14,7 +14,6 @@ network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y jq
cat <<EOF >/etc/apt/sources.list.d/non-free.sources
Types: deb
URIs: http://deb.debian.org/debian
@@ -23,22 +22,17 @@ Components: non-free non-free-firmware
EOF
$STD apt update
$STD apt install -y unrar
rm /etc/apt/sources.list.d/non-free.sources
msg_ok "Installed Dependencies"
msg_info "Setup Python3"
$STD apt install -y python3-pip
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
$STD pip install -U --no-cache-dir pip
msg_ok "Setup Python3"
PYTHON_VERSION="3.12" setup_uv
fetch_and_deploy_gh_release "mylar3" "mylar3/mylar3" "tarball"
msg_info "Installing ${APPLICATION}"
mkdir -p /opt/mylar3
mkdir -p /opt/mylar3-data
RELEASE=$(curl -fsSL https://api.github.com/repos/mylar3/mylar3/releases/latest | jq -r '.tag_name')
curl -fsSL "https://github.com/mylar3/mylar3/archive/refs/tags/${RELEASE}.tar.gz" | tar -xz --strip-components=1 -C /opt/mylar3
$STD pip install --no-cache-dir -r /opt/mylar3/requirements.txt
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
$STD uv venv /opt/mylar3/.venv
$STD /opt/mylar3/.venv/bin/python -m ensurepip --upgrade
$STD /opt/mylar3/.venv/bin/python -m pip install --upgrade pip
$STD /opt/mylar3/.venv/bin/python -m pip install --no-cache-dir -r /opt/mylar3/requirements.txt
msg_ok "Installed ${APPLICATION}"
msg_info "Creating Service"
@@ -48,7 +42,7 @@ Description=Mylar3 Service
After=network-online.target
[Service]
ExecStart=/usr/bin/python3 /opt/mylar3/Mylar.py --daemon --nolaunch --datadir=/opt/mylar3-data
ExecStart=/opt/mylar3/.venv/bin/python /opt/mylar3/Mylar.py --daemon --nolaunch --datadir=/opt/mylar3-data
GuessMainPID=no
Type=forking
Restart=on-failure