146 lines
5.3 KiB
INI
146 lines
5.3 KiB
INI
#_preseed_V1
|
|
|
|
#
|
|
# Preseed configuration for debian 11/bullseye
|
|
#
|
|
# ATTENTION: This preseed configuration ERASES the target disks
|
|
# without any confirmation whatsoever.
|
|
#
|
|
|
|
# Locale
|
|
d-i debian-installer/locale string en_US
|
|
d-i debian-installer/locale string en_US.UTF-8
|
|
d-i keyboard-configuration/xkb-keymap select us
|
|
|
|
|
|
# Network
|
|
d-i hw-detect/load_firmware boolean false
|
|
d-i netcfg/enable boolean true
|
|
d-i netcfg/choose_interface select auto
|
|
d-i netcfg/hostname string unassigned-preseed
|
|
d-i netcfg/get_hostname string unassigned-preseed
|
|
d-i netcfg/get_domain string local
|
|
|
|
|
|
# Apt
|
|
d-i apt-setup/cdrom/set-first boolean false
|
|
d-i apt-setup/cdrom/set-next boolean false
|
|
d-i apt-setup/cdrom/set-failed boolean false
|
|
d-i mirror/country string manual
|
|
d-i mirror/http/hostname string ftp.cn.debian.org
|
|
d-i mirror/http/directory string /debian
|
|
d-i mirror/http/proxy string
|
|
|
|
|
|
# Users/passwords
|
|
d-i passwd/root-login boolean true
|
|
d-i passwd/make-user boolean false
|
|
d-i passwd/root-password password Xking123456;a
|
|
d-i passwd/root-password-again password Xking123456;a
|
|
|
|
|
|
# Clock
|
|
d-i clock-setup/cst boolean true
|
|
d-i time/zone string Asia/Shanghai
|
|
d-i clock-setup/ntp boolean true
|
|
|
|
|
|
# Disk partition
|
|
d-i partman/early_command string \
|
|
BOOT_DEV=$(list-devices disk | head -1) ; \
|
|
debconf-set partman-auto/disk $BOOT_DEV
|
|
|
|
d-i partman-auto/method string regular
|
|
d-i partman-auto/choose_recipe select atomic
|
|
d-i partman-auto/expert_recipe string \
|
|
50 100 50 fat32 \
|
|
$primary{ } \
|
|
method{ efi } \
|
|
format{ } \
|
|
. \
|
|
1000 8000 -1 ext4 \
|
|
$primary{ } \
|
|
method{ format } \
|
|
format{ } \
|
|
use_filesystem{ } \
|
|
filesystem{ ext4 } \
|
|
mountpoint{ / } \
|
|
. \
|
|
2048 2048 2048 linux-swap \
|
|
$primary{ } \
|
|
method{ swap } \
|
|
format{ } \
|
|
.
|
|
|
|
|
|
d-i partman-lvm/device_remove_lvm boolean true
|
|
d-i partman-md/device_remove_md boolean true
|
|
d-i partman/confirm_nooverwrite boolean true
|
|
d-i partman-efi/non_efi_system boolean true
|
|
d-i partman/confirm_write_new_label boolean true
|
|
d-i partman/confirm boolean true
|
|
d-i partman/choose_partition select Finish partitioning and write changes to disk
|
|
|
|
|
|
# Packages
|
|
d-i base-installer/install-recommends boolean false
|
|
d-i base-installer/kernel/image string linux-image-amd64
|
|
d-i apt-setup/use_mirror boolean true
|
|
tasksel tasksel/first multiselect standard, ssh-server
|
|
d-i pkgsel/include string vim sudo
|
|
d-i pkgsel/upgrade select safe-upgrade
|
|
popularity-contest popularity-contest/participate boolean true
|
|
|
|
|
|
# Boot
|
|
d-i grub-installer/only_debian boolean true
|
|
d-i debian-installer/add-kernel-opts string cgroup_enable=memory swapaccount=1
|
|
d-i grub-installer/with_other_os boolean true
|
|
d-i grub-installer/force-efi-extra-removable boolean true
|
|
d-i grub-installer/progress/step_force_efi_removable boolean true
|
|
d-i grub-installer/bootdev string default
|
|
|
|
|
|
# Custom late commands
|
|
d-i preseed/late_command string \
|
|
HOST_SERIAL="debian-$(head /dev/urandom | tr -dc a-z | head -c10)" ; \
|
|
sed -i "s/unassigned-preseed/$HOST_SERIAL/g" /target/etc/hostname ; \
|
|
sed -i "s/unassigned-preseed/$HOST_SERIAL/g" /target/etc/hosts ; \
|
|
in-target sh -c 'mkdir -pv /root/.ssh'; \
|
|
in-target chmod 0700 /root/.ssh/authorized_keys
|
|
in-target sh -c 'echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC8flq0BNF/ijRyWJVoF0RgP7VmgO3JhZUB6fbIEPhN3uImfCyn8X5U8cQOBZ8jn5F4eAkpFu/9K4c/bqrMKtapcHg8uIXJjyYW2otsw+tO6OkPcjOQKL2rpSuDa8fPHFvQuA1xJE/qO/IpdW6hGgWg8nFeLxJ+dE5b6QXszIr4q39iMKRcgWKoWy5PEd1KmHYt7WvwsgpcnKCCQTUnxHWrRljM/IgzQ7zjVZ1/8uUPYjqDzc11bN6lUwSEGLiYuVKdyus9osiPJlKwFr+rdxZhqrgErZlffgEpG+oi5yE0YynbJSloqsy7kQVzon0c9pyixQnBvJ58IHtgWXmlPPVswT11MgpIhSO8suPmmJ41f89Y7d/jDuqEeUu/pfJ3OW3O4AvYHxlQlRMFT3r+SOt0BvI1nUocYaashlB3+6zpDwkHU5WaC00u30s+0lfZ1fQ4EEE4rYKTztHgpk/BVS5Z5f+vG/gMOC7W7E0kVCFmRz3ZPc30MVq7WtV2pS6fQ5U= XkingServer" > /root/.ssh/authorized_keys'; \
|
|
in-target chown --recursive root:root /root/.ssh; \
|
|
in-target chmod 0600 /root/.ssh/authorized_keys; \
|
|
in-target update-alternatives --set editor /usr/bin/vim.basic; \
|
|
in-target sed -i -e 's/^\(PasswordAuthentication\).*/\1 yes/g' -e 's/^\(PermitRootLogin\).*/\1 yes/g' /etc/ssh/sshd_config; \
|
|
in-target sed -i -e '/^GRUB_HIDDEN_TIMEOUT=/d' -e 's/^\(GRUB_HIDDEN_TIMEOUT_QUIET\)=true/\1=false/' /etc/default/grub; \
|
|
in-target sh -c '
|
|
cat <<EOF >/etc/rc.local
|
|
#!/bin/sh -e
|
|
#
|
|
# rc.local
|
|
#
|
|
# This script is executed at the end of each multiuser runlevel.
|
|
# Make sure that the script will "exit 0" on success or any other
|
|
# value on error.
|
|
#
|
|
# In order to enable or disable this script just change the execution
|
|
# bits.
|
|
#
|
|
# By default this script does nothing.
|
|
|
|
dhclient -6 eth0
|
|
|
|
|
|
exit 0
|
|
EOF
|
|
' ;\
|
|
in-target chmod +x /etc/rc.local; \
|
|
in-target systemctl enable --now sshd; \
|
|
in-target systemctl enable --now rc-local; \
|
|
in-target update-grub
|
|
|
|
|
|
# Finish
|
|
d-i finish-install/reboot_in_progress note
|