From 750a74e4cd125bc341e916d0739bbd42c70ec1cf Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Sun, 15 Nov 2026 22:09:58 +0100 Subject: [PATCH] Add dietpi (ct) (#18746) Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> --- ct/dietpi.sh | 56 +++++++++++++++++++++++++++++++++++++++ install/dietpi-install.sh | 54 +++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100755 ct/dietpi.sh create mode 100755 install/dietpi-install.sh diff --git a/ct/dietpi.sh b/ct/dietpi.sh new file mode 100755 index 000000000..f78183316 --- /dev/null +++ b/ct/dietpi.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# Engine comes from community-scripts/core; this repo only ships the scripts. +# Local checkout wins (COMMUNITY_SCRIPTS_CORE_DIR, else a sibling ../core), so a +# fork/branch of core can be tested without touching this file. +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: mews-se +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://dietpi.com/ + +APP="DietPi" +var_tags="${var_tags:-os}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-512}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -f /boot/dietpi/.version ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating DietPi LXC" + $STD /boot/dietpi/dietpi-update 1 + msg_ok "Updated DietPi LXC" + exit +} + +start +build_container +description + +msg_info "Restarting ${APP} for DietPi's first boot" +if command -v pct &>/dev/null; then + pct reboot "$CTID" +else + incus restart "$CTID" +fi +msg_ok "Restarted ${APP}" + +msg_ok "Completed successfully!" +msg_custom "🚀" "${GN}" "${APP} setup has been successfully initialized!" +echo -e "${INFO}${YW} DietPi's first run setup starts at the next console login.${CL}" diff --git a/install/dietpi-install.sh b/install/dietpi-install.sh new file mode 100755 index 000000000..00a4f8cd8 --- /dev/null +++ b/install/dietpi-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: mews-se +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://dietpi.com/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_warn "WARNING: This script will run an external installer from a third-party source (https://dietpi.com/)." +msg_warn "The following code is NOT maintained or audited by our repository." +msg_warn "If you have any doubts or concerns, please review the installer code before proceeding:" +msg_custom "${TAB3}${GATEWAY}${BGN}${CL}" "\e[1;34m" "→ https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-installer" +echo +if ! prompt_confirm "${TAB3}Do you want to continue?" "y" 60; then + msg_error "Aborted by user. No changes have been made." + exit 10 +fi + +motd_ssh + +msg_info "Converting Debian to DietPi" +curl -fsSL https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-installer -o /tmp/dietpi-installer +$STD env G_INTERACTIVE=0 GITBRANCH=master HW_MODEL=75 DISTRO_TARGET=8 GUEST_NETWORK_REQUIRED=1 IMAGE_CREATOR=community-scripts PREIMAGE_INFO='Proxmox Debian LXC template' bash /tmp/dietpi-installer +rm -f /tmp/dietpi-installer +msg_ok "Converted Debian to DietPi" + +msg_info "Configuring DietPi" +sed -i -e 's/^AUTO_SETUP_NET_ETHERNET_ENABLED=.*/AUTO_SETUP_NET_ETHERNET_ENABLED=0/' \ + -e "s/^AUTO_SETUP_NET_HOSTNAME=.*/AUTO_SETUP_NET_HOSTNAME=$(hostname)/" /boot/dietpi.txt +if [[ -n "${PASSWORD:-}" ]]; then + sed -i '/^AUTO_SETUP_GLOBAL_PASSWORD=/d' /boot/dietpi.txt + echo "AUTO_SETUP_GLOBAL_PASSWORD=$PASSWORD" >>/boot/dietpi.txt +fi +rm -f /etc/apt/sources.list.d/debian.sources +rm -f /etc/sysctl.d/97-dietpi.conf +rm -f /etc/systemd/system/local-fs.target.wants/dietpi-fs_partition_resize.service +msg_ok "Configured DietPi" + +customize +# Autologin on tty1 only: DietPi's first run setup runs on the first console that logs in, and the Proxmox UI attaches to tty1 +rm -f /etc/systemd/system/console-getty.service.d/override.conf +if [[ -f /etc/systemd/system/container-getty@.service.d/override.conf ]]; then + mkdir -p /etc/systemd/system/container-getty@1.service.d + mv /etc/systemd/system/container-getty@.service.d/override.conf /etc/systemd/system/container-getty@1.service.d/ + rmdir /etc/systemd/system/container-getty@.service.d +fi +cleanup_lxc