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