From 57704f2fc0041e40bec7aa91f3457e36cd6da498 Mon Sep 17 00:00:00 2001
From: hellodword <46193371+hellodword@users.noreply.github.com>
Date: Sat, 27 Apr 2024 14:04:43 +0000
Subject: [PATCH] feat: automatically execute
/storage/shared/FirstLogonCommands/install.bat
---
assets/win11x64.xml | 5 +++++
src/install.sh | 13 +++++++++++++
2 files changed, 18 insertions(+)
diff --git a/assets/win11x64.xml b/assets/win11x64.xml
index 05d8118..d66b3cb 100644
--- a/assets/win11x64.xml
+++ b/assets/win11x64.xml
@@ -487,6 +487,11 @@
reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
Disable unsupported hardware notifications
+
+ 201
+ cmd.exe /c for %v in (A B D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist "%v:\FirstLogonCommands\install.bat" "%v:\FirstLogonCommands\install.bat"
+ Execute FirstLogonCommands\install.bat
+
diff --git a/src/install.sh b/src/install.sh
index 7ecbb86..56d7d17 100644
--- a/src/install.sh
+++ b/src/install.sh
@@ -1191,6 +1191,15 @@ bootWindows() {
return 0
}
+prepareCloudInit() {
+ local dir="$1"
+
+ if [ -f "$STORAGE/shared/FirstLogonCommands/install.bat" ]; then
+ # install.bat may depends files in the FirstLogonCommands
+ cp -r "$STORAGE/shared/FirstLogonCommands" "$dir/FirstLogonCommands"
+ fi
+}
+
######################################
if ! startInstall; then
@@ -1231,6 +1240,10 @@ if ! rm -f "$ISO" 2> /dev/null; then
rm -f "$ISO"
fi
+if ! prepareCloudInit "$DIR"; then
+ exit 60
+fi
+
if ! buildImage "$DIR"; then
exit 65
fi