Compare commits

...

16 Commits

Author SHA1 Message Date
community-scripts-pr-app[bot]
654508eb94 Update CHANGELOG.md (#5239)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-18 01:15:31 +01:00
community-scripts-pr-app[bot]
acfb9d6ea1 Update versions.json (#5238)
Co-authored-by: GitHub Actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-18 02:14:53 +02:00
community-scripts-pr-app[bot]
0d56db2d3d Update CHANGELOG.md (#5237)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-17 22:06:45 +01:00
Tobias
4a1ae51446 gitea-mirror: increase build ressources (#5235) 2025-06-17 23:06:06 +02:00
community-scripts-pr-app[bot]
6520b7f4d4 Update CHANGELOG.md (#5230)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-17 15:57:51 +01:00
community-scripts-pr-app[bot]
48da94f77a Update CHANGELOG.md (#5229)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-17 15:57:35 +01:00
Chris
2ea372f034 Immich: ensure in proper working dir when updating (#5227) 2025-06-17 16:57:08 +02:00
community-scripts-pr-app[bot]
5773459a39 Update CHANGELOG.md (#5228)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-17 15:57:05 +01:00
Desert Gamer
40f083ea40 Resolve issue #5212 (#5226) 2025-06-17 16:56:27 +02:00
community-scripts-pr-app[bot]
219a7853e1 Update CHANGELOG.md (#5221)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-17 13:36:02 +01:00
TJ
6d1d903345 trilium: fix update function after db changes folder (#5207)
* Update trilium.sh

Fixed issue with db location

* Update ct/trilium.sh

Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>

* Update trilium.sh

---------

Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-06-17 14:35:17 +02:00
community-scripts-pr-app[bot]
ef9ca48477 Update versions.json (#5220)
Co-authored-by: GitHub Actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-17 14:07:50 +02:00
community-scripts-pr-app[bot]
8ac24981a6 Update CHANGELOG.md (#5219)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-17 13:02:31 +01:00
CanbiZ
7e046d830d IPTag: Better explanation (#5213) 2025-06-17 14:01:46 +02:00
community-scripts-pr-app[bot]
1691fafcc1 Update CHANGELOG.md (#5218)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-17 12:45:47 +01:00
Slaviša Arežina
4400cd2b97 Add .env (#5216) 2025-06-17 13:45:20 +02:00
9 changed files with 372 additions and 370 deletions

View File

@@ -14,8 +14,29 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment. All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment.
## 2025-06-18
## 2025-06-17 ## 2025-06-17
### 🚀 Updated Scripts
- #### 🐞 Bug Fixes
- gitea-mirror: increase build ressources [@CrazyWolf13](https://github.com/CrazyWolf13) ([#5235](https://github.com/community-scripts/ProxmoxVE/pull/5235))
- Immich: ensure in proper working dir when updating [@vhsdream](https://github.com/vhsdream) ([#5227](https://github.com/community-scripts/ProxmoxVE/pull/5227))
- Update IP-Tag [@DesertGamer](https://github.com/DesertGamer) ([#5226](https://github.com/community-scripts/ProxmoxVE/pull/5226))
- trilium: fix update function after db changes folder [@tjcomserv](https://github.com/tjcomserv) ([#5207](https://github.com/community-scripts/ProxmoxVE/pull/5207))
- #### ✨ New Features
- LibreTranslate: Add .env for easier configuration [@tremor021](https://github.com/tremor021) ([#5216](https://github.com/community-scripts/ProxmoxVE/pull/5216))
### 🌐 Website
- #### 📝 Script Information
- IPTag: Better explanation [@MickLesk](https://github.com/MickLesk) ([#5213](https://github.com/community-scripts/ProxmoxVE/pull/5213))
## 2025-06-16 ## 2025-06-16
### 🆕 New Scripts ### 🆕 New Scripts

View File

@@ -7,9 +7,9 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
APP="gitea-mirror" APP="gitea-mirror"
var_tags="${var_tags:-mirror;gitea}" var_tags="${var_tags:-mirror;gitea}"
var_cpu="${var_cpu:-1}" var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-1024}" var_ram="${var_ram:-2048}"
var_disk="${var_disk:-5}" var_disk="${var_disk:-6}"
var_os="${var_os:-debian}" var_os="${var_os:-debian}"
var_version="${var_version:-12}" var_version="${var_version:-12}"
var_unprivileged="${var_unprivileged:-1}" var_unprivileged="${var_unprivileged:-1}"

View File

@@ -30,6 +30,7 @@ function update_script() {
STAGING_DIR=/opt/staging STAGING_DIR=/opt/staging
BASE_DIR=${STAGING_DIR}/base-images BASE_DIR=${STAGING_DIR}/base-images
SOURCE_DIR=${STAGING_DIR}/image-source SOURCE_DIR=${STAGING_DIR}/image-source
cd /root
if [[ -f ~/.intel_version ]]; then if [[ -f ~/.intel_version ]]; then
curl -fsSLO https://raw.githubusercontent.com/immich-app/immich/refs/heads/main/machine-learning/Dockerfile curl -fsSLO https://raw.githubusercontent.com/immich-app/immich/refs/heads/main/machine-learning/Dockerfile
readarray -t INTEL_URLS < <(sed -n "/intel/p" ./Dockerfile | awk '{print $3}') readarray -t INTEL_URLS < <(sed -n "/intel/p" ./Dockerfile | awk '{print $3}')

View File

@@ -29,38 +29,55 @@ function update_script() {
fi fi
if [[ ! -f /opt/${APP}_version.txt ]]; then touch /opt/${APP}_version.txt; fi if [[ ! -f /opt/${APP}_version.txt ]]; then touch /opt/${APP}_version.txt; fi
RELEASE=$(curl -fsSL https://api.github.com/repos/TriliumNext/Notes/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -fsSL https://api.github.com/repos/TriliumNext/Notes/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "v${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then if [[ "v${RELEASE}" != "$(cat /opt/${APP}_version.txt 2>/dev/null)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping ${APP}"
systemctl stop trilium if [[ -d /opt/trilium/db ]]; then
sleep 1 DB_PATH="/opt/trilium/db"
msg_ok "Stopped ${APP}" DB_RESTORE_PATH="/opt/trilium/db"
elif [[ -d /opt/trilium/assets/db ]]; then
msg_info "Updating to ${RELEASE}" DB_PATH="/opt/trilium/assets/db"
mkdir -p /opt/trilium_backup DB_RESTORE_PATH="/opt/trilium/assets/db"
mv /opt/trilium/db /opt/trilium_backup/
rm -rf /opt/trilium
cd /tmp
curl -fsSL "https://github.com/TriliumNext/Notes/releases/download/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz" -o $(basename "https://github.com/TriliumNext/Notes/releases/download/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz")
tar -xf TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz
mv TriliumNextNotes-Server-$RELEASE-linux-x64 /opt/trilium
cp -r /opt/trilium_backup/db /opt/trilium/
echo "v${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated to ${RELEASE}"
msg_info "Cleaning up"
rm -rf /tmp/TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz
rm -rf /opt/trilium_backup
msg_ok "Cleaned"
msg_info "Starting ${APP}"
systemctl start trilium
sleep 1
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
else else
msg_ok "No update required. ${APP} is already at ${RELEASE}" msg_error "Database not found in either /opt/trilium/db or /opt/trilium/assets/db"
exit 1
fi fi
exit
msg_info "Stopping ${APP}"
systemctl stop trilium
sleep 1
msg_ok "Stopped ${APP}"
msg_info "Updating to ${RELEASE}"
mkdir -p /opt/trilium_backup
cp -r "${DB_PATH}" /opt/trilium_backup/
rm -rf /opt/trilium
cd /tmp
curl -fsSL "https://github.com/TriliumNext/Notes/releases/download/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz" -o "TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz"
tar -xf "TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz"
mv "TriliumNextNotes-Server-${RELEASE}-linux-x64" /opt/trilium
# Restore database
mkdir -p "$(dirname "${DB_RESTORE_PATH}")"
cp -r /opt/trilium_backup/$(basename "${DB_PATH}") "${DB_RESTORE_PATH}"
echo "v${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated to ${RELEASE}"
msg_info "Cleaning up"
rm -rf "/tmp/TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz"
rm -rf /opt/trilium_backup
msg_ok "Cleaned"
msg_info "Starting ${APP}"
systemctl start trilium
sleep 1
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
} }
start start

View File

@@ -1,5 +1,5 @@
{ {
"name": "Proxmox VE LXC IP-Tag", "name": "Proxmox VE LXC Tag",
"slug": "add-iptag", "slug": "add-iptag",
"categories": [ "categories": [
1 1
@@ -12,8 +12,8 @@
"documentation": null, "documentation": null,
"website": null, "website": null,
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/svg/proxmox.svg", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/svg/proxmox.svg",
"config_path": "", "config_path": "/opt/iptag/iptag.conf",
"description": "This script automatically adds IP address as tags to LXC containers using a Systemd service. The service also updates the tags if a LXC IP address is changed.", "description": "This script automatically adds IP address as tags to LXC containers or VM's using a systemd service. The service also updates the tags if a LXC/VM IP address is changed.",
"install_methods": [ "install_methods": [
{ {
"type": "default", "type": "default",

View File

@@ -19,9 +19,9 @@
"type": "default", "type": "default",
"script": "ct/gitea-mirror.sh", "script": "ct/gitea-mirror.sh",
"resources": { "resources": {
"cpu": 1, "cpu": 2,
"ram": 1024, "ram": 2048,
"hdd": 5, "hdd": 6,
"os": "Debian", "os": "Debian",
"version": "12" "version": "12"
} }

View File

@@ -1,4 +1,99 @@
[ [
{
"name": "grafana/grafana",
"version": "v11.5.6",
"date": "2025-06-17T22:00:40Z"
},
{
"name": "jenkinsci/jenkins",
"version": "jenkins-2.515",
"date": "2025-06-17T19:17:56Z"
},
{
"name": "coder/code-server",
"version": "v4.100.3",
"date": "2025-06-03T21:06:41Z"
},
{
"name": "HabitRPG/habitica",
"version": "v5.36.6",
"date": "2025-06-17T18:12:31Z"
},
{
"name": "fallenbagel/jellyseerr",
"version": "preview-sort-userlist",
"date": "2025-06-17T18:02:25Z"
},
{
"name": "ollama/ollama",
"version": "v0.9.2",
"date": "2025-06-17T17:51:43Z"
},
{
"name": "msgbyte/tianji",
"version": "v1.21.16",
"date": "2025-06-17T16:25:53Z"
},
{
"name": "BookStackApp/BookStack",
"version": "v25.05.1",
"date": "2025-06-17T14:38:04Z"
},
{
"name": "element-hq/synapse",
"version": "v1.132.0",
"date": "2025-06-17T13:49:30Z"
},
{
"name": "cloudflare/cloudflared",
"version": "2025.6.1",
"date": "2025-06-17T12:45:39Z"
},
{
"name": "sabnzbd/sabnzbd",
"version": "4.5.1",
"date": "2025-04-11T09:57:47Z"
},
{
"name": "crowdsecurity/crowdsec",
"version": "v1.6.9",
"date": "2025-06-17T11:54:50Z"
},
{
"name": "glpi-project/glpi",
"version": "10.0.18",
"date": "2025-02-12T11:07:02Z"
},
{
"name": "mattermost/mattermost",
"version": "v10.9.1",
"date": "2025-06-17T07:06:51Z"
},
{
"name": "morpheus65535/bazarr",
"version": "v1.5.2",
"date": "2025-05-11T16:40:55Z"
},
{
"name": "Jackett/Jackett",
"version": "v0.22.2024",
"date": "2025-06-17T05:51:55Z"
},
{
"name": "donaldzou/WGDashboard",
"version": "v4.2.4",
"date": "2025-06-17T05:37:06Z"
},
{
"name": "webmin/webmin",
"version": "2.402",
"date": "2025-06-17T05:20:42Z"
},
{
"name": "keycloak/keycloak",
"version": "26.2.5",
"date": "2025-05-28T06:49:43Z"
},
{ {
"name": "kimai/kimai", "name": "kimai/kimai",
"version": "2.36.1", "version": "2.36.1",
@@ -9,16 +104,16 @@
"version": "testing", "version": "testing",
"date": "2025-06-16T18:10:42Z" "date": "2025-06-16T18:10:42Z"
}, },
{
"name": "msgbyte/tianji",
"version": "v1.21.14",
"date": "2025-06-16T17:54:48Z"
},
{ {
"name": "goauthentik/authentik", "name": "goauthentik/authentik",
"version": "version/2025.6.2", "version": "version/2025.6.2",
"date": "2025-06-16T17:54:39Z" "date": "2025-06-16T17:54:39Z"
}, },
{
"name": "runtipi/runtipi",
"version": "nightly",
"date": "2025-06-16T17:35:17Z"
},
{ {
"name": "NodeBB/NodeBB", "name": "NodeBB/NodeBB",
"version": "v2.8.20", "version": "v2.8.20",
@@ -64,11 +159,6 @@
"version": "v1.18.3", "version": "v1.18.3",
"date": "2025-06-16T07:03:46Z" "date": "2025-06-16T07:03:46Z"
}, },
{
"name": "Jackett/Jackett",
"version": "v0.22.2020",
"date": "2025-06-16T05:56:11Z"
},
{ {
"name": "esphome/esphome", "name": "esphome/esphome",
"version": "2025.5.2", "version": "2025.5.2",
@@ -149,11 +239,6 @@
"version": "v25.0", "version": "v25.0",
"date": "2025-05-12T09:12:04Z" "date": "2025-05-12T09:12:04Z"
}, },
{
"name": "ollama/ollama",
"version": "v0.9.1-rc1",
"date": "2025-06-12T21:18:54Z"
},
{ {
"name": "theonedev/onedev", "name": "theonedev/onedev",
"version": "v11.11.0", "version": "v11.11.0",
@@ -164,21 +249,11 @@
"version": "v2.15.0", "version": "v2.15.0",
"date": "2025-06-14T10:48:57Z" "date": "2025-06-14T10:48:57Z"
}, },
{
"name": "runtipi/runtipi",
"version": "nightly",
"date": "2025-06-14T07:49:50Z"
},
{ {
"name": "FlareSolverr/FlareSolverr", "name": "FlareSolverr/FlareSolverr",
"version": "v3.3.25", "version": "v3.3.25",
"date": "2025-06-14T02:52:44Z" "date": "2025-06-14T02:52:44Z"
}, },
{
"name": "keycloak/keycloak",
"version": "26.2.5",
"date": "2025-05-28T06:49:43Z"
},
{ {
"name": "home-assistant/core", "name": "home-assistant/core",
"version": "2025.6.1", "version": "2025.6.1",
@@ -195,14 +270,9 @@
"date": "2025-06-13T15:02:37Z" "date": "2025-06-13T15:02:37Z"
}, },
{ {
"name": "jenkinsci/jenkins", "name": "wazuh/wazuh",
"version": "jenkins-2.514", "version": "coverity-w25-4.13.0",
"date": "2025-06-10T14:27:57Z" "date": "2025-06-13T13:58:23Z"
},
{
"name": "grafana/grafana",
"version": "v12.0.1+security-01",
"date": "2025-06-13T04:15:18Z"
}, },
{ {
"name": "FlowiseAI/Flowise", "name": "FlowiseAI/Flowise",
@@ -234,11 +304,6 @@
"version": "v3.3.0", "version": "v3.3.0",
"date": "2025-06-12T06:54:48Z" "date": "2025-06-12T06:54:48Z"
}, },
{
"name": "morpheus65535/bazarr",
"version": "v1.5.2",
"date": "2025-05-11T16:40:55Z"
},
{ {
"name": "documenso/documenso", "name": "documenso/documenso",
"version": "v1.12.0-rc.4", "version": "v1.12.0-rc.4",
@@ -254,36 +319,16 @@
"version": "4.8.11.0", "version": "4.8.11.0",
"date": "2025-03-10T06:39:11Z" "date": "2025-03-10T06:39:11Z"
}, },
{
"name": "crowdsecurity/crowdsec",
"version": "v1.6.8",
"date": "2025-03-25T13:33:10Z"
},
{ {
"name": "dgtlmoon/changedetection.io", "name": "dgtlmoon/changedetection.io",
"version": "0.50.3", "version": "0.50.3",
"date": "2025-06-11T15:19:52Z" "date": "2025-06-11T15:19:52Z"
}, },
{
"name": "cloudflare/cloudflared",
"version": "2025.6.0",
"date": "2025-06-11T11:13:21Z"
},
{ {
"name": "autobrr/autobrr", "name": "autobrr/autobrr",
"version": "v1.63.1", "version": "v1.63.1",
"date": "2025-06-11T11:05:42Z" "date": "2025-06-11T11:05:42Z"
}, },
{
"name": "fallenbagel/jellyseerr",
"version": "preview-forceipv4-axios",
"date": "2025-06-11T09:16:40Z"
},
{
"name": "wazuh/wazuh",
"version": "coverity-w24-4.13.0",
"date": "2025-06-11T04:04:55Z"
},
{ {
"name": "zabbix/zabbix", "name": "zabbix/zabbix",
"version": "7.2.8rc1", "version": "7.2.8rc1",
@@ -294,11 +339,6 @@
"version": "v0.15.0-rc2", "version": "v0.15.0-rc2",
"date": "2025-06-11T04:29:22Z" "date": "2025-06-11T04:29:22Z"
}, },
{
"name": "mattermost/mattermost",
"version": "server/public/v0.1.15",
"date": "2025-06-11T03:56:25Z"
},
{ {
"name": "node-red/node-red", "name": "node-red/node-red",
"version": "4.1.0-beta.1", "version": "4.1.0-beta.1",
@@ -309,11 +349,6 @@
"version": "v0.107.62", "version": "v0.107.62",
"date": "2025-05-27T12:10:19Z" "date": "2025-05-27T12:10:19Z"
}, },
{
"name": "element-hq/synapse",
"version": "v1.131.0",
"date": "2025-06-03T14:13:00Z"
},
{ {
"name": "OctoPrint/OctoPrint", "name": "OctoPrint/OctoPrint",
"version": "1.11.2", "version": "1.11.2",
@@ -459,11 +494,6 @@
"version": "mariadb-11.8.2", "version": "mariadb-11.8.2",
"date": "2025-06-04T13:35:16Z" "date": "2025-06-04T13:35:16Z"
}, },
{
"name": "donaldzou/WGDashboard",
"version": "v4.2.3",
"date": "2025-05-07T15:35:04Z"
},
{ {
"name": "actualbudget/actual", "name": "actualbudget/actual",
"version": "v25.6.1", "version": "v25.6.1",
@@ -479,26 +509,11 @@
"version": "340", "version": "340",
"date": "2025-06-04T16:41:44Z" "date": "2025-06-04T16:41:44Z"
}, },
{
"name": "glpi-project/glpi",
"version": "10.0.18",
"date": "2025-02-12T11:07:02Z"
},
{ {
"name": "louislam/uptime-kuma", "name": "louislam/uptime-kuma",
"version": "2.0.0-beta.2-temp", "version": "2.0.0-beta.2-temp",
"date": "2025-03-28T08:45:58Z" "date": "2025-03-28T08:45:58Z"
}, },
{
"name": "webmin/webmin",
"version": "2.401",
"date": "2025-06-04T02:53:03Z"
},
{
"name": "coder/code-server",
"version": "v4.100.3",
"date": "2025-06-03T21:06:41Z"
},
{ {
"name": "influxdata/influxdb", "name": "influxdata/influxdb",
"version": "v1.12.1rc3", "version": "v1.12.1rc3",
@@ -539,11 +554,6 @@
"version": "v3.4.1", "version": "v3.4.1",
"date": "2025-05-31T13:45:40Z" "date": "2025-05-31T13:45:40Z"
}, },
{
"name": "BookStackApp/BookStack",
"version": "v25.05",
"date": "2025-05-31T13:36:23Z"
},
{ {
"name": "blakeblackshear/frigate", "name": "blakeblackshear/frigate",
"version": "v0.14.1", "version": "v0.14.1",
@@ -569,11 +579,6 @@
"version": "v0.56.1", "version": "v0.56.1",
"date": "2025-05-29T19:09:16Z" "date": "2025-05-29T19:09:16Z"
}, },
{
"name": "HabitRPG/habitica",
"version": "v5.36.5",
"date": "2025-05-29T17:06:01Z"
},
{ {
"name": "readeck/readeck", "name": "readeck/readeck",
"version": "0.19.2", "version": "0.19.2",
@@ -924,11 +929,6 @@
"version": "v5.5.2", "version": "v5.5.2",
"date": "2025-04-11T22:00:06Z" "date": "2025-04-11T22:00:06Z"
}, },
{
"name": "sabnzbd/sabnzbd",
"version": "4.5.1",
"date": "2025-04-11T09:57:47Z"
},
{ {
"name": "thomiceli/opengist", "name": "thomiceli/opengist",
"version": "v1.10.0", "version": "v1.10.0",

View File

@@ -43,6 +43,10 @@ $STD uv pip install "numpy<2"
$STD uv pip install . $STD uv pip install .
$STD uv pip install libretranslate $STD uv pip install libretranslate
$STD .venv/bin/python scripts/install_models.py $STD .venv/bin/python scripts/install_models.py
cat <<EOF >/opt/libretranslate/.env
LT_PORT=5000
EOF
msg_ok "Installed LibreTranslate" msg_ok "Installed LibreTranslate"
msg_info "Creating Service" msg_info "Creating Service"
@@ -56,6 +60,7 @@ User=root
Type=idle Type=idle
Restart=always Restart=always
Environment="PATH=/usr/local/lib/python3.11/dist-packages/libretranslate" Environment="PATH=/usr/local/lib/python3.11/dist-packages/libretranslate"
EnvironmentFile=/opt/libretranslate/.env
ExecStart=/opt/libretranslate/.venv/bin/python3 /opt/libretranslate/.venv/bin/libretranslate --host * --update-models ExecStart=/opt/libretranslate/.venv/bin/python3 /opt/libretranslate/.venv/bin/libretranslate --host * --update-models
ExecReload=/bin/kill -s HUP ExecReload=/bin/kill -s HUP
KillMode=mixed KillMode=mixed

View File

@@ -531,302 +531,260 @@ if [[ ! -f /opt/iptag/iptag ]]; then
cat <<'EOF' >/opt/iptag/iptag cat <<'EOF' >/opt/iptag/iptag
#!/bin/bash #!/bin/bash
# =============== CONFIGURATION =============== # # =============== CONFIGURATION =============== #
CONFIG_FILE="/opt/iptag/iptag.conf" readonly CONFIG_FILE="/opt/iptag/iptag.conf"
readonly DEFAULT_TAG_FORMAT="full"
readonly DEFAULT_CHECK_INTERVAL=60
# Load the configuration file if it exists # Load the configuration file if it exists
if [ -f "$CONFIG_FILE" ]; then if [ -f "$CONFIG_FILE" ]; then
# shellcheck source=./iptag.conf # shellcheck source=./iptag.conf
source "$CONFIG_FILE" source "$CONFIG_FILE"
fi fi
# Convert IP to integer for comparison # Convert IP to integer for comparison
ip_to_int() { ip_to_int() {
local ip="$1" local ip="$1"
local a b c d local a b c d
IFS=. read -r a b c d <<< "${ip}" IFS=. read -r a b c d <<< "${ip}"
echo "$((a << 24 | b << 16 | c << 8 | d))" echo "$((a << 24 | b << 16 | c << 8 | d))"
} }
# Check if IP is in CIDR # Check if IP is in CIDR
ip_in_cidr() { ip_in_cidr() {
local ip="$1" local ip="$1" cidr="$2"
local cidr="$2" ipcalc -c "$ip" "$cidr" >/dev/null 2>&1 || return 1
# Use ipcalc with the -c option (check), which returns 0 if the IP is in the network local network prefix ip_parts net_parts
if ipcalc -c "$ip" "$cidr" >/dev/null 2>&1; then
# Get network address and mask from CIDR
local network prefix
network=$(echo "$cidr" | cut -d/ -f1) network=$(echo "$cidr" | cut -d/ -f1)
prefix=$(echo "$cidr" | cut -d/ -f2) prefix=$(echo "$cidr" | cut -d/ -f2)
IFS=. read -r -a ip_parts <<< "$ip"
IFS=. read -r -a net_parts <<< "$network"
# Check if IP is in the network case $prefix in
local ip_a ip_b ip_c ip_d net_a net_b net_c net_d 8) [[ "${ip_parts[0]}" == "${net_parts[0]}" ]] ;;
IFS=. read -r ip_a ip_b ip_c ip_d <<< "$ip" 16) [[ "${ip_parts[0]}.${ip_parts[1]}" == "${net_parts[0]}.${net_parts[1]}" ]] ;;
IFS=. read -r net_a net_b net_c net_d <<< "$network" 24) [[ "${ip_parts[0]}.${ip_parts[1]}.${ip_parts[2]}" == "${net_parts[0]}.${net_parts[1]}.${net_parts[2]}" ]] ;;
32) [[ "$ip" == "$network" ]] ;;
# Check octets match based on prefix length *) return 1 ;;
local result=0 esac
if (( prefix >= 8 )); then
[[ "$ip_a" != "$net_a" ]] && result=1
fi
if (( prefix >= 16 )); then
[[ "$ip_b" != "$net_b" ]] && result=1
fi
if (( prefix >= 24 )); then
[[ "$ip_c" != "$net_c" ]] && result=1
fi
return $result
fi
return 1
} }
# Format IP address according to the configuration # Format IP address according to the configuration
format_ip_tag() { format_ip_tag() {
local ip="$1" local ip="$1"
local format="${TAG_FORMAT:-full}" local format="${TAG_FORMAT:-$DEFAULT_TAG_FORMAT}"
case "$format" in case "$format" in
"last_octet") "last_octet") echo "${ip##*.}" ;;
echo "${ip##*.}" "last_two_octets") echo "${ip#*.*.}" ;;
;; *) echo "$ip" ;;
"last_two_octets") esac
echo "${ip#*.*.}"
;;
*)
echo "$ip"
;;
esac
} }
# Check if IP is in any CIDRs # Check if IP is in any CIDRs
ip_in_cidrs() { ip_in_cidrs() {
local ip="$1" local ip="$1" cidrs="$2"
local cidrs="$2" [[ -z "$cidrs" ]] && return 1
local IFS=' '
# Check that cidrs is not empty for cidr in $cidrs; do
[[ -z "$cidrs" ]] && return 1 ip_in_cidr "$ip" "$cidr" && return 0
done
local IFS=' ' return 1
for cidr in $cidrs; do
ip_in_cidr "$ip" "$cidr" && return 0
done
return 1
} }
# Check if IP is valid # Check if IP is valid
is_valid_ipv4() { is_valid_ipv4() {
local ip="$1" local ip="$1"
[[ "$ip" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]] || return 1 [[ "$ip" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]] || return 1
local IFS='.'
read -ra parts <<< "$ip" local IFS='.' parts
for part in "${parts[@]}"; do read -ra parts <<< "$ip"
[[ "$part" =~ ^[0-9]+$ ]] && ((part >= 0 && part <= 255)) || return 1 for part in "${parts[@]}"; do
done (( part >= 0 && part <= 255 )) || return 1
return 0 done
}
lxc_status_changed() {
current_lxc_status=$(pct list 2>/dev/null)
if [ "${last_lxc_status}" == "${current_lxc_status}" ]; then
return 1
else
last_lxc_status="${current_lxc_status}"
return 0 return 0
fi
}
vm_status_changed() {
current_vm_status=$(qm list 2>/dev/null)
if [ "${last_vm_status}" == "${current_vm_status}" ]; then
return 1
else
last_vm_status="${current_vm_status}"
return 0
fi
}
fw_net_interface_changed() {
current_net_interface=$(ifconfig | grep "^fw")
if [ "${last_net_interface}" == "${current_net_interface}" ]; then
return 1
else
last_net_interface="${current_net_interface}"
return 0
fi
} }
# Get VM IPs using MAC addresses and ARP table # Get VM IPs using MAC addresses and ARP table
get_vm_ips() { get_vm_ips() {
local vmid=$1 local vmid=$1 ips="" macs found_ip=false
local ips="" qm status "$vmid" 2>/dev/null | grep -q "status: running" || return
# Check if VM is running macs=$(qm config "$vmid" 2>/dev/null | grep -E 'net[0-9]+' | grep -oE '[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){5}')
qm status "$vmid" 2>/dev/null | grep -q "status: running" || return [[ -z "$macs" ]] && return
# Get MAC addresses from VM configuration for mac in $macs; do
local macs local ip
macs=$(qm config "$vmid" 2>/dev/null | grep -E 'net[0-9]+' | grep -o -E '[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){5}') ip=$(arp -an 2>/dev/null | grep -i "$mac" | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}')
[[ -n "$ip" ]] && { ips+="$ip "; found_ip=true; }
done
# Look up IPs from ARP table using MAC addresses if ! $found_ip; then
for mac in $macs; do local agent_ip
local ip agent_ip=$(qm agent "$vmid" network-get-interfaces 2>/dev/null | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' || true)
ip=$(arp -an 2>/dev/null | grep -i "$mac" | grep -o -E '([0-9]{1,3}\.){3}[0-9]{1,3}') [[ -n "$agent_ip" ]] && ips+="$agent_ip "
if [ -n "$ip" ]; then
ips+="$ip "
fi fi
done
echo "$ips" echo "${ips% }"
} }
# Update tags for container or VM # Update tags for container or VM
update_tags() { update_tags() {
local type="$1" local type="$1" vmid="$2" config_cmd="pct"
local vmid="$2" [[ "$type" == "vm" ]] && config_cmd="qm"
local config_cmd="pct"
[[ "$type" == "vm" ]] && config_cmd="qm"
# Get current IPs local current_ips_full
local current_ips_full if [[ "$type" == "lxc" ]]; then
if [[ "$type" == "lxc" ]]; then current_ips_full=$(lxc-info -n "${vmid}" -i 2>/dev/null | grep -E "^IP:" | awk '{print $2}')
# Redirect error output to suppress AppArmor warnings else
current_ips_full=$(lxc-info -n "${vmid}" -i 2>/dev/null | grep -E "^IP:" | awk '{print $2}') current_ips_full=$(get_vm_ips "${vmid}")
else
current_ips_full=$(get_vm_ips "${vmid}")
fi
# Parse current tags and get valid IPs
local current_tags=()
local next_tags=()
mapfile -t current_tags < <($config_cmd config "${vmid}" 2>/dev/null | grep tags | awk '{print $2}' | sed 's/;/\n/g')
for tag in "${current_tags[@]}"; do
# Skip tag if it looks like an IP (full or partial)
if ! is_valid_ipv4 "${tag}" && ! [[ "$tag" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
next_tags+=("${tag}")
fi fi
done [[ -z "$current_ips_full" ]] && return
# Add valid IPs to tags local current_tags=() next_tags=() current_ip_tags=()
local added_ips=() mapfile -t current_tags < <($config_cmd config "${vmid}" 2>/dev/null | grep tags | awk '{print $2}' | sed 's/;/\n/g')
local skipped_ips=()
for ip in ${current_ips_full}; do # Separate IP and non-IP tags
if is_valid_ipv4 "${ip}"; then for tag in "${current_tags[@]}"; do
if ip_in_cidrs "${ip}" "${CIDR_LIST[*]}"; then if is_valid_ipv4 "${tag}" || [[ "$tag" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
local formatted_ip=$(format_ip_tag "$ip") current_ip_tags+=("${tag}")
next_tags+=("${formatted_ip}") else
added_ips+=("${formatted_ip}") next_tags+=("${tag}")
else fi
skipped_ips+=("${ip}") done
fi
local formatted_ips=() needs_update=false added_ips=()
for ip in ${current_ips_full}; do
if is_valid_ipv4 "$ip" && ip_in_cidrs "$ip" "${CIDR_LIST[*]}"; then
local formatted_ip=$(format_ip_tag "$ip")
formatted_ips+=("$formatted_ip")
if [[ ! " ${current_ip_tags[*]} " =~ " ${formatted_ip} " ]]; then
needs_update=true
added_ips+=("$formatted_ip")
next_tags+=("$formatted_ip")
fi
fi
done
[[ ${#formatted_ips[@]} -eq 0 ]] && return
# Add existing IP tags that are still valid
for tag in "${current_ip_tags[@]}"; do
if [[ " ${formatted_ips[*]} " =~ " ${tag} " ]]; then
if [[ ! " ${next_tags[*]} " =~ " ${tag} " ]]; then
next_tags+=("$tag")
fi
fi
done
if [[ "$needs_update" == true ]]; then
echo "${type^} ${vmid}: adding IP tags: ${added_ips[*]}"
$config_cmd set "${vmid}" -tags "$(IFS=';'; echo "${next_tags[*]}")" &>/dev/null
fi fi
done }
# Log only if there are changes # Update all instances of specified type
if [ ${#added_ips[@]} -gt 0 ]; then update_all_tags() {
echo "${type^} ${vmid}: added IP tags: ${added_ips[*]}" local type="$1" list_cmd="pct" vmids count=0
fi [[ "$type" == "vm" ]] && list_cmd="qm"
vmids=$($list_cmd list 2>/dev/null | grep -v VMID | awk '{print $1}')
for vmid in $vmids; do ((count++)); done
echo "Found ${count} running ${type}s"
[[ $count -eq 0 ]] && return
# Update if changed for vmid in $vmids; do
if [[ "$(IFS=';'; echo "${current_tags[*]}")" != "$(IFS=';'; echo "${next_tags[*]}")" ]]; then update_tags "$type" "$vmid"
$config_cmd set "${vmid}" -tags "$(IFS=';'; echo "${next_tags[*]}")" &>/dev/null done
fi
} }
# Check if status changed # Check if status changed
check_status_changed() { check_status_changed() {
local type="$1" local type="$1" current
local current_status case "$type" in
"lxc") current=$(pct list 2>/dev/null | grep -v VMID) ;;
case "$type" in "vm") current=$(qm list 2>/dev/null | grep -v VMID) ;;
"lxc") "fw") current=$(ifconfig 2>/dev/null | grep "^fw") ;;
current_status=$(pct list 2>/dev/null | grep -v VMID) esac
[[ "${last_lxc_status}" == "${current_status}" ]] && return 1 local last_var="last_${type}_status"
last_lxc_status="${current_status}" [[ "${!last_var}" == "$current" ]] && return 1
;; eval "$last_var='$current'"
"vm") return 0
current_status=$(qm list 2>/dev/null | grep -v VMID)
[[ "${last_vm_status}" == "${current_status}" ]] && return 1
last_vm_status="${current_status}"
;;
"fw")
current_status=$(ifconfig 2>/dev/null | grep "^fw")
[[ "${last_net_interface}" == "${current_status}" ]] && return 1
last_net_interface="${current_status}"
;;
esac
return 0
} }
# Main check function
check() { check() {
current_time=$(date +%s) local current_time changes_detected=false
current_time=$(date +%s)
# Check LXC status # Check LXC status
time_since_last_lxc_status_check=$((current_time - last_lxc_status_check_time)) local time_since_last_lxc_check=$((current_time - last_lxc_status_check_time))
if [[ "${LXC_STATUS_CHECK_INTERVAL}" -gt 0 ]] \ if [[ "${LXC_STATUS_CHECK_INTERVAL:-60}" -gt 0 ]] && \
&& [[ "${time_since_last_lxc_status_check}" -ge "${LXC_STATUS_CHECK_INTERVAL}" ]]; then [[ "${time_since_last_lxc_check}" -ge "${LXC_STATUS_CHECK_INTERVAL:-60}" ]]; then
echo "Checking LXC status..." echo "Checking LXC status..."
last_lxc_status_check_time=${current_time} last_lxc_status_check_time=${current_time}
if check_status_changed "lxc"; then if check_status_changed "lxc"; then
update_all_tags "lxc" changes_detected=true
last_update_lxc_time=${current_time} update_all_tags "lxc"
last_update_lxc_time=${current_time}
fi
fi fi
fi
# Check VM status # Check VM status
time_since_last_vm_status_check=$((current_time - last_vm_status_check_time)) local time_since_last_vm_check=$((current_time - last_vm_status_check_time))
if [[ "${VM_STATUS_CHECK_INTERVAL}" -gt 0 ]] \ if [[ "${VM_STATUS_CHECK_INTERVAL:-60}" -gt 0 ]] && \
&& [[ "${time_since_last_vm_status_check}" -ge "${VM_STATUS_CHECK_INTERVAL}" ]]; then [[ "${time_since_last_vm_check}" -ge "${VM_STATUS_CHECK_INTERVAL:-60}" ]]; then
echo "Checking VM status..." echo "Checking VM status..."
last_vm_status_check_time=${current_time} last_vm_status_check_time=${current_time}
if check_status_changed "vm"; then if check_status_changed "vm"; then
update_all_tags "vm" changes_detected=true
last_update_vm_time=${current_time} update_all_tags "vm"
last_update_vm_time=${current_time}
fi
fi fi
fi
# Check network interface changes # Check network interface changes
time_since_last_fw_net_interface_check=$((current_time - last_fw_net_interface_check_time)) local time_since_last_fw_check=$((current_time - last_fw_net_interface_check_time))
if [[ "${FW_NET_INTERFACE_CHECK_INTERVAL}" -gt 0 ]] \ if [[ "${FW_NET_INTERFACE_CHECK_INTERVAL:-60}" -gt 0 ]] && \
&& [[ "${time_since_last_fw_net_interface_check}" -ge "${FW_NET_INTERFACE_CHECK_INTERVAL}" ]]; then [[ "${time_since_last_fw_check}" -ge "${FW_NET_INTERFACE_CHECK_INTERVAL:-60}" ]]; then
echo "Checking network interfaces..." echo "Checking network interfaces..."
last_fw_net_interface_check_time=${current_time} last_fw_net_interface_check_time=${current_time}
if check_status_changed "fw"; then if check_status_changed "fw"; then
update_all_tags "lxc" changes_detected=true
update_all_tags "vm" update_all_tags "lxc"
last_update_lxc_time=${current_time} update_all_tags "vm"
last_update_vm_time=${current_time} last_update_lxc_time=${current_time}
last_update_vm_time=${current_time}
fi
fi fi
fi
# Force update if needed # Force update if needed
for type in "lxc" "vm"; do for type in "lxc" "vm"; do
local last_update_var="last_update_${type}_time" local last_update_var="last_update_${type}_time"
local time_since_last_update=$((current_time - ${!last_update_var})) local time_since_last_update=$((current_time - ${!last_update_var}))
if [ ${time_since_last_update} -ge ${FORCE_UPDATE_INTERVAL} ]; then if [[ ${time_since_last_update} -ge ${FORCE_UPDATE_INTERVAL:-1800} ]]; then
echo "Force updating ${type} tags..." echo "Force updating ${type} tags..."
update_all_tags "$type" changes_detected=true
eval "${last_update_var}=${current_time}" update_all_tags "$type"
fi eval "${last_update_var}=${current_time}"
done fi
done
$changes_detected || echo "No changes detected in system status"
} }
# Initialize time variables # Initialize time variables
last_lxc_status_check_time=0 declare -g last_lxc_status="" last_vm_status="" last_fw_status=""
last_vm_status_check_time=0 declare -g last_lxc_status_check_time=0 last_vm_status_check_time=0 last_fw_net_interface_check_time=0
last_fw_net_interface_check_time=0 declare -g last_update_lxc_time=0 last_update_vm_time=0
last_update_lxc_time=0
last_update_vm_time=0
# main: Set the IP tags for all LXC containers and VMs # Main loop
main() { main() {
while true; do while true; do
check check
sleep "${LOOP_INTERVAL}" sleep "${LOOP_INTERVAL:-$DEFAULT_CHECK_INTERVAL}"
done done
} }
main main