From 250a7e26de5e3a238d140685c0531170c8b82732 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Sun, 22 Oct 2023 00:46:53 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E6=94=BE=E7=BD=AE=20cloud-init=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nocloud.yaml => cloud-init.yaml | 5 ++--- trans.sh | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename nocloud.yaml => cloud-init.yaml (94%) diff --git a/nocloud.yaml b/cloud-init.yaml similarity index 94% rename from nocloud.yaml rename to cloud-init.yaml index e48a3fb..6bb639b 100644 --- a/nocloud.yaml +++ b/cloud-init.yaml @@ -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 diff --git a/trans.sh b/trans.sh index ddc7002..8e10264 100644 --- a/trans.sh +++ b/trans.sh @@ -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