Files
scripts-proxmox/debian-13-fr-vm.sh

86 lines
1.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Debian 13 VM Version FR personnalisée
# Basé sur community-scripts + adaptations
set -e
VMID=$(pvesh get /cluster/nextid)
HN="debian13"
BRG="dhcp"
CORE_COUNT="2"
RAM_SIZE="2048"
DISK_SIZE="8G"
echo "Création VM Debian 13 ID: $VMID"
URL="https://cloud.debian.org/images/cloud/trixie/latest/debian-13-genericcloud-amd64.qcow2"
FILE=$(basename "$URL")
TMPDIR=$(mktemp -d)
cd "$TMPDIR"
echo "Téléchargement image Debian 13..."
curl -fLO "$URL"
STORAGE="local-zfs"
echo "Création VM..."
qm create $VMID \
-name "$HN" \
-memory $RAM_SIZE \
-cores $CORE_COUNT \
-net0 virtio,bridge=$BRG \
-ostype l26 \
-scsihw virtio-scsi-pci \
-agent 1 \
-onboot 0
qm importdisk $VMID "$FILE" $STORAGE
qm set $VMID \
-scsi0 ${STORAGE}:vm-${VMID}-disk-0 \
-boot order=scsi0 \
-serial0 socket \
-scsi1 ${STORAGE}:cloudinit
# DHCP IPv4 cloud-init
qm set $VMID --ipconfig0 ip=dhcp
# ===== Clavier + Locale FR =====
SNIPPET_DIR="/var/lib/vz/snippets"
mkdir -p "$SNIPPET_DIR"
cat > "$SNIPPET_DIR/${VMID}-user-data.yaml" <<EOF
#cloud-config
locale: fr_FR.UTF-8
packages:
- locales
- kbd
- console-setup
- keyboard-configuration
write_files:
- path: /etc/default/keyboard
content: |
XKBLAYOUT="fr"
XKBMODEL="pc105"
- path: /etc/default/console-setup
content: |
KEYMAP="fr"
runcmd:
- sed -i 's/^# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen
- locale-gen
- update-locale LANG=fr_FR.UTF-8
- loadkeys fr || true
- setupcon -k || true
EOF
qm set $VMID --cicustom "user=local:snippets/${VMID}-user-data.yaml"
echo "VM Debian 13 créée avec succès : $VMID"
echo "Bridge : dhcp | DHCP IPv4 activé | FR OK"
echo "La VM n'est PAS démarrée automatiquement."