Skip to content

Commit c03c268

Browse files
committed
feat: eval script
1 parent 7a3eab9 commit c03c268

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed

tools/initvm.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
VMSSHPORT=2222
4+
5+
GIT_REPO=$(git rev-parse --show-toplevel)
6+
7+
DRIVE_PATH=$GIT_REPO/test/vm/disk.qcow2
8+
9+
qemu-system-x86_64 -enable-kvm -drive file=${DRIVE_PATH},format=qcow2 --nographic -net nic -net user,hostfwd=tcp::2222-:22 -cpu host -smp 16 -m 8G &
10+
11+
sleep 10
12+
ssh -p $VMSSHPORT root@localhost -C "apt-get install -y cloud-guest-utils"
13+
ssh -p $VMSSHPORT root@localhost -C "growpart /dev/sda 1"
14+
ssh -p $VMSSHPORT root@localhost -C "resize2fs /dev/sda1"
15+
16+
scp -P $VMSSHPORT ~/.ssh/* root@localhost:~/.ssh/

tools/prepvm.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
GIT_REPO=$(git rev-parse --show-toplevel)
4+
5+
mkdir -p $GIT_REPO/test/vm
6+
cd $GIT_REPO/test/vm
7+
8+
wget https://cdimage.debian.org/images/cloud/trixie/latest/debian-13-nocloud-amd64.qcow2 -O disk.qcow2
9+
10+
qemu-img resize disk.qcow2 +20G
11+
12+
# Run inside VM:
13+
# apt update; apt-get install -y openssh-server; echo 'PermitEmptyPasswords yes' >> /etc/ssh/sshd_config; echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config; systemctl restart sshd

tools/startkflex.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

tools/startvm.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ GIT_REPO=$(git rev-parse --show-toplevel)
44

55
KERNEL_PATH=$GIT_REPO/ePass-kernel
66

7-
DRIVE_PATH=$GIT_REPO/test/vm/ebpf.qcow2
7+
DRIVE_PATH=$GIT_REPO/test/vm/disk.qcow2
88

9-
# First enable bridge virbr0
10-
11-
qemu-system-x86_64 -enable-kvm -drive file=${DRIVE_PATH},format=qcow2 -kernel ${KERNEL_PATH}/arch/x86_64/boot/bzImage -append "root=/dev/sda1" --nographic -netdev bridge,id=net0,br=virbr0 -device virtio-net-pci,netdev=net0 -cpu host -smp $(nproc) -m 8G &
12-
13-
#qemu-system-x86_64 -enable-kvm -drive file=${DRIVE_PATH},format=qcow2 -kernel ${KERNEL_PATH}/arch/x86_64/boot/bzImage -append "root=/dev/sda1 console=ttyS0" --nographic -netdev bridge,id=net0,br=virbr0 -device virtio-net-pci,netdev=net0 -cpu host -smp $(nproc) -m 8G
9+
# screen -S epass -dm bash -c "qemu-system-x86_64 -enable-kvm -drive file=${DRIVE_PATH},format=qcow2 -kernel ${KERNEL_PATH}/arch/x86_64/boot/bzImage -append 'root=/dev/sda1' --nographic -net nic -net user,hostfwd=tcp::2222-:22 -cpu host -smp 16 -m 8G"
10+
qemu-system-x86_64 -enable-kvm -drive file=${DRIVE_PATH},format=qcow2 --nographic -net nic -net user,hostfwd=tcp::2222-:22 -cpu host -smp 16 -m 8G
11+
# qemu-system-x86_64 -enable-kvm -drive file=${DRIVE_PATH},format=qcow2 -kernel ${KERNEL_PATH}/arch/x86_64/boot/bzImage -append 'root=/dev/sda1' --nographic -net nic -net user,hostfwd=tcp::2222-:22 -cpu host -smp 16 -m 8G

0 commit comments

Comments
 (0)