1
0
Fork 0
mirror of https://github.com/ciderale/nixos-utm.git synced 2024-12-14 11:37:37 +00:00

create disk via setupVM.osa

This commit is contained in:
Alain Lehmann 2023-10-15 17:04:21 +02:00
parent 6886b9a238
commit 41c9a0cb5a
4 changed files with 2 additions and 12 deletions

View file

@ -19,14 +19,6 @@
</array>
<key>Drive</key>
<array>
<dict>
<key>Identifier</key>
<string>XXX_DISK_ID</string>
<key>ImageName</key>
<string>XXX_DISK_ID.img</string>
<key>ReadOnly</key>
<false/>
</dict>
</array>
<key>Information</key>
<dict>

Binary file not shown.

View file

@ -103,7 +103,6 @@
NAME=$NIXOS_NAME
VM_ID=$(uuidgen)
DISK_ID=$(uuidgen)
#MAC_ADDR=$(tr -dc A-F0-9 < /dev/urandom | head -c 10 | sed -r 's/(..)/\1:/g;s/:$//;s/^/02:/')
MAC_ADDR=$(md5sum <<< "$NAME" | head -c 10 | sed -r 's/(..)/\1:/g;s/:$//;s/^/02:/')
@ -127,10 +126,8 @@
fi
mkdir -p "$FOLDER/Data"
set -x
tar xvzf ${./empty.img.gz}
mv empty.img "$FOLDER/Data/$DISK_ID.img"
install -m 600 ${./efi_vars.fd} "$FOLDER/Data/efi_vars.fd"
sed -e "s/XXX_NAME/$NAME/g;s/XXX_VM_ID/$VM_ID/g;s/XXX_DISK_ID/$DISK_ID/g" ${./config.plist} > "$FOLDER/config.plist"
sed -e "s/XXX_NAME/$NAME/g;s/XXX_VM_ID/$VM_ID/g" ${./config.plist} > "$FOLDER/config.plist"
utmctl start "$NAME"
utmctl stop "$NAME"

View file

@ -6,6 +6,7 @@ on run argv
tell application "UTM"
set vm to virtual machine named vm_name
set config to configuration of vm
set end of drives of config to {guest size:65536}
set end of drives of config to {source:iso, removable:true}
set end of network interfaces of config to {address:vm_mac, mode:shared}
update configuration of vm with config