mirror of
https://github.com/bin456789/reinstall.git
synced 2025-12-10 07:28:56 +08:00
debian: 添加检测是否能用云内核
This commit is contained in:
10
debian.cfg
10
debian.cfg
@ -102,15 +102,20 @@ d-i preseed/early_command string \
|
||||
hostname="$(grep -o 'extra\.deb_hostname=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
||||
debconf-set mirror/http/hostname "$hostname"
|
||||
|
||||
# debian 11 initrd 没有 xargs awk
|
||||
# debian 12 initrd 没有 xargs
|
||||
d-i partman/early_command string \
|
||||
confhome="$(grep -o 'extra\.confhome=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
||||
swapfile=/target/swapfile; \
|
||||
postinst=/var/lib/dpkg/info/bootstrap-base.postinst; \
|
||||
|
||||
cp $postinst $postinst.orig; \
|
||||
echo "fallocate -l 384M $swapfile; mkswap $swapfile; swapon $swapfile; $postinst.orig" >$postinst; \
|
||||
|
||||
echo "swapoff $swapfile; rm $swapfile" >/usr/lib/finish-install.d/95swapoff; \
|
||||
mem=$(grep ^MemTotal: /proc/meminfo | { read x y z; echo $y; }); \
|
||||
mem=$((mem / 1024)); \
|
||||
swap_size=$((512 - mem)); \
|
||||
[ $swap_size -gt 0 ] && echo "fallocate -l ${swap_size}M $swapfile; mkswap $swapfile; swapon $swapfile; $postinst.orig" >$postinst; \
|
||||
echo "swapoff -a; rm -f $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); \
|
||||
@ -122,6 +127,7 @@ d-i partman/early_command string \
|
||||
debconf-set debian-installer/add-kernel-opts "$ttys"; \
|
||||
|
||||
kernel="$(grep -o 'extra\.kernel=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
||||
. /can_use_cloud_kernel.sh || kernel=$(echo "$kernel" | sed 's/-cloud//'); \
|
||||
debconf-set base-installer/kernel/image "$kernel"; \
|
||||
|
||||
[ -d /sys/firmware/efi ] && debconf-set partman-auto/expert_recipe "$(debconf-get partman-auto/expert_recipe_efi)"; \
|
||||
|
||||
Reference in New Issue
Block a user