core: 放置 cloud-init 配置时,删除注释

This commit is contained in:
bin456789 2023-10-22 00:46:53 +08:00
parent 5252f1e581
commit 250a7e26de
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 6 additions and 6 deletions

View File

@ -20,7 +20,6 @@ runcmd:
# opensuse tumbleweed 有 /etc/ssh/sshd_config.d/ 文件夹,但没有 /etc/ssh/sshd_config但有/usr/etc/ssh/sshd_config
- grep 'Include.*/etc/ssh/sshd_config.d' /etc/sshd_config && echo "PermitRootLogin yes" >/etc/ssh/sshd_config.d/01-permitrootlogin.conf || echo "PermitRootLogin yes" >>/etc/ssh/sshd_config
- systemctl restart sshd
# ubuntu 镜像运行 echo -e '\nDone' -e 会被显示出来
- echo >/dev/tty0
- echo Done >/dev/tty0
- touch /etc/cloud/cloud-init.disabled
# ubuntu 镜像运行 echo -e '\nDone' -e 会被显示出来
- printf '\n%s\n' 'done' >/dev/console

View File

@ -747,10 +747,11 @@ EOF
download_cloud_init_config() {
os_dir=$1
ci_file=$os_dir/etc/cloud/cloud.cfg.d/99_nocloud.cfg
# shellcheck disable=SC2154
download $confhome/nocloud.yaml $ci_file
ci_file=$os_dir/etc/cloud/cloud.cfg.d/99_nocloud.cfg
download $confhome/cloud-init.yaml $ci_file
# 删除注释行,除了第一行
sed -i '1!{/^[[:space:]]*#/d}' $ci_file
# swapfile
# 如果分区表中已经有swapfile就跳过例如arch