mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-07-01 11:37:38 +00:00
Compare commits
25 Commits
2024-12-16
...
2024-12-18
Author | SHA1 | Date | |
---|---|---|---|
a9a640bb75 | |||
056d8902fb | |||
fe3faccc42 | |||
9236f97009 | |||
17eaedf335 | |||
d0f2c71038 | |||
22c0757b4d | |||
cd374c296f | |||
07508d10d0 | |||
29dcf19c04 | |||
3e60e43d05 | |||
f199366867 | |||
9efb421b5c | |||
d65d64e59e | |||
47307be181 | |||
a6f3771214 | |||
7261affcc2 | |||
c60b16229b | |||
b18b49ef6f | |||
870313cc58 | |||
e9c0ca8579 | |||
73d5794086 | |||
a46e66fd9a | |||
79d597297c | |||
f511d88502 |
6
.github/pull_request_template.md
vendored
6
.github/pull_request_template.md
vendored
@ -7,13 +7,13 @@
|
||||
## ✍️ Description
|
||||
Provide a summary of the changes made and/or reference the issue being addressed.
|
||||
|
||||
-
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
**_Please remove unneeded lines!_**
|
||||
- Related Issue: # (issue number, if applicable)
|
||||
- Related PR: # (if applicable)
|
||||
- Related Discussion: [Link](https://github.com/community-scripts/ProxmoxVE/discussions)
|
||||
- Related Discussion: []()(if applicable)
|
||||
|
||||
---
|
||||
|
||||
|
39
CHANGELOG.md
39
CHANGELOG.md
@ -16,6 +16,45 @@ All LXC instances created using this repository come pre-installed with Midnight
|
||||
> [!IMPORTANT]
|
||||
Do not break established syntax in this file, as it is automatically updated by a Github Workflow
|
||||
|
||||
## 2024-12-18
|
||||
|
||||
### Changed
|
||||
|
||||
### ✨ New Scripts
|
||||
|
||||
- New script: Part-DB LXC [@bvdberg01](https://github.com/bvdberg01) ([#591](https://github.com/community-scripts/ProxmoxVE/pull/591))
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
- Fix Kernel-Clean for Proxmox 8.x [@MickLesk](https://github.com/MickLesk) ([#904](https://github.com/community-scripts/ProxmoxVE/pull/904))
|
||||
- [Frigate] Remove SSE 4.2 from instruction set supporting OpenVino [@remz1337](https://github.com/remz1337) ([#902](https://github.com/community-scripts/ProxmoxVE/pull/902))
|
||||
|
||||
### 🌐 Website
|
||||
|
||||
- New Metadata Category: "Coding & AI" [@newzealandpaul](https://github.com/newzealandpaul) ([#890](https://github.com/community-scripts/ProxmoxVE/pull/890))
|
||||
- Moved Webmin to "Server & Networking" [@newzealandpaul](https://github.com/newzealandpaul) ([#891](https://github.com/community-scripts/ProxmoxVE/pull/891))
|
||||
|
||||
## 2024-12-17
|
||||
|
||||
### Changed
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
- Fix Alpine-Nextcloud: Bump PHP Version to 8.3 [@michelroegl-brunner](https://github.com/michelroegl-brunner) ([#865](https://github.com/community-scripts/ProxmoxVE/pull/865))
|
||||
- Correction of Jellyfin CT Port [@mneten](https://github.com/mneten) ([#884](https://github.com/community-scripts/ProxmoxVE/pull/884))
|
||||
- fix spinner on lxc-ip-tag [@MickLesk](https://github.com/MickLesk) ([#876](https://github.com/community-scripts/ProxmoxVE/pull/876))
|
||||
- Fix Keycloak Installation [@MickLesk](https://github.com/MickLesk) ([#874](https://github.com/community-scripts/ProxmoxVE/pull/874))
|
||||
- Fix ports ressources [@MickLesk](https://github.com/MickLesk) ([#867](https://github.com/community-scripts/ProxmoxVE/pull/867))
|
||||
|
||||
### 🧰 Maintenance
|
||||
|
||||
- Small Changes to the PR Template [@michelroegl-brunner](https://github.com/michelroegl-brunner) ([#862](https://github.com/community-scripts/ProxmoxVE/pull/862))
|
||||
|
||||
### ❔ Unlabelled
|
||||
|
||||
- calculate terminal size for header_info [@MickLesk](https://github.com/MickLesk) ([#879](https://github.com/community-scripts/ProxmoxVE/pull/879))
|
||||
- Fix header creation with figlet for alpine [@MickLesk](https://github.com/MickLesk) ([#869](https://github.com/community-scripts/ProxmoxVE/pull/869))
|
||||
|
||||
## 2024-12-16
|
||||
|
||||
### Changed
|
||||
|
@ -8,9 +8,9 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
|
||||
# App Default Values
|
||||
APP="Adguard"
|
||||
var_tags="adblock"
|
||||
var_cpu="2"
|
||||
var_ram="2048"
|
||||
var_disk="4"
|
||||
var_cpu="1"
|
||||
var_ram="512"
|
||||
var_disk="2"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_unprivileged="1"
|
||||
@ -43,4 +43,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}:3000${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
|
||||
|
@ -41,13 +41,13 @@ function update_script() {
|
||||
rm -rf kepubify-linux-64bit
|
||||
curl -fsSLO https://github.com/pgaskin/kepubify/releases/latest/download/kepubify-linux-64bit
|
||||
chmod +x kepubify-linux-64bit
|
||||
menu_array=("1" "Enables gdrive as storage backend for your ebooks" OFF
|
||||
"2" "Enables sending emails via a googlemail account without enabling insecure apps" OFF
|
||||
"3" "Enables displaying of additional author infos on the authors page" OFF
|
||||
"4" "Enables login via LDAP server" OFF
|
||||
"5" "Enables login via google or github oauth" OFF
|
||||
"6" "Enables extracting of metadata from epub, fb2, pdf files, and also extraction of covers from cbr, cbz, cbt files" OFF
|
||||
"7" "Enables extracting of metadata from cbr, cbz, cbt files" OFF
|
||||
menu_array=("1" "Enables gdrive as storage backend for your ebooks" OFF \
|
||||
"2" "Enables sending emails via a googlemail account without enabling insecure apps" OFF \
|
||||
"3" "Enables displaying of additional author infos on the authors page" OFF \
|
||||
"4" "Enables login via LDAP server" OFF \
|
||||
"5" "Enables login via google or github oauth" OFF \
|
||||
"6" "Enables extracting of metadata from epub, fb2, pdf files, and also extraction of covers from cbr, cbz, cbt files" OFF \
|
||||
"7" "Enables extracting of metadata from cbr, cbz, cbt files" OFF \
|
||||
"8" "Enables syncing with your kobo reader" OFF)
|
||||
if [ -f "/opt/calibre-web/options.txt" ]; then
|
||||
cps_options="$(cat /opt/calibre-web/options.txt)"
|
||||
@ -140,4 +140,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}:8083${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8083${CL}"
|
||||
|
@ -47,4 +47,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}:8086${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8096${CL}"
|
||||
|
@ -7,7 +7,7 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
|
||||
|
||||
# App Default Values
|
||||
APP="Keycloak"
|
||||
var_tags="access management"
|
||||
var_tags="access-management"
|
||||
var_cpu="2"
|
||||
var_ram="2048"
|
||||
var_disk="4"
|
||||
@ -25,38 +25,38 @@ color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -f /etc/systemd/system/keycloak.service ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Updating ${APP} LXC"
|
||||
|
||||
msg_info "Updating packages"
|
||||
apt-get update &>/dev/null
|
||||
apt-get -y upgrade &>/dev/null
|
||||
|
||||
RELEASE=$(curl -s https://api.github.com/repos/keycloak/keycloak/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
msg_info "Updating Keycloak to v$RELEASE"
|
||||
cd /opt
|
||||
wget -q https://github.com/keycloak/keycloak/releases/download/$RELEASE/keycloak-$RELEASE.tar.gz
|
||||
mv keycloak keycloak.old
|
||||
tar -xzf keycloak-$RELEASE.tar.gz
|
||||
cp -r keycloak.old/conf keycloak-$RELEASE
|
||||
cp -r keycloak.old/providers keycloak-$RELEASE
|
||||
cp -r keycloak.old/themes keycloak-$RELEASE
|
||||
mv keycloak-$RELEASE keycloak
|
||||
|
||||
msg_info "Delete temporary installation files"
|
||||
rm keycloak-$RELEASE.tar.gz
|
||||
rm -rf keycloak.old
|
||||
|
||||
msg_info "Restating Keycloak"
|
||||
systemctl restart keycloak
|
||||
msg_ok "Updated Successfully"
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -f /etc/systemd/system/keycloak.service ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Updating ${APP} LXC"
|
||||
|
||||
msg_info "Updating packages"
|
||||
apt-get update &>/dev/null
|
||||
apt-get -y upgrade &>/dev/null
|
||||
|
||||
RELEASE=$(curl -s https://api.github.com/repos/keycloak/keycloak/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
msg_info "Updating Keycloak to v$RELEASE"
|
||||
cd /opt
|
||||
wget -q https://github.com/keycloak/keycloak/releases/download/$RELEASE/keycloak-$RELEASE.tar.gz
|
||||
mv keycloak keycloak.old
|
||||
tar -xzf keycloak-$RELEASE.tar.gz
|
||||
cp -r keycloak.old/conf keycloak-$RELEASE
|
||||
cp -r keycloak.old/providers keycloak-$RELEASE
|
||||
cp -r keycloak.old/themes keycloak-$RELEASE
|
||||
mv keycloak-$RELEASE keycloak
|
||||
|
||||
msg_info "Delete temporary installation files"
|
||||
rm keycloak-$RELEASE.tar.gz
|
||||
rm -rf keycloak.old
|
||||
|
||||
msg_info "Restating Keycloak"
|
||||
systemctl restart keycloak
|
||||
msg_ok "Updated Successfully"
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
|
@ -7,7 +7,7 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
|
||||
|
||||
# App Default Values
|
||||
APP="Kimai"
|
||||
var_tags="time tracking"
|
||||
var_tags="time-tracking"
|
||||
var_cpu="2"
|
||||
var_ram="2048"
|
||||
var_disk="7"
|
||||
|
@ -7,7 +7,7 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
|
||||
|
||||
# App Default Values
|
||||
APP="MeshCentral"
|
||||
var_tags="remote management"
|
||||
var_tags="remote-management"
|
||||
var_cpu="1"
|
||||
var_ram="512"
|
||||
var_disk="2"
|
||||
|
85
ct/part-db.sh
Normal file
85
ct/part-db.sh
Normal file
@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2024 community-scripts ORG
|
||||
# Author: bvdberg01
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://docs.part-db.de/
|
||||
|
||||
# App Default Values
|
||||
APP="Part-DB"
|
||||
var_tags="inventory;parts"
|
||||
var_cpu="2"
|
||||
var_ram="1024"
|
||||
var_disk="8"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_unprivileged="1"
|
||||
|
||||
# App Output & Base Settings
|
||||
header_info "$APP"
|
||||
base_settings
|
||||
|
||||
# Core
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/partdb ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -s https://api.github.com/repos/Part-DB/Part-DB-server/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop apache2
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Updating $APP to v${RELEASE}"
|
||||
cd /opt
|
||||
mv /opt/partdb/ /opt/partdb-backup
|
||||
wget -q "https://github.com/Part-DB/Part-DB-server/archive/refs/tags/v${RELEASE}.zip"
|
||||
unzip -q "v${RELEASE}.zip"
|
||||
mv /opt/Part-DB-server-${RELEASE}/ /opt/partdb
|
||||
|
||||
cd /opt/partdb/
|
||||
cp -r "/opt/partdb-backup/.env.local" /opt/partdb/
|
||||
cp -r "/opt/partdb-backup/public/media" /opt/partdb/public/
|
||||
cp -r "/opt/partdb-backup/config/banner.md" /opt/partdb/config/
|
||||
|
||||
export COMPOSER_ALLOW_SUPERUSER=1
|
||||
composer install --no-dev -o --no-interaction &>/dev/null
|
||||
yarn install &>/dev/null
|
||||
yarn build &>/dev/null
|
||||
php bin/console cache:clear &>/dev/null
|
||||
php bin/console doctrine:migrations:migrate -n &>/dev/null
|
||||
chown -R www-data:www-data /opt/partdb
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated $APP to v${RELEASE}"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start apache2
|
||||
msg_ok "Started Service"
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -r "/opt/v${RELEASE}.zip"
|
||||
rm -r /opt/partdb-backup
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
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}${CL}"
|
@ -57,4 +57,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}:23400/web${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:32400/web${CL}"
|
||||
|
@ -24,18 +24,18 @@ $STD apk add nginx
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing PHP/Redis"
|
||||
$STD apk add php82-opcache
|
||||
$STD apk add php82-redis
|
||||
$STD apk add php82-apcu
|
||||
$STD apk add php82-fpm
|
||||
$STD apk add php82-sysvsem
|
||||
$STD apk add php82-ftp
|
||||
$STD apk add php82-pecl-smbclient
|
||||
$STD apk add php82-pecl-imagick
|
||||
$STD apk add php82-pecl-vips
|
||||
$STD apk add php82-exif
|
||||
$STD apk add php82-sodium
|
||||
$STD apk add php82-bz2
|
||||
$STD apk add php83-opcache
|
||||
$STD apk add php83-redis
|
||||
$STD apk add php83-apcu
|
||||
$STD apk add php83-fpm
|
||||
$STD apk add php83-sysvsem
|
||||
$STD apk add php83-ftp
|
||||
$STD apk add php83-pecl-smbclient
|
||||
$STD apk add php83-pecl-imagick
|
||||
$STD apk add php83-pecl-vips
|
||||
$STD apk add php83-exif
|
||||
$STD apk add php83-sodium
|
||||
$STD apk add php83-bz2
|
||||
$STD apk add redis
|
||||
msg_ok "Installed PHP/Redis"
|
||||
|
||||
@ -50,7 +50,7 @@ echo -e "Nextcloud Database Username: \e[32m$DB_USER\e[0m" >>~/nextcloud.creds
|
||||
echo -e "Nextcloud Database Password: \e[32m$DB_PASS\e[0m" >>~/nextcloud.creds
|
||||
echo -e "Nextcloud Database Name: \e[32m$DB_NAME\e[0m" >>~/nextcloud.creds
|
||||
$STD apk add nextcloud-mysql mariadb mariadb-client
|
||||
$STD mysql_install_db --user=mysql --datadir=/var/lib/mysql
|
||||
$STD mariadb-install-db --user=mysql --datadir=/var/lib/mysql
|
||||
$STD service mariadb start
|
||||
$STD rc-update add mariadb
|
||||
mysql -uroot -p"$ADMIN_PASS" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '$ADMIN_PASS' WITH GRANT OPTION; DELETE FROM mysql.user WHERE User=''; DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1'); DROP DATABASE test; DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'; CREATE DATABASE $DB_NAME; GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS'; GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost.localdomain' IDENTIFIED BY '$DB_PASS'; FLUSH PRIVILEGES;"
|
||||
@ -134,11 +134,12 @@ server {
|
||||
location ^~ /.well-known/nodeinfo { return 301 /index.php/.well-known/nodeinfo; }
|
||||
}
|
||||
EOF
|
||||
sed -i -e 's|memory_limit = 128M|memory_limit = 512M|; $aapc.enable_cli=1' /etc/php82/php.ini
|
||||
sed -i -E '/^php_admin_(flag|value)\[opcache/s/^/;/' /etc/php82/php-fpm.d/nextcloud.conf
|
||||
sed -i -e 's|memory_limit = 128M|memory_limit = 512M|; $aapc.enable_cli=1' /etc/php83/php.ini
|
||||
sed -i -E '/^php_admin_(flag|value)\[opcache/s/^/;/' /etc/php83/php-fpm.d/nextcloud.conf
|
||||
msg_ok "Installed Nextcloud"
|
||||
|
||||
msg_info "Adding Additional Nextcloud Packages"
|
||||
$STD apk add nextcloud-occ
|
||||
$STD apk add nextcloud-default-apps
|
||||
$STD apk add nextcloud-activity
|
||||
$STD apk add nextcloud-admin_audit
|
||||
@ -163,9 +164,10 @@ msg_ok "Added Additional Nextcloud Packages"
|
||||
msg_info "Starting Services"
|
||||
$STD rc-service redis start
|
||||
$STD rc-update add redis default
|
||||
$STD rc-service php-fpm82 start
|
||||
$STD rc-service php-fpm83 start
|
||||
chown -R nextcloud:www-data /var/log/nextcloud/
|
||||
$STD rc-service php-fpm82 restart
|
||||
chown -R nextcloud:www-data /usr/share/webapps/nextcloud/
|
||||
$STD rc-service php-fpm83 restart
|
||||
$STD rc-service nginx start
|
||||
$STD rc-service nextcloud start
|
||||
$STD rc-update add nginx default
|
||||
@ -175,16 +177,16 @@ msg_ok "Started Services"
|
||||
msg_info "Start Nextcloud Setup-Wizard"
|
||||
echo -e "export VISUAL=nano\nexport EDITOR=nano" >>/etc/profile
|
||||
cd /usr/share/webapps/nextcloud
|
||||
$STD su nextcloud -s /bin/sh -c "php82 occ maintenance:install \
|
||||
$STD su nextcloud -s /bin/sh -c "php83 occ maintenance:install \
|
||||
--database='mysql' --database-name $DB_NAME \
|
||||
--database-user '$DB_USER' --database-pass '$DB_PASS' \
|
||||
--admin-user '$ADMIN_USER' --admin-pass '$ADMIN_PASS' \
|
||||
--data-dir '/var/lib/nextcloud/data'"
|
||||
$STD su nextcloud -s /bin/sh -c 'php82 occ background:cron'
|
||||
$STD su nextcloud -s /bin/sh -c 'php83 occ background:cron'
|
||||
rm -rf /usr/share/webapps/nextcloud/apps/serverinfo
|
||||
IP4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
|
||||
sed -i "/0 => \'localhost\',/a \ \1 => '$IP4'," /usr/share/webapps/nextcloud/config/config.php
|
||||
su nextcloud -s /bin/sh -c 'php82 -f /usr/share/webapps/nextcloud/cron.php'
|
||||
su nextcloud -s /bin/sh -c 'php83 -f /usr/share/webapps/nextcloud/cron.php'
|
||||
msg_ok "Finished Nextcloud Setup-Wizard"
|
||||
|
||||
motd_ssh
|
||||
|
@ -104,8 +104,8 @@ fi
|
||||
echo "tmpfs /tmp/cache tmpfs defaults 0 0" >> /etc/fstab
|
||||
msg_ok "Installed Frigate $RELEASE"
|
||||
|
||||
if grep -q -o -m1 -E 'avx[^ ]* | sse4_2' /proc/cpuinfo; then
|
||||
msg_ok "AVX or SSE 4.2 Support Detected"
|
||||
if grep -q -o -m1 -E 'avx[^ ]*' /proc/cpuinfo; then
|
||||
msg_ok "AVX Support Detected"
|
||||
msg_info "Installing Openvino Object Detection Model (Resilience)"
|
||||
$STD pip install -r /opt/frigate/docker/main/requirements-ov.txt
|
||||
cd /opt/frigate/models
|
||||
|
112
install/part-db-install.sh
Normal file
112
install/part-db-install.sh
Normal file
@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 community-scripts ORG
|
||||
# Author: bvdberg01
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
curl \
|
||||
sudo \
|
||||
mc \
|
||||
zip \
|
||||
ca-certificates \
|
||||
software-properties-common \
|
||||
apt-transport-https \
|
||||
lsb-release \
|
||||
php-{opcache,curl,gd,mbstring,xml,bcmath,intl,zip,xsl,pgsql} \
|
||||
libapache2-mod-php \
|
||||
composer \
|
||||
postgresql
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up PostgreSQL"
|
||||
DB_NAME=partdb
|
||||
DB_USER=partdb
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
|
||||
{
|
||||
echo "Part-DB Credentials"
|
||||
echo "Part-DB Database User: $DB_USER"
|
||||
echo "Part-DB Database Password: $DB_PASS"
|
||||
echo "Part-DB Database Name: $DB_NAME"
|
||||
} >> ~/partdb.creds
|
||||
msg_ok "Set up PostgreSQL"
|
||||
|
||||
msg_info "Setting up Node.js/Yarn"
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y nodejs
|
||||
$STD npm install -g npm@latest
|
||||
$STD npm install -g yarn
|
||||
msg_ok "Installed Node.js/Yarn"
|
||||
|
||||
msg_info "Installing Part-DB (Patience)"
|
||||
cd /opt
|
||||
RELEASE=$(curl -s https://api.github.com/repos/Part-DB/Part-DB-server/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
wget -q "https://github.com/Part-DB/Part-DB-server/archive/refs/tags/v${RELEASE}.zip"
|
||||
unzip -q "v${RELEASE}.zip"
|
||||
mv /opt/Part-DB-server-${RELEASE}/ /opt/partdb
|
||||
|
||||
cd /opt/partdb/
|
||||
cp .env .env.local
|
||||
sed -i "s|DATABASE_URL=\"sqlite:///%kernel.project_dir%/var/app.db\"|DATABASE_URL=\"postgresql://${DB_USER}:${DB_PASS}@127.0.0.1:5432/${DB_NAME}?serverVersion=12.19&charset=utf8\"|" .env.local
|
||||
|
||||
export COMPOSER_ALLOW_SUPERUSER=1
|
||||
$STD composer install --no-dev -o --no-interaction
|
||||
$STD yarn install
|
||||
$STD yarn build
|
||||
$STD php bin/console cache:clear
|
||||
php bin/console doctrine:migrations:migrate -n > ~/database-migration-output
|
||||
chown -R www-data:www-data /opt/partdb
|
||||
ADMIN_PASS=$(grep -oP 'The initial password for the "admin" user is: \K\w+' ~/database-migration-output)
|
||||
{
|
||||
echo ""
|
||||
echo "Part-DB Admin User: admin"
|
||||
echo "Part-DB Admin Password: $ADMIN_PASS"
|
||||
} >> ~/partdb.creds
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed Part-DB"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/apache2/sites-available/partdb.conf
|
||||
<VirtualHost *:80>
|
||||
ServerName partdb
|
||||
DocumentRoot /opt/partdb/public
|
||||
<Directory /opt/partdb/public>
|
||||
Options FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog /var/log/apache2/partdb_error.log
|
||||
CustomLog /var/log/apache2/partdb_access.log combined
|
||||
</VirtualHost>
|
||||
EOF
|
||||
$STD a2ensite partdb
|
||||
$STD a2enmod rewrite
|
||||
$STD a2dissite 000-default.conf
|
||||
$STD systemctl reload apache2
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf ~/database-migration-output
|
||||
rm -rf "/opt/v${RELEASE}.zip"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
@ -2,7 +2,7 @@
|
||||
"name": "VS Code Server",
|
||||
"slug": "code-server",
|
||||
"categories": [
|
||||
16
|
||||
19
|
||||
],
|
||||
"date_created": "2024-05-02",
|
||||
"type": "misc",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "FlowiseAI",
|
||||
"slug": "flowiseai",
|
||||
"categories": [
|
||||
0
|
||||
19
|
||||
],
|
||||
"date_created": "2024-05-02",
|
||||
"type": "ct",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "Forgejo",
|
||||
"slug": "forgejo",
|
||||
"categories": [
|
||||
16
|
||||
19
|
||||
],
|
||||
"date_created": "2024-06-12",
|
||||
"type": "ct",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "Gitea",
|
||||
"slug": "gitea",
|
||||
"categories": [
|
||||
16
|
||||
19
|
||||
],
|
||||
"date_created": "2024-07-26",
|
||||
"type": "ct",
|
||||
|
@ -5,11 +5,12 @@
|
||||
{"name": "AdBlocker & DNS", "id": 13, "sort_order": 2.0},
|
||||
{"name": "*Arr Suite", "id": 18, "sort_order": 3.0},
|
||||
{"name": "Automation", "id": 3, "sort_order": 4.0},
|
||||
{"name": "Coding & AI", "id": 19, "sort_order": 5.0},
|
||||
{"name": "Dashboards", "id": 15, "sort_order": 5.0},
|
||||
{"name": "Database", "id": 5, "sort_order": 6.0},
|
||||
{"name": "Docker & Kubernetes", "id": 8, "sort_order": 7.0},
|
||||
{"name": "Document & Notes", "id": 14, "sort_order": 8.0},
|
||||
{"name": "File & Code", "id": 16, "sort_order": 9.0},
|
||||
{"name": "File & Downloads", "id": 16, "sort_order": 9.0},
|
||||
{"name": "Home Assistant", "id": 2, "sort_order": 10.0},
|
||||
{"name": "Media & Photo", "id": 12, "sort_order": 11.0},
|
||||
{"name": "Monitoring & Analytics", "id": 7, "sort_order": 12.0},
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "Open WebUI",
|
||||
"slug": "openwebui",
|
||||
"categories": [
|
||||
0
|
||||
19
|
||||
],
|
||||
"date_created": "2024-10-24",
|
||||
"type": "ct",
|
||||
|
39
json/part-db.json
Normal file
39
json/part-db.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "Part-DB",
|
||||
"slug": "part-db",
|
||||
"categories": [
|
||||
0
|
||||
],
|
||||
"date_created": "2024-12-18",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 80,
|
||||
"documentation": "https://docs.part-db.de/",
|
||||
"website": "https://github.com/Part-DB/Part-DB-server",
|
||||
"logo": "https://avatars.githubusercontent.com/u/36010898?s=48&v=4",
|
||||
"description": "Part-DB is an Open source inventory management system for your electronic components",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/part-db.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 1024,
|
||||
"hdd": 8,
|
||||
"os": "debian",
|
||||
"version": "12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "Show login and database credentials: `cat part-db.creds`",
|
||||
"type": "info"
|
||||
}
|
||||
]
|
||||
}
|
@ -19,7 +19,7 @@
|
||||
"script": "ct/photoprism.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 2048,
|
||||
"ram": 3072,
|
||||
"hdd": 8,
|
||||
"os": "debian",
|
||||
"version": "12"
|
||||
@ -36,4 +36,4 @@
|
||||
"type": "warning"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "Webmin System Administration",
|
||||
"slug": "webmin",
|
||||
"categories": [
|
||||
16
|
||||
11
|
||||
],
|
||||
"date_created": "2024-05-02",
|
||||
"type": "misc",
|
||||
|
@ -7,8 +7,8 @@
|
||||
# Source: https://github.com/gitsang/lxc-iptag
|
||||
|
||||
function header_info {
|
||||
clear
|
||||
cat <<"EOF"
|
||||
clear
|
||||
cat <<"EOF"
|
||||
__ _ ________ ________ ______
|
||||
/ / | |/ / ____/ / _/ __ \ /_ __/___ _____ _
|
||||
/ / | / / / // /_/ /_____/ / / __ `/ __ `/
|
||||
@ -41,7 +41,7 @@ catch_errors() {
|
||||
|
||||
# This function is called when an error occurs. It receives the exit code, line number, and command that caused the error, and displays an error message.
|
||||
error_handler() {
|
||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
|
||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi
|
||||
printf "\e[?25h"
|
||||
local exit_code="$?"
|
||||
local line_number="$1"
|
||||
@ -50,51 +50,56 @@ error_handler() {
|
||||
echo -e "\n$error_message\n"
|
||||
}
|
||||
|
||||
# This function displays a spinner.
|
||||
spinner() {
|
||||
local frames=('⠋' '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')
|
||||
local spin_i=0
|
||||
local interval=0.1
|
||||
printf "\e[?25l"
|
||||
local orange="\e[38;5;214m"
|
||||
local frames=('⠋' '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')
|
||||
local spin_i=0
|
||||
local interval=0.1
|
||||
printf "\e[?25l"
|
||||
|
||||
while true; do
|
||||
printf "\r ${orange}%s\e[0m " "${frames[spin_i]}"
|
||||
spin_i=$(( (spin_i + 1) % ${#frames[@]} ))
|
||||
sleep "$interval"
|
||||
done
|
||||
local color="${YWB}"
|
||||
|
||||
while true; do
|
||||
printf "\r ${color}%s${CL}" "${frames[spin_i]}"
|
||||
spin_i=$(((spin_i + 1) % ${#frames[@]}))
|
||||
sleep "$interval"
|
||||
done
|
||||
}
|
||||
|
||||
# This function displays an informational message with a yellow color.
|
||||
msg_info() {
|
||||
local msg="$1"
|
||||
echo -ne " ${HOLD} ${YW}${msg} "
|
||||
spinner &
|
||||
SPINNER_PID=$!
|
||||
local msg="$1"
|
||||
echo -ne "${TAB}${YW}${HOLD}${msg}${HOLD}"
|
||||
spinner &
|
||||
SPINNER_PID=$!
|
||||
}
|
||||
|
||||
# This function displays a success message with a green color.
|
||||
msg_ok() {
|
||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
|
||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi
|
||||
printf "\e[?25h"
|
||||
local msg="$1"
|
||||
echo -e "${BFR}${CM} ${GN}${msg}${CL}"
|
||||
echo -e "${BFR}${CM}${GN}${msg}${CL}"
|
||||
}
|
||||
|
||||
# This function displays a error message with a red color.
|
||||
msg_error() {
|
||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
|
||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi
|
||||
printf "\e[?25h"
|
||||
local msg="$1"
|
||||
echo -e "${BFR}${CROSS} ${RD}${msg}${CL}"
|
||||
echo -e "${BFR}${CROSS}${RD}${msg}${CL}"
|
||||
}
|
||||
|
||||
while true; do
|
||||
read -p "This will install ${APP} on ${hostname}. Proceed? (y/n): " yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) msg_info "Installation cancelled."; exit ;;
|
||||
*) msg_info "Please answer yes or no." ;;
|
||||
esac
|
||||
read -p "This will install ${APP} on ${hostname}. Proceed? (y/n): " yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*)
|
||||
msg_error "Installation cancelled."
|
||||
exit
|
||||
;;
|
||||
*) msg_error "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! pveversion | grep -Eq "pve-manager/8.[0-3]"; then
|
||||
@ -118,17 +123,18 @@ msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up IP-Tag Scripts"
|
||||
mkdir -p /opt/lxc-iptag
|
||||
msg_ok "Setup IP-Tag Scripts"
|
||||
|
||||
msg_info "Setup Default Config"
|
||||
if [[ ! -f /opt/lxc-iptag/iptag.conf ]]; then
|
||||
cat <<EOF > /opt/lxc-iptag/iptag.conf
|
||||
cat <<EOF >/opt/lxc-iptag/iptag.conf
|
||||
# Configuration file for LXC IP tagging
|
||||
|
||||
# List of allowed CIDRs
|
||||
CIDR_LIST=(
|
||||
192.168.0.0/16
|
||||
100.64.0.0/10
|
||||
10.0.0.0/8
|
||||
192.168.0.0/16
|
||||
100.64.0.0/10
|
||||
10.0.0.0/8
|
||||
)
|
||||
|
||||
# Interval settings (in seconds)
|
||||
@ -137,14 +143,14 @@ FW_NET_INTERFACE_CHECK_INTERVAL=60
|
||||
LXC_STATUS_CHECK_INTERVAL=-1
|
||||
FORCE_UPDATE_INTERVAL=1800
|
||||
EOF
|
||||
msg_ok "Setup default config"
|
||||
msg_ok "Setup default config"
|
||||
else
|
||||
msg_ok "Default config already exists"
|
||||
msg_ok "Default config already exists"
|
||||
fi
|
||||
|
||||
msg_info "Setup Main Function"
|
||||
if [[ ! -f /opt/lxc-iptag/iptag ]]; then
|
||||
cat <<'EOF' > /opt/lxc-iptag/iptag
|
||||
cat <<'EOF' >/opt/lxc-iptag/iptag
|
||||
#!/bin/bash
|
||||
|
||||
# =============== CONFIGURATION =============== #
|
||||
@ -153,177 +159,176 @@ CONFIG_FILE="/opt/lxc-iptag/iptag.conf"
|
||||
|
||||
# Load the configuration file if it exists
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
# shellcheck source=./lxc-iptag.conf
|
||||
source "$CONFIG_FILE"
|
||||
# shellcheck source=./lxc-iptag.conf
|
||||
source "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
# Convert IP to integer for comparison
|
||||
ip_to_int() {
|
||||
local ip="${1}"
|
||||
local a b c d
|
||||
local ip="${1}"
|
||||
local a b c d
|
||||
|
||||
IFS=. read -r a b c d <<< "${ip}"
|
||||
echo "$((a << 24 | b << 16 | c << 8 | d))"
|
||||
IFS=. read -r a b c d <<< "${ip}"
|
||||
echo "$((a << 24 | b << 16 | c << 8 | d))"
|
||||
}
|
||||
|
||||
# Check if IP is in CIDR
|
||||
ip_in_cidr() {
|
||||
local ip="${1}"
|
||||
local cidr="${2}"
|
||||
local ip="${1}"
|
||||
local cidr="${2}"
|
||||
|
||||
ip_int=$(ip_to_int "${ip}")
|
||||
netmask_int=$(ip_to_int "$(ipcalc -b "${cidr}" | grep Broadcast | awk '{print $2}')")
|
||||
masked_ip_int=$(( "${ip_int}" & "${netmask_int}" ))
|
||||
[[ ${ip_int} -eq ${masked_ip_int} ]] && return 0 || return 1
|
||||
ip_int=$(ip_to_int "${ip}")
|
||||
netmask_int=$(ip_to_int "$(ipcalc -b "${cidr}" | grep Broadcast | awk '{print $2}')")
|
||||
masked_ip_int=$(( "${ip_int}" & "${netmask_int}" ))
|
||||
[[ ${ip_int} -eq ${masked_ip_int} ]] && return 0 || return 1
|
||||
}
|
||||
|
||||
# Check if IP is in any CIDRs
|
||||
ip_in_cidrs() {
|
||||
local ip="${1}"
|
||||
local cidrs=()
|
||||
local ip="${1}"
|
||||
local cidrs=()
|
||||
|
||||
mapfile -t cidrs < <(echo "${2}" | tr ' ' '\n')
|
||||
for cidr in "${cidrs[@]}"; do
|
||||
ip_in_cidr "${ip}" "${cidr}" && return 0
|
||||
done
|
||||
mapfile -t cidrs < <(echo "${2}" | tr ' ' '\n')
|
||||
for cidr in "${cidrs[@]}"; do
|
||||
ip_in_cidr "${ip}" "${cidr}" && return 0
|
||||
done
|
||||
|
||||
return 1
|
||||
return 1
|
||||
}
|
||||
|
||||
# Check if IP is valid
|
||||
is_valid_ipv4() {
|
||||
local ip=$1
|
||||
local regex="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
|
||||
local ip=$1
|
||||
local regex="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
|
||||
|
||||
if [[ $ip =~ $regex ]]; then
|
||||
IFS='.' read -r -a parts <<< "$ip"
|
||||
for part in "${parts[@]}"; do
|
||||
if ! [[ $part =~ ^[0-9]+$ ]] || ((part < 0 || part > 255)); then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
else
|
||||
if [[ $ip =~ $regex ]]; then
|
||||
IFS='.' read -r -a parts <<< "$ip"
|
||||
for part in "${parts[@]}"; do
|
||||
if ! [[ $part =~ ^[0-9]+$ ]] || ((part < 0 || part > 255)); then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
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
|
||||
fi
|
||||
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
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
# =============== MAIN =============== #
|
||||
|
||||
update_lxc_iptags() {
|
||||
vmid_list=$(pct list 2>/dev/null | grep -v VMID | awk '{print $1}')
|
||||
for vmid in ${vmid_list}; do
|
||||
last_tagged_ips=()
|
||||
current_valid_ips=()
|
||||
next_tags=()
|
||||
vmid_list=$(pct list 2>/dev/null | grep -v VMID | awk '{print $1}')
|
||||
for vmid in ${vmid_list}; do
|
||||
last_tagged_ips=()
|
||||
current_valid_ips=()
|
||||
next_tags=()
|
||||
|
||||
# Parse current tags
|
||||
mapfile -t current_tags < <(pct config "${vmid}" | grep tags | awk '{print $2}' | sed 's/;/\n/g')
|
||||
for current_tag in "${current_tags[@]}"; do
|
||||
if is_valid_ipv4 "${current_tag}"; then
|
||||
last_tagged_ips+=("${current_tag}")
|
||||
continue
|
||||
fi
|
||||
next_tags+=("${current_tag}")
|
||||
done
|
||||
|
||||
# Get current IPs
|
||||
current_ips_full=$(lxc-info -n "${vmid}" -i | awk '{print $2}')
|
||||
for ip in ${current_ips_full}; do
|
||||
if is_valid_ipv4 "${ip}" && ip_in_cidrs "${ip}" "${CIDR_LIST[*]}"; then
|
||||
current_valid_ips+=("${ip}")
|
||||
next_tags+=("${ip}")
|
||||
fi
|
||||
done
|
||||
|
||||
# Skip if no ip change
|
||||
if [[ "$(echo "${last_tagged_ips[@]}" | tr ' ' '\n' | sort -u)" == "$(echo "${current_valid_ips[@]}" | tr ' ' '\n' | sort -u)" ]]; then
|
||||
echo "Skipping ${vmid} cause ip no changes"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Set tags
|
||||
echo "Setting ${vmid} tags from ${current_tags[*]} to ${next_tags[*]}"
|
||||
pct set "${vmid}" -tags "$(IFS=';'; echo "${next_tags[*]}")"
|
||||
# Parse current tags
|
||||
mapfile -t current_tags < <(pct config "${vmid}" | grep tags | awk '{print $2}' | sed 's/;/\n/g')
|
||||
for current_tag in "${current_tags[@]}"; do
|
||||
if is_valid_ipv4 "${current_tag}"; then
|
||||
last_tagged_ips+=("${current_tag}")
|
||||
continue
|
||||
fi
|
||||
next_tags+=("${current_tag}")
|
||||
done
|
||||
|
||||
# Get current IPs
|
||||
current_ips_full=$(lxc-info -n "${vmid}" -i | awk '{print $2}')
|
||||
for ip in ${current_ips_full}; do
|
||||
if is_valid_ipv4 "${ip}" && ip_in_cidrs "${ip}" "${CIDR_LIST[*]}"; then
|
||||
current_valid_ips+=("${ip}")
|
||||
next_tags+=("${ip}")
|
||||
fi
|
||||
done
|
||||
|
||||
# Skip if no ip change
|
||||
if [[ "$(echo "${last_tagged_ips[@]}" | tr ' ' '\n' | sort -u)" == "$(echo "${current_valid_ips[@]}" | tr ' ' '\n' | sort -u)" ]]; then
|
||||
echo "Skipping ${vmid} cause ip no changes"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Set tags
|
||||
echo "Setting ${vmid} tags from ${current_tags[*]} to ${next_tags[*]}"
|
||||
pct set "${vmid}" -tags "$(IFS=';'; echo "${next_tags[*]}")"
|
||||
done
|
||||
}
|
||||
|
||||
check() {
|
||||
current_time=$(date +%s)
|
||||
current_time=$(date +%s)
|
||||
|
||||
time_since_last_lxc_status_check=$((current_time - last_lxc_status_check_time))
|
||||
if [[ "${LXC_STATUS_CHECK_INTERVAL}" -gt 0 ]] \
|
||||
&& [[ "${time_since_last_lxc_status_check}" -ge "${STATUS_CHECK_INTERVAL}" ]]; then
|
||||
echo "Checking lxc status..."
|
||||
last_lxc_status_check_time=${current_time}
|
||||
if lxc_status_changed; then
|
||||
update_lxc_iptags
|
||||
last_update_time=${current_time}
|
||||
return
|
||||
fi
|
||||
time_since_last_lxc_status_check=$((current_time - last_lxc_status_check_time))
|
||||
if [[ "${LXC_STATUS_CHECK_INTERVAL}" -gt 0 ]] \
|
||||
&& [[ "${time_since_last_lxc_status_check}" -ge "${STATUS_CHECK_INTERVAL}" ]]; then
|
||||
echo "Checking lxc status..."
|
||||
last_lxc_status_check_time=${current_time}
|
||||
if lxc_status_changed; then
|
||||
update_lxc_iptags
|
||||
last_update_time=${current_time}
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
time_since_last_fw_net_interface_check=$((current_time - last_fw_net_interface_check_time))
|
||||
if [[ "${FW_NET_INTERFACE_CHECK_INTERVAL}" -gt 0 ]] \
|
||||
&& [[ "${time_since_last_fw_net_interface_check}" -ge "${FW_NET_INTERFACE_CHECK_INTERVAL}" ]]; then
|
||||
echo "Checking fw net interface..."
|
||||
last_fw_net_interface_check_time=${current_time}
|
||||
if fw_net_interface_changed; then
|
||||
update_lxc_iptags
|
||||
last_update_time=${current_time}
|
||||
return
|
||||
fi
|
||||
time_since_last_fw_net_interface_check=$((current_time - last_fw_net_interface_check_time))
|
||||
if [[ "${FW_NET_INTERFACE_CHECK_INTERVAL}" -gt 0 ]] \
|
||||
&& [[ "${time_since_last_fw_net_interface_check}" -ge "${FW_NET_INTERFACE_CHECK_INTERVAL}" ]]; then
|
||||
echo "Checking fw net interface..."
|
||||
last_fw_net_interface_check_time=${current_time}
|
||||
if fw_net_interface_changed; then
|
||||
update_lxc_iptags
|
||||
last_update_time=${current_time}
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
time_since_last_update=$((current_time - last_update_time))
|
||||
if [ ${time_since_last_update} -ge ${FORCE_UPDATE_INTERVAL} ]; then
|
||||
echo "Force updating lxc iptags..."
|
||||
update_lxc_iptags
|
||||
last_update_time=${current_time}
|
||||
return
|
||||
fi
|
||||
time_since_last_update=$((current_time - last_update_time))
|
||||
if [ ${time_since_last_update} -ge ${FORCE_UPDATE_INTERVAL} ]; then
|
||||
echo "Force updating lxc iptags..."
|
||||
update_lxc_iptags
|
||||
last_update_time=${current_time}
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
# main: Set the IP tags for all LXC containers
|
||||
main() {
|
||||
while true; do
|
||||
check
|
||||
sleep "${LOOP_INTERVAL}"
|
||||
done
|
||||
while true; do
|
||||
check
|
||||
sleep "${LOOP_INTERVAL}"
|
||||
done
|
||||
}
|
||||
|
||||
main
|
||||
EOF
|
||||
msg_ok "Setup Main Function"
|
||||
msg_ok "Setup Main Function"
|
||||
else
|
||||
msg_ok "Main Function already exists"
|
||||
msg_ok "Main Function already exists"
|
||||
fi
|
||||
chmod +x /opt/lxc-iptag/iptag
|
||||
chmod +x /opt/lxc-iptag/iptag
|
||||
|
||||
msg_info "Creating Service"
|
||||
if [[ ! -f /lib/systemd/system/iptag.service ]]; then
|
||||
echo "Systemd service file not found. Creating it now..."
|
||||
cat <<EOF > /lib/systemd/system/iptag.service
|
||||
cat <<EOF >/lib/systemd/system/iptag.service
|
||||
[Unit]
|
||||
Description=LXC IP-Tag service
|
||||
After=network.target
|
||||
@ -336,9 +341,9 @@ Restart=always
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
msg_ok "Created Service"
|
||||
msg_ok "Created Service"
|
||||
else
|
||||
msg_ok "Service already exists."
|
||||
msg_ok "Service already exists."
|
||||
fi
|
||||
|
||||
msg_ok "Setup IP-Tag Scripts"
|
||||
@ -347,5 +352,5 @@ msg_info "Starting Service"
|
||||
systemctl daemon-reload &>/dev/null
|
||||
systemctl enable -q --now iptag.service &>/dev/null
|
||||
msg_ok "Started Service"
|
||||
|
||||
SPINNER_PID=""
|
||||
echo -e "\n${APP} installation completed successfully! ${CL}\n"
|
||||
|
@ -158,8 +158,19 @@ arch_check() {
|
||||
|
||||
# This function sets the APP-Name into an ASCII Header in Slant, figlet needed on proxmox main node.
|
||||
header_info() {
|
||||
apt-get install -y figlet &> /dev/null
|
||||
ascii_art=$(figlet -f slant "$APP")
|
||||
if [ -f /etc/debian_version ]; then
|
||||
# Debian/Ubuntu
|
||||
apt-get install -y figlet &> /dev/null
|
||||
elif [ -f /etc/alpine-release ]; then
|
||||
# Alpine Linux
|
||||
apk add --no-cache figlet &> /dev/null
|
||||
else
|
||||
echo "Unsupported OS"
|
||||
return 1
|
||||
fi
|
||||
|
||||
term_width=$(tput cols)
|
||||
ascii_art=$(figlet -f slant -w "$term_width" "$APP")
|
||||
clear
|
||||
cat <<EOF
|
||||
$ascii_art
|
||||
|
@ -16,6 +16,8 @@ function header_info {
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Color variables for output
|
||||
YW=$(echo "\033[33m")
|
||||
RD=$(echo "\033[01;31m")
|
||||
GN=$(echo "\033[1;92m")
|
||||
@ -23,10 +25,8 @@ CL=$(echo "\033[m")
|
||||
BFR="\\r\\033[K"
|
||||
HOLD="-"
|
||||
CM="${GN}✓${CL}"
|
||||
current_kernel=$(uname -r)
|
||||
available_kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | grep -v "$current_kernel" | sort -V)
|
||||
header_info
|
||||
|
||||
# Functions for logging messages
|
||||
function msg_info() {
|
||||
local msg="$1"
|
||||
echo -ne " ${HOLD} ${YW}${msg}..."
|
||||
@ -37,39 +37,84 @@ function msg_ok() {
|
||||
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
|
||||
}
|
||||
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Kernel Clean" --yesno "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed?" 10 68 || exit
|
||||
# Detect current kernel
|
||||
current_kernel=$(uname -r)
|
||||
|
||||
# Detect all installed kernels except the current one
|
||||
available_kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | grep -v "$current_kernel" | sort -V)
|
||||
|
||||
header_info
|
||||
|
||||
# If no old kernels are available, exit with a message
|
||||
if [ -z "$available_kernels" ]; then
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Old Kernels" --msgbox "It appears there are no old Kernels on your system. \nCurrent kernel ($current_kernel)." 10 68
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Old Kernels" \
|
||||
--msgbox "It appears there are no old kernels on your system.\nCurrent kernel: $current_kernel" 10 68
|
||||
echo "Exiting..."
|
||||
sleep 2
|
||||
clear
|
||||
exit
|
||||
fi
|
||||
KERNEL_MENU=()
|
||||
MSG_MAX_LENGTH=0
|
||||
|
||||
# Prepare kernel options for selection
|
||||
KERNEL_MENU=()
|
||||
while read -r TAG ITEM; do
|
||||
OFFSET=2
|
||||
((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET
|
||||
MSG_MAX_LENGTH=$((MSG_MAX_LENGTH < ${#ITEM} + OFFSET ? ${#ITEM} + OFFSET : MSG_MAX_LENGTH))
|
||||
KERNEL_MENU+=("$TAG" "$ITEM " "OFF")
|
||||
done < <(echo "$available_kernels")
|
||||
|
||||
remove_kernels=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current Kernel $current_kernel" --checklist "\nSelect Kernels to remove:\n" 16 $((MSG_MAX_LENGTH + 58)) 6 "${KERNEL_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit
|
||||
# Display checklist to select kernels for removal
|
||||
remove_kernels=$(whiptail --backtitle "Proxmox VE Helper Scripts" \
|
||||
--title "Current Kernel: $current_kernel" \
|
||||
--checklist "\nSelect kernels to remove:\n" \
|
||||
16 $((MSG_MAX_LENGTH + 58)) 6 "${KERNEL_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit
|
||||
|
||||
# Exit if no kernel was selected
|
||||
[ -z "$remove_kernels" ] && {
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Kernel Selected" --msgbox "It appears that no Kernel was selected" 10 68
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Kernel Selected" \
|
||||
--msgbox "It appears no kernel was selected." 10 68
|
||||
echo "Exiting..."
|
||||
sleep 2
|
||||
clear
|
||||
exit
|
||||
}
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Remove Kernels" --yesno "Would you like to remove the $(echo $remove_kernels | awk '{print NF}') previously selected Kernels?" 10 68 || exit
|
||||
|
||||
msg_info "Removing ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${YW}old Kernels${CL}"
|
||||
/usr/bin/apt purge -y $remove_kernels >/dev/null 2>&1
|
||||
msg_ok "Successfully Removed Kernels"
|
||||
# Confirm removal
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Remove Kernels" \
|
||||
--yesno "Would you like to remove the $(echo $remove_kernels | awk '{print NF}') selected kernels?" 10 68 || exit
|
||||
|
||||
# Process kernel removal
|
||||
msg_info "Removing ${RD}$(echo $remove_kernels | awk '{print NF}') ${YW}old kernels${CL}"
|
||||
for kernel in $remove_kernels; do
|
||||
if [[ $kernel == *"-signed" ]]; then
|
||||
# Handle signed kernels with dependencies
|
||||
touch /please-remove-proxmox-ve # Temporarily bypass Proxmox warnings
|
||||
if sudo apt-get purge -y "$kernel" >/dev/null 2>&1; then
|
||||
msg_ok "Removed kernel: $kernel"
|
||||
else
|
||||
msg_info "Failed to remove kernel: $kernel. Check dependencies or manual removal."
|
||||
fi
|
||||
rm -f /please-remove-proxmox-ve # Clean up bypass file
|
||||
else
|
||||
# Standard kernel removal
|
||||
if sudo apt-get purge -y "$kernel" >/dev/null 2>&1; then
|
||||
msg_ok "Removed kernel: $kernel"
|
||||
else
|
||||
msg_info "Failed to remove kernel: $kernel. Check dependencies or manual removal."
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Update GRUB configuration
|
||||
msg_info "Updating GRUB"
|
||||
/usr/sbin/update-grub >/dev/null 2>&1
|
||||
msg_ok "Successfully Updated GRUB"
|
||||
if /usr/sbin/update-grub >/dev/null 2>&1; then
|
||||
msg_ok "GRUB updated successfully"
|
||||
else
|
||||
msg_info "Failed to update GRUB"
|
||||
fi
|
||||
|
||||
# Completion message
|
||||
msg_info "Exiting"
|
||||
sleep 2
|
||||
msg_ok "Finished"
|
||||
|
Reference in New Issue
Block a user