Skip to content

Commit e208b57

Browse files
authored
Refactor: Mylar3 (#8642)
* Refactor * Update mylar3.sh
1 parent 327544c commit e208b57

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

ct/mylar3.sh

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
33
# Copyright (c) 2021-2025 community-scripts ORG
4-
# Author: davalanche
4+
# Author: davalanche | Co-Author: Slaviša Arežina (tremor021)
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
66
# Source: https://github.com/mylar3/mylar3
77

@@ -25,16 +25,10 @@ function update_script() {
2525
msg_error "No ${APP} Installation Found!"
2626
exit
2727
fi
28-
RELEASE=$(curl -fsSL https://api.github.com/repos/mylar3/mylar3/releases/latest | jq -r '.tag_name')
29-
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
30-
msg_info "Updating ${APP} to ${RELEASE}"
31-
rm -rf /opt/mylar3/* /opt/mylar3/.*
32-
curl -fsSL "https://github.com/mylar3/mylar3/archive/refs/tags/${RELEASE}.tar.gz" | tar -xz --strip-components=1 -C /opt/mylar3
28+
29+
if check_for_gh_release "mylar3" "mylar3/mylar3"; then
30+
fetch_and_deploy_gh_release "mylar3" "mylar3/mylar3" "tarball"
3331
systemctl restart mylar3
34-
echo "${RELEASE}" >/opt/${APP}_version.txt
35-
msg_ok "Updated ${APP} to ${RELEASE}"
36-
else
37-
msg_ok "No update required. ${APP} is already at ${RELEASE}"
3832
fi
3933
exit
4034
}
@@ -46,4 +40,4 @@ description
4640
msg_ok "Completed Successfully!\n"
4741
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
4842
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
49-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8090${CL}"
43+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8090${CL}"

install/mylar3-install.sh

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# Copyright (c) 2021-2025 community-scripts ORG
4-
# Author: davalanche
4+
# Author: davalanche | Co-Author: Slaviša Arežina (tremor021)
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
66
# Source: https://github.com/mylar3/mylar3
77

@@ -14,7 +14,6 @@ network_check
1414
update_os
1515

1616
msg_info "Installing Dependencies"
17-
$STD apt install -y jq
1817
cat <<EOF >/etc/apt/sources.list.d/non-free.sources
1918
Types: deb
2019
URIs: http://deb.debian.org/debian
@@ -23,22 +22,17 @@ Components: non-free non-free-firmware
2322
EOF
2423
$STD apt update
2524
$STD apt install -y unrar
26-
rm /etc/apt/sources.list.d/non-free.sources
2725
msg_ok "Installed Dependencies"
2826

29-
msg_info "Setup Python3"
30-
$STD apt install -y python3-pip
31-
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
32-
$STD pip install -U --no-cache-dir pip
33-
msg_ok "Setup Python3"
27+
PYTHON_VERSION="3.12" setup_uv
28+
fetch_and_deploy_gh_release "mylar3" "mylar3/mylar3" "tarball"
3429

3530
msg_info "Installing ${APPLICATION}"
36-
mkdir -p /opt/mylar3
3731
mkdir -p /opt/mylar3-data
38-
RELEASE=$(curl -fsSL https://api.github.com/repos/mylar3/mylar3/releases/latest | jq -r '.tag_name')
39-
curl -fsSL "https://github.com/mylar3/mylar3/archive/refs/tags/${RELEASE}.tar.gz" | tar -xz --strip-components=1 -C /opt/mylar3
40-
$STD pip install --no-cache-dir -r /opt/mylar3/requirements.txt
41-
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
32+
$STD uv venv /opt/mylar3/.venv
33+
$STD /opt/mylar3/.venv/bin/python -m ensurepip --upgrade
34+
$STD /opt/mylar3/.venv/bin/python -m pip install --upgrade pip
35+
$STD /opt/mylar3/.venv/bin/python -m pip install --no-cache-dir -r /opt/mylar3/requirements.txt
4236
msg_ok "Installed ${APPLICATION}"
4337

4438
msg_info "Creating Service"
@@ -48,7 +42,7 @@ Description=Mylar3 Service
4842
After=network-online.target
4943
5044
[Service]
51-
ExecStart=/usr/bin/python3 /opt/mylar3/Mylar.py --daemon --nolaunch --datadir=/opt/mylar3-data
45+
ExecStart=/opt/mylar3/.venv/bin/python /opt/mylar3/Mylar.py --daemon --nolaunch --datadir=/opt/mylar3-data
5246
GuessMainPID=no
5347
Type=forking
5448
Restart=on-failure

0 commit comments

Comments
 (0)