@@ -7,8 +7,8 @@ source <(curl -s https://git.community-scripts.org/community-scripts/ProxmoxVED/
77
88APP=" Mealie"
99var_tags=" ${var_tags:- recipes} "
10- var_cpu=" ${var_cpu:- 4 } "
11- var_ram=" ${var_ram:- 4096 } "
10+ var_cpu=" ${var_cpu:- 2 } "
11+ var_ram=" ${var_ram:- 2048 } "
1212var_disk=" ${var_disk:- 10} "
1313var_os=" ${var_os:- debian} "
1414var_version=" ${var_version:- 12} "
@@ -23,14 +23,68 @@ function update_script() {
2323 header_info
2424 check_container_storage
2525 check_container_resources
26- if [[ ! -d /var ]]; then
26+
27+ if [[ ! -d /opt/mealie ]]; then
2728 msg_error " No ${APP} Installation Found!"
2829 exit
2930 fi
30- msg_info " Updating $APP LXC"
31- $STD apt-get update
32- $STD apt-get -y upgrade
33- msg_ok " Updated $APP LXC"
31+
32+ msg_info " Fetching Latest Release Version"
33+ RELEASE=$( curl -fsSL https://api.github.com/repos/mealie-recipes/mealie/releases/latest | grep -oP ' "tag_name":\s*"\K[^"]+' )
34+ if [[ " ${RELEASE} " != " $( cat ~ /.mealie 2> /dev/null) " ]] || [[ ! -f ~ /.mealie ]]; then
35+
36+ PYTHON_VERSION=" 3.12" setup_uv
37+ NODE_MODULE=" yarn" NODE_VERSION=" 20" setup_nodejs
38+
39+ msg_info " Stopping $APP "
40+ systemctl stop mealie
41+ msg_ok " Stopped $APP "
42+
43+ msg_info " Backing up .env and start.sh"
44+ cp -f /opt/mealie/mealie.env /opt/mealie/mealie.env.bak
45+ cp -f /opt/mealie/start.sh /opt/mealie/start.sh.bak
46+ msg_ok " Backup completed"
47+
48+ fetch_and_deploy_gh_release " mealie" " mealie-recipes/mealie" " tarball" " $RELEASE " " /opt/mealie"
49+
50+ msg_info " Rebuilding Frontend"
51+ export NUXT_TELEMETRY_DISABLED=1
52+ cd /opt/mealie/frontend
53+ $STD yarn install --prefer-offline --frozen-lockfile --non-interactive --production=false --network-timeout 1000000
54+ $STD yarn generate
55+ cp -r /opt/mealie/frontend/dist /opt/mealie/mealie/frontend
56+ msg_ok " Frontend rebuilt"
57+
58+ msg_info " Rebuilding Backend Environment"
59+ cd /opt/mealie
60+ $STD /opt/mealie/.venv/bin/poetry self add " poetry-plugin-export>=1.9"
61+ MEALIE_VERSION=$( /opt/mealie/.venv/bin/poetry version --short)
62+ $STD /opt/mealie/.venv/bin/poetry build --output dist
63+ $STD /opt/mealie/.venv/bin/poetry export --only=main --extras=pgsql --output=dist/requirements.txt
64+ echo " mealie[pgsql]==$MEALIE_VERSION \\ " >> dist/requirements.txt
65+ /opt/mealie/.venv/bin/poetry run pip hash dist/mealie-$MEALIE_VERSION * .whl | tail -n1 | tr -d ' \n' >> dist/requirements.txt
66+ echo " \\ " >> dist/requirements.txt
67+ /opt/mealie/.venv/bin/poetry run pip hash dist/mealie-$MEALIE_VERSION * .tar.gz | tail -n1 >> dist/requirements.txt
68+ msg_ok " Backend prepared"
69+
70+ msg_info " Installing Mealie $MEALIE_VERSION "
71+ $STD /opt/mealie/.venv/bin/uv pip install --require-hashes -r /opt/mealie/dist/requirements.txt --find-links dist
72+ msg_ok " Installed Mealie $MEALIE_VERSION "
73+
74+ msg_info " Restoring Configuration"
75+ mv -f /opt/mealie/mealie.env.bak /opt/mealie/mealie.env
76+ mv -f /opt/mealie/start.sh.bak /opt/mealie/start.sh
77+ chmod +x /opt/mealie/start.sh
78+ msg_ok " Configuration restored"
79+
80+ msg_info " Starting $APP "
81+ systemctl start mealie
82+ msg_ok " Started $APP "
83+
84+ msg_ok " Update to $RELEASE Successful"
85+ else
86+ msg_ok " No update required. ${APP} is already at v${RELEASE} "
87+ fi
3488 exit
3589}
3690
0 commit comments