mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-19 12:49:14 +08:00
debian: 去除 swap 分区
This commit is contained in:
parent
55cc1a47ac
commit
d2b6f2b70f
62
debian.cfg
62
debian.cfg
@ -25,27 +25,58 @@ d-i passwd/root-password password 123@@@
|
|||||||
d-i passwd/root-password-again password 123@@@
|
d-i passwd/root-password-again password 123@@@
|
||||||
|
|
||||||
# B.4.6. 时钟与时区设置
|
# B.4.6. 时钟与时区设置
|
||||||
d-i clock-setup/utc boolean true
|
|
||||||
d-i time/zone string Asia/Shanghai
|
d-i time/zone string Asia/Shanghai
|
||||||
d-i clock-setup/ntp boolean true
|
|
||||||
|
|
||||||
# B.4.7. 分区
|
# B.4.7. 分区
|
||||||
d-i partman-auto/method string regular
|
d-i partman-auto/method string regular
|
||||||
d-i partman-lvm/device_remove_lvm boolean true
|
d-i partman-lvm/device_remove_lvm boolean true
|
||||||
d-i partman-md/device_remove_md boolean true
|
d-i partman-md/device_remove_md boolean true
|
||||||
d-i partman-auto/choose_recipe select atomic
|
|
||||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||||
d-i partman/choose_partition select finish
|
d-i partman/choose_partition select finish
|
||||||
d-i partman/confirm boolean true
|
d-i partman/confirm boolean true
|
||||||
d-i partman/confirm_nooverwrite boolean true
|
d-i partman/confirm_nooverwrite boolean true
|
||||||
d-i partman-basicfilesystems/no_swap boolean true
|
|
||||||
|
# vm 原有系统是 bios + gpt,切换成 efi,用 iso 重装,需要确认此项
|
||||||
|
# 用脚本重装的话,强制安装在第二个硬盘上也可能会遇到?
|
||||||
|
d-i partman-efi/non_efi_system boolean true
|
||||||
|
|
||||||
|
### Description: Do you want to return to the partitioning menu?
|
||||||
|
# You have not selected any partitions for use as swap space. Enabling swap
|
||||||
|
# space is recommended so that the system can make better use of the
|
||||||
|
# available physical memory, and so that it behaves better when physical
|
||||||
|
# memory is scarce. You may experience installation problems if you do not
|
||||||
|
# have enough physical memory.
|
||||||
|
# .
|
||||||
|
# If you do not go back to the partitioning menu and assign a swap partition,
|
||||||
|
# the installation will continue without swap space.
|
||||||
|
# 坑的一比
|
||||||
|
# 不是确认是否 no_swap
|
||||||
|
# 而是 recipe no_swap 时,确认是否返回上一级重新分区
|
||||||
|
# 选择 true 就一直死循环
|
||||||
|
d-i partman-basicfilesystems/no_swap boolean false
|
||||||
|
|
||||||
|
|
||||||
|
# 最小值 膨胀权重 最大值
|
||||||
|
# https://salsa.debian.org/installer-team/partman-auto/-/blob/master/recipes/atomic?ref_type=heads
|
||||||
|
# https://salsa.debian.org/installer-team/partman-auto/-/blob/master/recipes-amd64-efi/atomic?ref_type=heads
|
||||||
|
d-i partman-auto/expert_recipe_efi string efi :: \
|
||||||
|
106 1 106 free \
|
||||||
|
$iflabel{ gpt } $reusemethod{ } method{ efi } format{ } . \
|
||||||
|
1 1 -1 $default_filesystem \
|
||||||
|
method{ format } format{ } use_filesystem{ } $default_filesystem{ } mountpoint{ / } .
|
||||||
|
|
||||||
|
d-i partman-auto/expert_recipe_bios string bios :: \
|
||||||
|
1 1 1 free \
|
||||||
|
$iflabel{ gpt } $reusemethod{ } method{ biosgrub } . \
|
||||||
|
1 1 -1 $default_filesystem \
|
||||||
|
method{ format } format{ } use_filesystem{ } $default_filesystem{ } mountpoint{ / } .
|
||||||
|
|
||||||
# B.4.8. 基本系统安装
|
# B.4.8. 基本系统安装
|
||||||
|
|
||||||
# B.4.9. 设置 apt
|
# B.4.9. 设置 apt
|
||||||
d-i apt-setup/non-free boolean false
|
d-i apt-setup/non-free boolean true
|
||||||
d-i apt-setup/non-free-firmware boolean true
|
d-i apt-setup/non-free-firmware boolean true
|
||||||
d-i apt-setup/contrib boolean false
|
d-i apt-setup/contrib boolean true
|
||||||
d-i apt-setup/enable-source-repositories boolean false
|
d-i apt-setup/enable-source-repositories boolean false
|
||||||
d-i apt-setup/services-select multiselect security, updates
|
d-i apt-setup/services-select multiselect security, updates
|
||||||
d-i apt-setup/security_host string security.debian.org
|
d-i apt-setup/security_host string security.debian.org
|
||||||
@ -55,9 +86,8 @@ tasksel tasksel/first multiselect ssh-server
|
|||||||
d-i pkgsel/upgrade select none
|
d-i pkgsel/upgrade select none
|
||||||
|
|
||||||
# B.4.11. 安装 bootloader
|
# B.4.11. 安装 bootloader
|
||||||
d-i grub-installer/only_debian boolean true
|
|
||||||
d-i grub-installer/with_other_os boolean false
|
|
||||||
d-i grub-installer/bootdev string default
|
d-i grub-installer/bootdev string default
|
||||||
|
# 添加 bootx64.efi
|
||||||
d-i grub2/force_efi_extra_removable boolean true
|
d-i grub2/force_efi_extra_removable boolean true
|
||||||
|
|
||||||
# B.4.12. 完成安装
|
# B.4.12. 完成安装
|
||||||
@ -72,8 +102,16 @@ d-i preseed/early_command string \
|
|||||||
|
|
||||||
d-i partman/early_command string \
|
d-i partman/early_command string \
|
||||||
confhome="$(grep -o 'extra\.confhome=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
confhome="$(grep -o 'extra\.confhome=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
||||||
|
swapfile=/target/swapfile; \
|
||||||
|
postinst=/var/lib/dpkg/info/bootstrap-base.postinst; \
|
||||||
anna-install fdisk-udeb; \
|
anna-install fdisk-udeb; \
|
||||||
|
|
||||||
|
cp $postinst $postinst.orig; \
|
||||||
|
echo "fallocate -l 256M $swapfile; mkswap $swapfile; swapon $swapfile; $postinst.orig" >$postinst; \
|
||||||
|
|
||||||
|
echo "swapoff $swapfile; rm $swapfile" >/usr/lib/finish-install.d/95swapoff; \
|
||||||
|
chmod a+x /usr/lib/finish-install.d/95swapoff; \
|
||||||
|
|
||||||
xda=$(wget --tries=5 $confhome/get-xda.sh -O- | sh -s); \
|
xda=$(wget --tries=5 $confhome/get-xda.sh -O- | sh -s); \
|
||||||
debconf-set partman-auto/disk "/dev/$xda"; \
|
debconf-set partman-auto/disk "/dev/$xda"; \
|
||||||
|
|
||||||
@ -81,7 +119,11 @@ d-i partman/early_command string \
|
|||||||
debconf-set debian-installer/add-kernel-opts "$ttys"; \
|
debconf-set debian-installer/add-kernel-opts "$ttys"; \
|
||||||
|
|
||||||
kernel="$(grep -o 'extra\.kernel=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
kernel="$(grep -o 'extra\.kernel=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
||||||
debconf-set base-installer/kernel/image "$kernel"
|
debconf-set base-installer/kernel/image "$kernel"; \
|
||||||
|
|
||||||
|
[ -d /sys/firmware/efi ] && debconf-set partman-auto/expert_recipe "$(debconf-get partman-auto/expert_recipe_efi)"; \
|
||||||
|
[ -d /sys/firmware/efi ] || debconf-set partman-auto/expert_recipe "$(debconf-get partman-auto/expert_recipe_bios)"
|
||||||
|
|
||||||
|
|
||||||
# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹
|
# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹
|
||||||
d-i preseed/late_command string \
|
d-i preseed/late_command string \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user