mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-11-19 04:18:32 +01:00
Add dietpi (ct) (#18746)
Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
13856d79bd
commit
750a74e4cd
2 files changed
+110
No files matched your search
Executable
+56
@@ -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}"
|
||||
Executable
+54
@@ -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
|
||||
Reference in new issue
Block a user