|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (c) 2021-2026 community-scripts ORG |
| 4 | +# Author: mews-se |
| 5 | +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE |
| 6 | +# Source: https://dietpi.com/ |
| 7 | + |
| 8 | +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" |
| 9 | +color |
| 10 | +verb_ip6 |
| 11 | +catch_errors |
| 12 | +setting_up_container |
| 13 | +network_check |
| 14 | +update_os |
| 15 | + |
| 16 | +msg_warn "WARNING: This script will run an external installer from a third-party source (https://dietpi.com/)." |
| 17 | +msg_warn "The following code is NOT maintained or audited by our repository." |
| 18 | +msg_warn "If you have any doubts or concerns, please review the installer code before proceeding:" |
| 19 | +msg_custom "${TAB3}${GATEWAY}${BGN}${CL}" "\e[1;34m" "→ https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-installer" |
| 20 | +echo |
| 21 | +read -r -p "${TAB3}Do you want to continue? [y/N]: " CONFIRM |
| 22 | +if [[ ! "$CONFIRM" =~ ^([yY][eE][sS]|[yY])$ ]]; then |
| 23 | + msg_error "Aborted by user. No changes have been made." |
| 24 | + exit 10 |
| 25 | +fi |
| 26 | + |
| 27 | +motd_ssh |
| 28 | + |
| 29 | +msg_info "Converting Debian to DietPi" |
| 30 | +curl -fsSL https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-installer -o /tmp/dietpi-installer |
| 31 | +$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 |
| 32 | +rm -f /tmp/dietpi-installer |
| 33 | +msg_ok "Converted Debian to DietPi" |
| 34 | + |
| 35 | +msg_info "Configuring DietPi" |
| 36 | +sed -i -e 's/^AUTO_SETUP_NET_ETHERNET_ENABLED=.*/AUTO_SETUP_NET_ETHERNET_ENABLED=0/' \ |
| 37 | + -e "s/^AUTO_SETUP_NET_HOSTNAME=.*/AUTO_SETUP_NET_HOSTNAME=$(hostname)/" /boot/dietpi.txt |
| 38 | +if [[ -n "${PASSWORD:-}" ]]; then |
| 39 | + sed -i '/^AUTO_SETUP_GLOBAL_PASSWORD=/d' /boot/dietpi.txt |
| 40 | + echo "AUTO_SETUP_GLOBAL_PASSWORD=$PASSWORD" >>/boot/dietpi.txt |
| 41 | +fi |
| 42 | +rm -f /etc/apt/sources.list.d/debian.sources |
| 43 | +msg_ok "Configured DietPi" |
| 44 | + |
| 45 | +customize |
| 46 | +# Autologin on tty1 only: DietPi's first run setup runs on the first console that logs in, and the Proxmox UI attaches to tty1 |
| 47 | +rm -f /etc/systemd/system/console-getty.service.d/override.conf |
| 48 | +cleanup_lxc |
0 commit comments