Skip to content

Commit 3121ca0

Browse files
committed
Add scripts to setup and run ubuntu vm
1 parent 062248c commit 3121ca0

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ xcuserdata/
1010
**/xcshareddata/WorkspaceSettings.xcsettings
1111

1212
/build/
13+
14+
*.gz
15+
*.img
16+
*.iso
17+
initrd
18+
vmlinuz

ubuntu/cidata/meta-data

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
instance-id: iid-local-01
2+
local-hostname: ubuntu

ubuntu/cidata/user-data

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#cloud-config
2+
password: ubuntu
3+
chpasswd:
4+
expire: False
5+
ssh_pwauth: True

ubuntu/run.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
if [ ! -f vmlinuz ]; then
4+
echo "no vmlinuz"
5+
exit 1
6+
fi
7+
8+
if [ ! -f initrd ]; then
9+
echo "no initrd"
10+
exit 1
11+
fi
12+
13+
if [ ! -f vda.img ]; then
14+
echo "no vda.img"
15+
exit 1
16+
fi
17+
18+
if [ ! -f vdc.iso ]; then
19+
echo "no vdc.iso"
20+
exit 1
21+
fi
22+
23+
../build/Release/vm vmlinuz initrd

ubuntu/setup.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
if [ ! -f vmlinuz ]; then
4+
if [ ! -f vmlinuz.gz ]; then
5+
wget -O vmlinuz.gz https://cloud-images.ubuntu.com/noble/current/unpacked/noble-server-cloudimg-arm64-vmlinuz-generic
6+
fi
7+
8+
gunzip -k vmlinuz.gz
9+
fi
10+
11+
if [ ! -f initrd ]; then
12+
wget -O initrd https://cloud-images.ubuntu.com/noble/current/unpacked/noble-server-cloudimg-arm64-initrd-generic
13+
fi
14+
15+
if [ ! -f vda.img ]; then
16+
if [ ! -f noble-server-cloudimg-arm64.tar.gz ]; then
17+
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-arm64.tar.gz
18+
fi
19+
20+
tar xf noble-server-cloudimg-arm64.tar.gz noble-server-cloudimg-arm64.img
21+
mv noble-server-cloudimg-arm64.img vda.img
22+
truncate -s 64G vda.img
23+
fi
24+
25+
if [ ! -f vdc.iso ]; then
26+
hdiutil makehybrid -o vdc cidata -iso -joliet
27+
fi

0 commit comments

Comments
 (0)