From 3852dee14332c29ee190fd4417f28493b84a1b6c Mon Sep 17 00:00:00 2001 From: bin456789 Date: Mon, 3 Jul 2023 13:51:59 +0800 Subject: [PATCH] =?UTF-8?q?windows:=20=E6=B7=BB=E5=8A=A0=20aws=20nitro=20?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autounattend.xml | 2 +- trans.sh | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Autounattend.xml b/Autounattend.xml index 9ce0583..b0d83af 100644 --- a/Autounattend.xml +++ b/Autounattend.xml @@ -68,7 +68,7 @@ - X:\virtio + X:\drivers diff --git a/trans.sh b/trans.sh index 1078e46..301ee78 100644 --- a/trans.sh +++ b/trans.sh @@ -150,6 +150,7 @@ elif [ "$distro" = "dd" ]; then # alpine busybox 自带 gzip xz,但官方版也许性能更好 # wget -O- $img | $prog -dc >/dev/$xda apk add curl $prog + # curl -L $img | $prog -dc | dd of=/dev/$xda bs=1M curl -L $img | $prog -dc >/dev/$xda sync else @@ -299,7 +300,15 @@ if [ "$distro" = "windows" ]; then # 下载 virtio 驱动 # virt-what 可能返回多个结果,因此配合 grep 使用 - if virt-what | grep kvm; then + # aws lightsail t3 (nitro) 输出结果是 kvm aws + if virt-what | grep aws; then + # https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/migrating-latest-types.html + apk add unzip + download https://s3.amazonaws.com/ec2-windows-drivers-downloads/NVMe/Latest/AWSNVMe.zip /os/AWSNVMe.zip + unzip -o -d /aws /os/AWSNVMe.zip + download https://s3.amazonaws.com/ec2-windows-drivers-downloads/ENA/Latest/AwsEnaNetworkDriver.zip /os/AwsEnaNetworkDriver.zip + unzip -o -d /aws /os/AwsEnaNetworkDriver.zip + elif virt-what | grep kvm; then case $(echo "$image_name" | tr '[:upper:]' '[:lower:]') in 'windows server 2022'*) sys=2k22 ;; 'windows server 2019'*) sys=2k19 ;; @@ -394,12 +403,17 @@ EOF # virtio 驱动 if [ -d /virtio ]; then - mkdir -p /wim/virtio + mkdir -p /wim/drivers/ find /virtio \ -ipath "*/$sys/$arch/*" \ -not -iname '*.pdb' \ -not -iname '*.doc' \ - -exec /bin/cp -rf {} /wim/virtio/ \; + -exec /bin/cp -rf {} /wim/drivers/ \; + fi + # aws 驱动 + if [ -d /aws ]; then + mkdir -p /wim/drivers/ + /bin/cp -rf /aws/* /wim/drivers/ fi # win7 要添加 bootx64.efi 到 efi 目录 @@ -439,6 +453,10 @@ EOF } EOF fi + if [ "$sleep" = 2 ]; then + cd / + sleep infinity + fi exec reboot fi