#!/usr/bin/env sh set -xeo pipefail # Install one-context wget https://github.com/OpenNebula/addon-context-linux/releases/download/v5.8.0/one-context-5.8.0-r1.apk apk add --allow-untrusted --no-cache one-context-5.8.0-r1.apk apk add --no-cache e2fsprogs-extra apk add --no-cache haveged # Enable VM contextualization rc-update add one-context default rc-update add haveged boot rc-status # Add DNS hook in one-context mkdir -p /usr/local/share/one-context/scripts cat > /usr/local/share/one-context/scripts/dns-nebula <<'EOF' #!/bin/sh . /usr/share/one-context/scripts/utils.sh dns_servers="$(getval ETH0_DNS)" echo > /etc/resolv.conf for nameserver_address in $dns_servers; do echo "nameserver $nameserver_address" >> /etc/resolv.conf done EOF chmod +x /usr/local/share/one-context/scripts/dns-nebula ln -s /usr/local/share/one-context/scripts/dns-nebula /etc/one-context.d/01-dns-nebula # Reset network interfaces cat > /etc/network/interfaces <> /etc/udhcpc/udhcpc.conf # Clean up rm -rf /root/*.apk sync