fedora: 修复 f37/f38 云镜像用静态 ipv6 会掉线
This commit is contained in:
parent
5ab8d279b9
commit
78937098a6
13
trans.sh
13
trans.sh
@ -915,11 +915,14 @@ download_cloud_init_config() {
|
|||||||
# 如果分区表中已经有swapfile就跳过,例如arch
|
# 如果分区表中已经有swapfile就跳过,例如arch
|
||||||
if ! grep -w swap $os_dir/etc/fstab; then
|
if ! grep -w swap $os_dir/etc/fstab; then
|
||||||
# btrfs
|
# btrfs
|
||||||
|
# 目前只有 arch 和 fedora 镜像使用 btrfs
|
||||||
|
# 等 fedora 38 cloud-init 升级到 v23.3 后删除
|
||||||
if mount | grep 'on /os type btrfs'; then
|
if mount | grep 'on /os type btrfs'; then
|
||||||
insert_into_file $ci_file after '^runcmd:' <<EOF
|
insert_into_file $ci_file after '^runcmd:' <<EOF
|
||||||
- btrfs filesystem mkswapfile --size 1G /swapfile
|
- btrfs filesystem mkswapfile --size 1G /swapfile
|
||||||
- swapon /swapfile
|
- swapon /swapfile
|
||||||
- echo "/swapfile none swap defaults 0 0" >> /etc/fstab
|
- echo "/swapfile none swap defaults 0 0" >> /etc/fstab
|
||||||
|
- systemctl daemon-reload
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
# ext4 xfs
|
# ext4 xfs
|
||||||
@ -1051,6 +1054,16 @@ modify_linux() {
|
|||||||
disable_selinux_kdump $os_dir
|
disable_selinux_kdump $os_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 修复 fedora 38 或以下用静态 ipv6 会掉线
|
||||||
|
# el 全系也用 NetworkManager,但他们的配置文件是 sysconfig,因此不受影响
|
||||||
|
# https://github.com/canonical/cloud-init/commit/5d440856cb6d2b4c908015fe4eb7227615c17c8b
|
||||||
|
if grep -E 'fedora:(37|38)' $os_dir/etc/os-release; then
|
||||||
|
network_manager_py=$os_dir/usr/lib/python3.11/site-packages/cloudinit/net/network_manager.py &&
|
||||||
|
if ! grep '"static6": "manual",' $network_manager_py; then
|
||||||
|
echo '"static6": "manual",' | insert_into_file $network_manager_py after '"static": "manual",'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# debian 10/11 默认不支持 rdnss,要安装 rdnssd 或者 nm
|
# debian 10/11 默认不支持 rdnss,要安装 rdnssd 或者 nm
|
||||||
if [ -f $os_dir/etc/debian_version ] && grep -E '^(10|11)' $os_dir/etc/debian_version; then
|
if [ -f $os_dir/etc/debian_version ] && grep -E '^(10|11)' $os_dir/etc/debian_version; then
|
||||||
mv $os_dir/etc/resolv.conf $os_dir/etc/resolv.conf.orig
|
mv $os_dir/etc/resolv.conf $os_dir/etc/resolv.conf.orig
|
||||||
|
Loading…
Reference in New Issue
Block a user