echo "Starting sysfs and networking"
rc-service sysfs start
rc-service udev start
rc-service haveged start

# Set up network interface
# Note: remove this section to disable external networking
echo "Setting up eth0"
ifconfig eth0 up
echo "Setting up IP address"
ip addr add dev eth0 GW_IPMASK_SHORT
echo "Setting up default gateway"
ip route add default via TAP_IP
echo "Setting up eth0"
ip link set eth0 up
echo "Enable packet forwarding for internet access"
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "Start networking"
rc-service networking start

# run the code in the microvm
# the firecracker compiler will place the code here
{{ entrypoint }}

# # shutdown the microvm
reboot
