diff --git a/CHANGELOG.md b/CHANGELOG.md index 0851bc68..aaba48e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,39 @@ All LXC instances created using this repository come pre-installed with Midnight Do not break established syntax in this file, as it is automatically updated by a Github Workflow +## 2025-01-23 + +### Changed + +### 🚀 Updated Scripts + +- Feature: Add Debian Disk Size / Redesign / Increase Disk [@MickLesk](https://github.com/MickLesk) ([#1695](https://github.com/community-scripts/ProxmoxVE/pull/1695)) +- Fix: Paperless Service Timings & Optimization: Ghostscript Installation [@MickLesk](https://github.com/MickLesk) ([#1688](https://github.com/community-scripts/ProxmoxVE/pull/1688)) + +### 🌐 Website + +- Refactor ScriptInfoBlocks and siteConfig to properly show the most populair scripts [@BramSuurdje](https://github.com/BramSuurdje) ([#1697](https://github.com/community-scripts/ProxmoxVE/pull/1697)) + +### 🧰 Maintenance + +- Update build.func: Ubuntu advanced settings version [@michelroegl-brunner](https://github.com/michelroegl-brunner) ([#1701](https://github.com/community-scripts/ProxmoxVE/pull/1701)) + +## 2025-01-22 + +### Changed + +### 🚀 Updated Scripts + +- Tweak: LubeLogger Script Upcoming Changes 1.4.3 [@JcMinarro](https://github.com/JcMinarro) ([#1656](https://github.com/community-scripts/ProxmoxVE/pull/1656)) +- Fix: SQL Server 2022 Install [@MickLesk](https://github.com/MickLesk) ([#1669](https://github.com/community-scripts/ProxmoxVE/pull/1669)) + +### 🌐 Website + +- Refactor Sidebar component to display unique scripts count [@BramSuurdje](https://github.com/BramSuurdje) ([#1681](https://github.com/community-scripts/ProxmoxVE/pull/1681)) +- Refactor various components and configuration for mobile responsiveness. [@BramSuurdje](https://github.com/BramSuurdje) ([#1679](https://github.com/community-scripts/ProxmoxVE/pull/1679)) +- Add Docker-VM to Containers & Docker Category [@thost96](https://github.com/thost96) ([#1667](https://github.com/community-scripts/ProxmoxVE/pull/1667)) +- Moving SQL Server 2022 to database category [@CamronBorealis](https://github.com/CamronBorealis) ([#1659](https://github.com/community-scripts/ProxmoxVE/pull/1659)) + ## 2025-01-21 ### Changed diff --git a/ct/lubelogger.sh b/ct/lubelogger.sh index d6f5f29c..82bd7238 100644 --- a/ct/lubelogger.sh +++ b/ct/lubelogger.sh @@ -42,14 +42,17 @@ function update_script() { msg_info "Updating ${APP} to v${RELEASE}" cd /opt wget -q https://github.com/hargata/lubelog/releases/download/v${RELEASE}/LubeLogger_v${RELEASE_TRIMMED}_linux_x64.zip - mkdir -p /tmp/lubeloggerData/wwwroot + mkdir -p /tmp/lubeloggerData/data cp /opt/lubelogger/appsettings.json /tmp/lubeloggerData/appsettings.json - cp -r /opt/lubelogger/config /tmp/lubeloggerData/ - cp -r /opt/lubelogger/data /tmp/lubeloggerData/ - [[ -e /opt/lubelogger/wwwroot/translations ]] && cp -r /opt/lubelogger/wwwroot/translations /tmp/lubeloggerData/wwwroot/ - [[ -e /opt/lubelogger/wwwroot/documents ]] && cp -r /opt/lubelogger/wwwroot/documents /tmp/lubeloggerData/wwwroot/ - [[ -e /opt/lubelogger/wwwroot/images ]] && cp -r /opt/lubelogger/wwwroot/images /tmp/lubeloggerData/wwwroot/ - [[ -e /opt/lubelogger/wwwroot/temp ]] && cp -r /opt/lubelogger/wwwroot/temp /tmp/lubeloggerData/wwwroot/ + cp -r /opt/lubelogger/data/ /tmp/lubeloggerData/ + + # Lubelogger has moved multiples folders to the 'data' folder, and we need to move them before the update to keep the user data + # Github Discussion: https://github.com/hargata/lubelog/discussions/787 + [[ -e /opt/lubelogger/config ]] && cp -r /opt/lubelogger/config /tmp/lubeloggerData/data/ + [[ -e /opt/lubelogger/wwwroot/translations ]] && cp -r /opt/lubelogger/wwwroot/translations /tmp/lubeloggerData/data/ + [[ -e /opt/lubelogger/wwwroot/documents ]] && cp -r /opt/lubelogger/wwwroot/documents /tmp/lubeloggerData/data/ + [[ -e /opt/lubelogger/wwwroot/images ]] && cp -r /opt/lubelogger/wwwroot/images /tmp/lubeloggerData/data/ + [[ -e /opt/lubelogger/wwwroot/temp ]] && cp -r /opt/lubelogger/wwwroot/temp /tmp/lubeloggerData/data/ [[ -e /opt/lubelogger/log ]] && cp -r /opt/lubelogger/log /tmp/lubeloggerData/ rm -rf /opt/lubelogger unzip -qq LubeLogger_v${RELEASE_TRIMMED}_linux_x64.zip -d lubelogger diff --git a/frontend/src/app/category-view/page.tsx b/frontend/src/app/category-view/page.tsx new file mode 100644 index 00000000..6050f4ae --- /dev/null +++ b/frontend/src/app/category-view/page.tsx @@ -0,0 +1,134 @@ +"use client"; + +import React, { useEffect, useState } from "react"; +import { useRouter } from "next/navigation"; +import { Card, CardContent } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { Category } from "@/lib/types"; + +const defaultLogo = "/default-logo.png"; // Fallback logo path + +const MAX_DESCRIPTION_LENGTH = 100; // Set max length for description + +const CategoryView = () => { + const [categories, setCategories] = useState([]); + const [selectedCategory, setSelectedCategory] = useState(null); + const router = useRouter(); + + useEffect(() => { + const fetchCategories = async () => { + try { + const basePath = process.env.NODE_ENV === "production" ? "/ProxmoxVE" : ""; + const response = await fetch(`${basePath}/api/categories`); + if (!response.ok) { + throw new Error("Failed to fetch categories"); + } + const data = await response.json(); + console.log("Fetched categories:", data); // Debugging + setCategories(data); + } catch (error) { + console.error("Error fetching categories:", error); + } + }; + + fetchCategories(); + }, []); + + const handleCategoryClick = (category: Category) => { + setSelectedCategory(category); + }; + + const handleBackClick = () => { + setSelectedCategory(null); + }; + + const handleScriptClick = (scriptSlug: string) => { + router.push(`/scripts?id=${scriptSlug}`); + }; + + const truncateDescription = (text: string) => { + return text.length > MAX_DESCRIPTION_LENGTH + ? `${text.slice(0, MAX_DESCRIPTION_LENGTH)}...` + : text; + }; + + return ( +
+ {categories.length === 0 && ( +

No categories available. Please check the API endpoint.

+ )} + {selectedCategory ? ( +
+ +

{selectedCategory.name}

+
+ {selectedCategory.scripts + .sort((a, b) => a.name.localeCompare(b.name)) + .map((script) => ( + handleScriptClick(script.slug)}> + +
+ {script.name} +
+

{script.name}

+

Created at: {script.date_created || "No date available"}

+

+ {truncateDescription(script.description || "No description available.")} +

+
+
+
+ CPU: {script.install_methods[0]?.resources.cpu || "N/A"}vCPU | RAM: {script.install_methods[0]?.resources.ram || "N/A"}MB | HDD: {script.install_methods[0]?.resources.hdd || "N/A"}GB +
+
+
+ ))} +
+
+ ) : ( +
+
+

Categories

+

+ {categories.reduce((acc, cat) => acc + (cat.scripts?.length || 0), 0)} Total scripts +

+
+
+ {categories.map((category) => ( + handleCategoryClick(category)} + className="cursor-pointer hover:shadow-lg flex flex-col items-center justify-center" + > + +
+ {category.scripts && category.scripts.slice(0, 4).map((script, index) => ( + {script.name + ))} +
+

{category.name}

+

+ {(category as any).description || "No description available."} +

+
+
+ ))} +
+
+ )} +
+ ); +}; + +export default CategoryView; \ No newline at end of file diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index c6fad745..69f8fb10 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -34,113 +34,104 @@ export default function Page() { }, [theme]); return ( -
- -
-
- - -
- -
- ❤️ - - Scripts by Tteck - - -
- - - - Thank You! - - A big thank you to Tteck and the many contributors who have - made this project possible. Your hard work is truly - appreciated by the entire Proxmox community! - - - - - - - -
+
+ +
+
+ + +
+ +
+ ❤️ + + Scripts by tteck + + +
+ + + + Thank You! + + A big thank you to tteck and the many contributors who have + made this project possible. Your hard work is truly + appreciated by the entire Proxmox community! + + + + + + + +
-
-

- Make managing your Homelab a breeze -

-

- We are a community-driven initiative that simplifies the setup of - Proxmox Virtual Environment (VE). -
-
- Originally created by{" "} - - tteck - - , these scripts automate and streamline -
- the process of creating and configuring Linux containers (LXC) and - virtual machines (VMs) on Proxmox VE. -
-
- With 200+ scripts to help you manage your{" "} - Proxmox VE environment.
- Whether you're a seasoned user or a newcomer, we've got - you covered. -

-
-
- - - -
-
-
-
- ); +
+

+ Make managing your Homelab a breeze +

+
+

+ We are a community-driven initiative that simplifies the setup + of Proxmox Virtual Environment (VE). +

+

+ With 200+ scripts to help you manage your{" "} + Proxmox VE environment. Whether you're a seasoned + user or a newcomer, we've got you covered. +

+
+
+
+ + + +
+
+
+
+ ); } diff --git a/frontend/src/app/scripts/_components/ScriptInfoBlocks.tsx b/frontend/src/app/scripts/_components/ScriptInfoBlocks.tsx index 1c418c94..cf5edfb2 100644 --- a/frontend/src/app/scripts/_components/ScriptInfoBlocks.tsx +++ b/frontend/src/app/scripts/_components/ScriptInfoBlocks.tsx @@ -90,7 +90,7 @@ export function LatestScripts({ items }: { items: Category[] }) { > -
+
{ const foundScripts = category.scripts.filter((script) => - mostPopularScripts.includes(script.name), + mostPopularScripts.includes(script.slug), ); return acc.concat(foundScripts); }, []); @@ -162,7 +162,7 @@ export function MostViewedScripts({ items }: { items: Category[] }) { > -
+
void; + items: Category[]; + selectedScript: string | null; + setSelectedScript: (script: string | null) => void; }) => { - return ( -
-
-

Categories

-

- {items.reduce((acc, category) => acc + category.scripts.length, 0)}{" "} - Total scripts -

-
-
- -
-
- ); + const uniqueScripts = items.reduce((acc, category) => { + for (const script of category.scripts) { + if (!acc.some((s) => s.name === script.name)) { + acc.push(script); + } + } + return acc; + }, [] as Script[]); + + return ( +
+
+

Categories

+

+ {uniqueScripts.length} Total scripts +

+
+
+ +
+
+ ); }; -export default Sidebar; +export default Sidebar; \ No newline at end of file diff --git a/frontend/src/components/Footer.tsx b/frontend/src/components/Footer.tsx index 38a93803..56062d6f 100644 --- a/frontend/src/components/Footer.tsx +++ b/frontend/src/components/Footer.tsx @@ -5,7 +5,7 @@ export default function Footer() { return (
-
+
Website built by the community. The source code is avaliable on{" "} -
-
- - logo - Proxmox VE Helper-Scripts - -
- - - {navbarLinks.map(({ href, event, icon, text }) => ( - - - - - - - {text} - - - - ))} - -
-
-
- - ); + <> +
+
+ + logo + Proxmox VE Helper-Scripts + +
+ + + {navbarLinks.map(({ href, event, icon, text, mobileHidden }) => ( + + + + + + + {text} + + + + ))} + +
+
+
+ + ); } export default Navbar; diff --git a/frontend/src/config/siteConfig.tsx b/frontend/src/config/siteConfig.tsx index 5a8e2fa7..8103e214 100644 --- a/frontend/src/config/siteConfig.tsx +++ b/frontend/src/config/siteConfig.tsx @@ -1,46 +1,48 @@ import { OperatingSystem } from "@/lib/types"; import { MessagesSquare, Scroll } from "lucide-react"; -import { FaDiscord, FaGithub } from "react-icons/fa"; import React from "react"; +import { FaDiscord, FaGithub } from "react-icons/fa"; export const basePath = process.env.BASE_PATH; const isMobile = typeof window !== "undefined" && window.innerWidth < 640; export const navbarLinks = [ - { - href: `https://github.com/community-scripts/${basePath}`, - event: "Github", - icon: , - text: "Github", - }, - { - href: `https://discord.gg/2wvnMDgdnU`, - event: "Discord", - icon: , - text: "Discord", - }, - { - href: `https://github.com/community-scripts/${basePath}/blob/main/CHANGELOG.md`, - event: "Change Log", - icon: , - text: "Change Log", - }, - !isMobile - ? { - href: `https://github.com/community-scripts/${basePath}/discussions`, - event: "Discussions", - icon: , - text: "Discussions", - } - : null, -].filter(Boolean) as { href: string; event: string; icon: React.ReactNode; text: string }[]; + { + href: `https://github.com/community-scripts/${basePath}`, + event: "Github", + icon: , + text: "Github", + }, + { + href: `https://discord.gg/2wvnMDgdnU`, + event: "Discord", + icon: , + text: "Discord", + }, + { + href: `https://github.com/community-scripts/${basePath}/blob/main/CHANGELOG.md`, + event: "Change Log", + icon: , + text: "Change Log", + mobileHidden: true, + }, + { + href: `https://github.com/community-scripts/${basePath}/discussions`, + event: "Discussions", + icon: , + text: "Discussions", + mobileHidden: true, + }, +].filter(Boolean) as { + href: string; + event: string; + icon: React.ReactNode; + text: string; + mobileHidden?: boolean; +}[]; -export const mostPopularScripts = [ - "Proxmox VE Post Install", - "Docker", - "Home Assistant OS", -]; +export const mostPopularScripts = ["post-pve-install", "docker", "homeassistant"]; export const analytics = { url: "analytics.proxmoxve-scripts.com", diff --git a/install/actualbudget-install.sh b/install/actualbudget-install.sh index 1dc8cc04..82adda21 100644 --- a/install/actualbudget-install.sh +++ b/install/actualbudget-install.sh @@ -37,10 +37,10 @@ $STD npm install --global yarn msg_ok "Installed Node.js" msg_info "Installing Actual Budget" +cd /opt RELEASE=$(curl -s https://api.github.com/repos/actualbudget/actual/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -wget -q https://github.com/actualbudget/actual-server/archive/refs/tags/v${RELEASE} -#$STD curl -L -o actual-server.tar.gz https://github.com/actualbudget/actual-server/archive/refs/tags/v${RELEASE}.tar.gz -$STD tar -xzvf v${RELEASE}.tar.gz +wget -q https://github.com/actualbudget/actual-server/archive/refs/tags/v${RELEASE}.tar.gz +tar -xzf v${RELEASE}.tar.gz mv *ctual-server-* /opt/actualbudget mkdir -p /opt/actualbudget/server-files mkdir -p /opt/actualbudget-data diff --git a/install/paperless-ngx-install.sh b/install/paperless-ngx-install.sh index 9e525908..16c56ead 100644 --- a/install/paperless-ngx-install.sh +++ b/install/paperless-ngx-install.sh @@ -14,7 +14,7 @@ network_check update_os msg_info "Installing Dependencies (Patience)" -$STD apt-get install -y --no-install-recommends \ +$STD apt-get install -y \ redis \ postgresql \ build-essential \ @@ -41,7 +41,7 @@ $STD apt-get install -y --no-install-recommends \ msg_ok "Installed Dependencies" msg_info "Installing Python3 Dependencies (Patience)" -$STD apt-get install -y --no-install-recommends \ +$STD apt-get install -y \ python3 \ python3-pip \ python3-dev \ @@ -50,7 +50,7 @@ $STD apt-get install -y --no-install-recommends \ msg_ok "Installed Python3 Dependencies" msg_info "Installing OCR Dependencies (Patience)" -$STD apt-get install -y --no-install-recommends \ +$STD apt-get install -y \ unpaper \ icc-profiles-free \ qpdf \ @@ -60,7 +60,7 @@ $STD apt-get install -y --no-install-recommends \ zlib1g \ tesseract-ocr \ tesseract-ocr-eng - + cd /tmp wget -q https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10040/ghostscript-10.04.0.tar.gz $STD tar -xzf ghostscript-10.04.0.tar.gz @@ -196,6 +196,7 @@ Requires=redis.service [Service] WorkingDirectory=/opt/paperless/src +ExecStartPre=/bin/sleep 2 ExecStart=python3 manage.py document_consumer [Install] @@ -220,7 +221,7 @@ EOF sed -i -e 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml systemctl daemon-reload -$STD systemctl enable --now paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service +$STD systemctl enable -q --now paperless-webserver paperless-scheduler paperless-task-queue paperless-consumer msg_ok "Created Services" motd_ssh diff --git a/install/sqlserver2022-install.sh b/install/sqlserver2022-install.sh index 63f8e01f..82ceeec9 100644 --- a/install/sqlserver2022-install.sh +++ b/install/sqlserver2022-install.sh @@ -22,27 +22,34 @@ $STD apt install -y \ coreutils msg_ok "Installed Dependencies" -msg_info "Installing SQL Server 2022" -curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg -curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc -curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server-2022.list +msg_info "Setup SQL Server 2022" +$STD curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg +$STD curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc +$STD curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server-2022.list $STD apt-get clean * $STD apt-get update -y $STD apt-get install -y mssql-server -/opt/mssql/bin/mssql-conf setup -msg_ok "Installed SQL Server 2022" +msg_ok "Setup Server 2022" msg_info "Installing SQL Server Tools" +export DEBIAN_FRONTEND=noninteractive curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | tee /etc/apt/sources.list.d/mssql-release.list $STD apt-get update -$STD apt-get install -y \ +$STD apt-get install -y -qq \ mssql-tools18 \ unixodbc-dev -echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc -source ~/.bashrc +echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile +source ~/.bash_profile msg_ok "Installed SQL Server Tools" +read -r -p "Do you want to run the SQL server setup now? (Later is also possible) " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + /opt/mssql/bin/mssql-conf setup +else + msg_ok "Skipping SQL Server setup. You can run it later with '/opt/mssql/bin/mssql-conf setup'." +fi + msg_info "Start Service" systemctl enable -q --now mssql-server msg_ok "Service started" diff --git a/json/code-server.json b/json/code-server.json index cd68a8a2..05059fc7 100644 --- a/json/code-server.json +++ b/json/code-server.json @@ -2,7 +2,9 @@ "name": "VS Code Server", "slug": "code-server", "categories": [ - 1 + 1, + 20, + 11 ], "date_created": "2024-05-02", "type": "misc", @@ -36,4 +38,4 @@ "type": "warning" } ] -} \ No newline at end of file +} diff --git a/json/docker-vm.json b/json/docker-vm.json index 2de0eca5..b5310721 100644 --- a/json/docker-vm.json +++ b/json/docker-vm.json @@ -2,7 +2,7 @@ "name": "Docker", "slug": "docker-vm", "categories": [ - 2 + 2, 3 ], "date_created": "2025-01-20", "type": "vm", diff --git a/json/sqlserver2022.json b/json/sqlserver2022.json index 497f90a8..818b88c4 100644 --- a/json/sqlserver2022.json +++ b/json/sqlserver2022.json @@ -2,7 +2,7 @@ "name":"SQL Server 2022", "slug":"sqlserver2022", "categories":[ - 5 + 8 ], "date_created":"2025-01-14", "type":"ct", @@ -31,6 +31,10 @@ "password":null }, "notes":[ + { + "text":"if you not choose the install setup, execute: `/opt/mssql/bin/mssql-conf setup` in LXC shell.", + "type":"info" + }, { "text":"You can setup the admin account 'SA' during installation", "type":"info" @@ -40,4 +44,4 @@ "type":"warning" } ] -} \ No newline at end of file +} diff --git a/misc/.app-headers b/misc/.app-headers index f0a43916..c8602222 100644 --- a/misc/.app-headers +++ b/misc/.app-headers @@ -1,4 +1,4 @@ -### Generated on 01-21-2025 +### Generated on 01-22-2025 ################################################## ### 2fauth.sh diff --git a/misc/build.func b/misc/build.func index e9267b7a..ef98462f 100644 --- a/misc/build.func +++ b/misc/build.func @@ -462,8 +462,7 @@ advanced_settings() { else exit_script fi - fi - if [ "$var_default_version" == "22.04" ]; then + elif [ "$var_default_version" == "22.04" ]; then if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ "20.04" "Focal" OFF \ "22.04" "Jammy" ON \ @@ -476,9 +475,8 @@ advanced_settings() { else exit_script fi - fi - if [ "$var_default_version" == "24.04" ]; then - if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ + elif [ "$var_default_version" == "24.04" ]; then + if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ "20.04" "Focal" OFF \ "22.04" "Jammy" OFF \ "24.04" "Noble" ON \ @@ -489,9 +487,8 @@ advanced_settings() { fi else exit_script - fi - fi - if [ "$var_default_version" == "24.10" ]; then + fi + else if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ "20.04" "Focal" OFF \ "22.04" "Jammy" OFF \ diff --git a/vm/debian-vm.sh b/vm/debian-vm.sh index 57d373fd..857c0ad6 100644 --- a/vm/debian-vm.sh +++ b/vm/debian-vm.sh @@ -1,9 +1,8 @@ #!/usr/bin/env bash -# Copyright (c) 2021-2025 tteck -# Author: tteck (tteckster) -# License: MIT -# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE function header_info { clear @@ -23,16 +22,36 @@ NEXTID=$(pvesh get /cluster/nextid) YW=$(echo "\033[33m") BL=$(echo "\033[36m") -HA=$(echo "\033[1;34m") RD=$(echo "\033[01;31m") BGN=$(echo "\033[4;92m") GN=$(echo "\033[1;92m") DGN=$(echo "\033[32m") CL=$(echo "\033[m") + +CL=$(echo "\033[m") +BOLD=$(echo "\033[1m") BFR="\\r\\033[K" -HOLD="-" -CM="${GN}✓${CL}" -CROSS="${RD}✗${CL}" +HOLD=" " +TAB=" " + +CM="${TAB}✔️${TAB}${CL}" +CROSS="${TAB}✖️${TAB}${CL}" +INFO="${TAB}💡${TAB}${CL}" +OS="${TAB}🖥️${TAB}${CL}" +CONTAINERTYPE="${TAB}📦${TAB}${CL}" +DISKSIZE="${TAB}💾${TAB}${CL}" +CPUCORE="${TAB}🧠${TAB}${CL}" +RAMSIZE="${TAB}🛠️${TAB}${CL}" +CONTAINERID="${TAB}🆔${TAB}${CL}" +HOSTNAME="${TAB}🏠${TAB}${CL}" +BRIDGE="${TAB}🌉${TAB}${CL}" +GATEWAY="${TAB}🌐${TAB}${CL}" +DEFAULT="${TAB}⚙️${TAB}${CL}" +MACADDRESS="${TAB}🔗${TAB}${CL}" +VLANTAG="${TAB}🏷️${TAB}${CL}" +CREATING="${TAB}🚀${TAB}${CL}" +ADVANCED="${TAB}🧩${TAB}${CL}" + THIN="discard=on,ssd=1," set -e trap 'error_handler $LINENO "$BASH_COMMAND"' ERR @@ -63,22 +82,22 @@ pushd $TEMP_DIR >/dev/null if whiptail --backtitle "Proxmox VE Helper Scripts" --title "Debian 12 VM" --yesno "This will create a New Debian 12 VM. Proceed?" 10 58; then : else - header_info && echo -e "⚠ User exited script \n" && exit + header_info && echo -e "${CROSS}${RD}User exited script${CL}\n" && exit fi function msg_info() { local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." + echo -ne "${TAB}${YW}${HOLD}${msg}${HOLD}" } function msg_ok() { local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" + echo -e "${BFR}${CM}${GN}${msg}${CL}" } function msg_error() { local msg="$1" - echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" + echo -e "${BFR}${CROSS}${RD}${msg}${CL}" } function check_root() { @@ -93,17 +112,18 @@ function check_root() { function pve_check() { if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then - msg_error "This version of Proxmox Virtual Environment is not supported" + msg_error "${CROSS}${RD}This version of Proxmox Virtual Environment is not supported" echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." echo -e "Exiting..." sleep 2 exit -fi + fi } function arch_check() { if [ "$(dpkg --print-architecture)" != "amd64" ]; then - msg_error "This script will not work with PiMox! \n" + echo -e "\n ${INFO}${YWB}This script will not work with PiMox! \n" + echo -e "\n ${YWB}Visit https://github.com/asylumexp/Proxmox for ARM64 support. \n" echo -e "Exiting..." sleep 2 exit @@ -125,7 +145,7 @@ function ssh_check() { function exit-script() { clear - echo -e "⚠ User exited script \n" + echo -e "\n${CROSS}${RD}User exited script${CL}\n" exit } @@ -133,6 +153,7 @@ function default_settings() { VMID="$NEXTID" FORMAT=",efitype=4m" MACHINE="" + DISK_SIZE="8G" DISK_CACHE="" HN="debian" CPU_TYPE="" @@ -143,19 +164,20 @@ function default_settings() { VLAN="" MTU="" START_VM="yes" - echo -e "${DGN}Using Virtual Machine ID: ${BGN}${VMID}${CL}" - echo -e "${DGN}Using Machine Type: ${BGN}i440fx${CL}" - echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" - echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}" - echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" - echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}" - echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}" - echo -e "${DGN}Using Bridge: ${BGN}${BRG}${CL}" - echo -e "${DGN}Using MAC Address: ${BGN}${MAC}${CL}" - echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" - echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" - echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" - echo -e "${BL}Creating a Debian 12 VM using the above default settings${CL}" + echo -e "${CONTAINERID}${BOLD}${DGN}Virtual Machine ID: ${BGN}${VMID}${CL}" + echo -e "${CONTAINERTYPE}${BOLD}${DGN}Machine Type: ${BGN}i440fx${CL}" + echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}${DISK_SIZE}${CL}" + echo -e "${DISKSIZE}${BOLD}${DGN}Disk Cache: ${BGN}None${CL}" + echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}${HN}${CL}" + echo -e "${OS}${BOLD}${DGN}CPU Model: ${BGN}KVM64${CL}" + echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}${CORE_COUNT}${CL}" + echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE}${CL}" + echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}${BRG}${CL}" + echo -e "${MACADDRESS}${BOLD}${DGN}MAC Address: ${BGN}${MAC}${CL}" + echo -e "${VLANTAG}${BOLD}${DGN}VLAN: ${BGN}Default${CL}" + echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}Default${CL}" + echo -e "${GATEWAY}${BOLD}${DGN}Start VM when completed: ${BGN}yes${CL}" + echo -e "${CREATING}${BOLD}${DGN}Creating a Debian 12 VM using the above default settings${CL}" } function advanced_settings() { @@ -169,7 +191,7 @@ function advanced_settings() { sleep 2 continue fi - echo -e "${DGN}Virtual Machine ID: ${BGN}$VMID${CL}" + echo -e "${CONTAINERID}${BOLD}${DGN}Virtual Machine ID: ${BGN}$VMID${CL}" break else exit-script @@ -181,27 +203,42 @@ function advanced_settings() { "q35" "Machine q35" OFF \ 3>&1 1>&2 2>&3); then if [ $MACH = q35 ]; then - echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + echo -e "${CONTAINERTYPE}${BOLD}${DGN}Machine Type: ${BGN}$MACH${CL}" FORMAT="" MACHINE=" -machine q35" else - echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + echo -e "${CONTAINERTYPE}${BOLD}${DGN}Machine Type: ${BGN}$MACH${CL}" FORMAT=",efitype=4m" MACHINE="" fi else exit-script fi + + if DISK_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Disk Size in GiB (e.g., 10, 20)" 8 58 "$DISK_SIZE" --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + DISK_SIZE=$(echo "$DISK_SIZE" | tr -d ' ') + if [[ "$DISK_SIZE" =~ ^[0-9]+$ ]]; then + DISK_SIZE="${DISK_SIZE}G" + echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}$DISK_SIZE${CL}" + elif [[ "$DISK_SIZE" =~ ^[0-9]+G$ ]]; then + echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}$DISK_SIZE${CL}" + else + echo -e "${DISKSIZE}${BOLD}${RD}Invalid Disk Size. Please use a number (e.g., 10 or 10G).${CL}" + exit-script + fi + else + exit-script + fi if DISK_CACHE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISK CACHE" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ "0" "None (Default)" ON \ "1" "Write Through" OFF \ 3>&1 1>&2 2>&3); then if [ $DISK_CACHE = "1" ]; then - echo -e "${DGN}Using Disk Cache: ${BGN}Write Through${CL}" + echo -e "${DISKSIZE}${BOLD}${DGN}Disk Cache: ${BGN}Write Through${CL}" DISK_CACHE="cache=writethrough," else - echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + echo -e "${DISKSIZE}${BOLD}${DGN}Disk Cache: ${BGN}None${CL}" DISK_CACHE="" fi else @@ -211,10 +248,10 @@ function advanced_settings() { if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 debian --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if [ -z $VM_NAME ]; then HN="debian" - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}$HN${CL}" else HN=$(echo ${VM_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}$HN${CL}" fi else exit-script @@ -225,10 +262,10 @@ function advanced_settings() { "1" "Host" OFF \ 3>&1 1>&2 2>&3); then if [ $CPU_TYPE1 = "1" ]; then - echo -e "${DGN}Using CPU Model: ${BGN}Host${CL}" + echo -e "${OS}${BOLD}${DGN}CPU Model: ${BGN}Host${CL}" CPU_TYPE=" -cpu host" else - echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + echo -e "${OS}${BOLD}${DGN}CPU Model: ${BGN}KVM64${CL}" CPU_TYPE="" fi else @@ -238,9 +275,9 @@ function advanced_settings() { if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if [ -z $CORE_COUNT ]; then CORE_COUNT="2" - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}$CORE_COUNT${CL}" else - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}$CORE_COUNT${CL}" fi else exit-script @@ -249,9 +286,9 @@ function advanced_settings() { if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 2048 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if [ -z $RAM_SIZE ]; then RAM_SIZE="2048" - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}$RAM_SIZE${CL}" else - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}$RAM_SIZE${CL}" fi else exit-script @@ -260,9 +297,9 @@ function advanced_settings() { if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if [ -z $BRG ]; then BRG="vmbr0" - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}" else - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}" fi else exit-script @@ -271,10 +308,10 @@ function advanced_settings() { if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address" 8 58 $GEN_MAC --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if [ -z $MAC1 ]; then MAC="$GEN_MAC" - echo -e "${DGN}Using MAC Address: ${BGN}$MAC${CL}" + echo -e "${MACADDRESS}${BOLD}${DGN}MAC Address: ${BGN}$MAC${CL}" else MAC="$MAC1" - echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + echo -e "${MACADDRESS}${BOLD}${DGN}MAC Address: ${BGN}$MAC1${CL}" fi else exit-script @@ -284,10 +321,10 @@ function advanced_settings() { if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="" - echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + echo -e "${VLANTAG}${BOLD}${DGN}VLAN: ${BGN}$VLAN1${CL}" else VLAN=",tag=$VLAN1" - echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + echo -e "${VLANTAG}${BOLD}${DGN}VLAN: ${BGN}$VLAN1${CL}" fi else exit-script @@ -297,28 +334,28 @@ function advanced_settings() { if [ -z $MTU1 ]; then MTU1="Default" MTU="" - echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU1${CL}" else MTU=",mtu=$MTU1" - echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU1${CL}" fi else exit-script fi if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then - echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + echo -e "${GATEWAY}${BOLD}${DGN}Start VM when completed: ${BGN}yes${CL}" START_VM="yes" else - echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + echo -e "${GATEWAY}${BOLD}${DGN}Start VM when completed: ${BGN}no${CL}" START_VM="no" fi if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create a Debian 12 VM?" --no-button Do-Over 10 58); then - echo -e "${RD}Creating a Debian 12 VM using the above advanced settings${CL}" + echo -e "${CREATING}${BOLD}${DGN}Creating a Debian 12 VM using the above advanced settings${CL}" else header_info - echo -e "${RD}Using Advanced Settings${CL}" + echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings${CL}" advanced_settings fi } @@ -326,11 +363,11 @@ function advanced_settings() { function start_script() { if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info - echo -e "${BL}Using Default Settings${CL}" + echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings${CL}" default_settings else header_info - echo -e "${RD}Using Advanced Settings${CL}" + echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings${CL}" advanced_settings fi } @@ -402,16 +439,16 @@ done msg_info "Creating a Debian 12 VM" qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \ - -name $HN -tags community-script -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci + -name $HN -tags proxmox-helper-scripts -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null qm importdisk $VMID ${FILE} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null qm set $VMID \ -efidisk0 ${DISK0_REF}${FORMAT} \ - -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=2G \ + -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=${DISK_SIZE} \ -boot order=scsi0 \ -serial0 socket >/dev/null -qm resize $VMID scsi0 4G >/dev/null - DESCRIPTION=$(cat < Logo @@ -440,13 +477,21 @@ qm resize $VMID scsi0 4G >/dev/null
EOF ) - qm set "$VMID" -description "$DESCRIPTION" >/dev/null - +qm set "$VMID" -description "$DESCRIPTION" >/dev/null +if [ -n "$DISK_SIZE" ]; then + msg_info "Resizing disk to $DISK_SIZE GB" + qm resize $VMID scsi0 ${DISK_SIZE} >/dev/null +else + msg_info "Using default disk size of $DEFAULT_DISK_SIZE GB" + qm resize $VMID scsi0 ${DEFAULT_DISK_SIZE} >/dev/null +fi + msg_ok "Created a Debian 12 VM ${CL}${BL}(${HN})" if [ "$START_VM" == "yes" ]; then msg_info "Starting Debian 12 VM" qm start $VMID msg_ok "Started Debian 12 VM" fi + msg_ok "Completed Successfully!\n" echo "More Info at https://github.com/community-scripts/ProxmoxVE/discussions/836"