diff --git a/APKBUILD b/APKBUILD index 56e57e0..b296817 100644 --- a/APKBUILD +++ b/APKBUILD @@ -1,7 +1,7 @@ # Contributor: Disassembler # Maintainer: Disassembler pkgname=spoc -pkgver=0.9.2 +pkgver=0.9.3 pkgrel=0 pkgdesc="SPOC application, container, and image manager" url="https://spotter.vm/" diff --git a/etc/spoc/spoc.conf b/etc/spoc/spoc.conf index b9c1b33..380e35b 100644 --- a/etc/spoc/spoc.conf +++ b/etc/spoc/spoc.conf @@ -2,6 +2,7 @@ data-dir = /var/lib/spoc/ log-dir = /var/log/spoc/ network-interface = spocbr0 +resolv-conf = /etc/resolv.conf [publish] publish-dir = /srv/build/spoc/ diff --git a/usr/lib/python3.8/spoc/config.py b/usr/lib/python3.8/spoc/config.py index 365fe09..3a8f626 100644 --- a/usr/lib/python3.8/spoc/config.py +++ b/usr/lib/python3.8/spoc/config.py @@ -10,6 +10,7 @@ config = configparser.ConfigParser() config.read(CONFIG_FILE) NETWORK_INTERFACE = config.get('general', 'network-interface', fallback='spocbr0') +RESOLV_CONF = config.get('general', 'resolv-conf', fallback='/etc/resolv.conf') DATA_DIR = config.get('general', 'data-dir', fallback='/var/lib/spoc/') APPS_DIR = os.path.join(DATA_DIR, 'apps/') diff --git a/usr/lib/python3.8/spoc/container.py b/usr/lib/python3.8/spoc/container.py index b42faee..6bf1b6a 100644 --- a/usr/lib/python3.8/spoc/container.py +++ b/usr/lib/python3.8/spoc/container.py @@ -146,7 +146,22 @@ class Container: ip_address, ip_netmask, ip_gateway = net.request_ip(self.name) # Write LXC configuration file with open(self.config_path, 'w') as f: - f.write(templates.LXC_CONTAINER_TEMPLATE.format(name=self.name, ip_address=ip_address, ip_netmask=ip_netmask, ip_gateway=ip_gateway, rootfs=self.rootfs_path, hosts=config.HOSTS_FILE, mounts=mounts, env=env, uid=uid, gid=gid, cmd=cmd, cwd=cwd, halt=halt, log=self.log_path)) + f.write(templates.LXC_CONTAINER_TEMPLATE.format(name=self.name, + interface=config.NETWORK_INTERFACE, + resolv_conf=config.RESOLV_CONF, + ip_address=ip_address, + ip_netmask=ip_netmask, + ip_gateway=ip_gateway, + rootfs=self.rootfs_path, + hosts=config.HOSTS_FILE, + mounts=mounts, + env=env, + uid=uid, + gid=gid, + cmd=cmd, + cwd=cwd, + halt=halt, + log=self.log_path)) repo_local.register_container(self.name, self.get_definition()) def destroy(self): diff --git a/usr/lib/python3.8/spoc/templates.py b/usr/lib/python3.8/spoc/templates.py index 7e9e745..34634ee 100644 --- a/usr/lib/python3.8/spoc/templates.py +++ b/usr/lib/python3.8/spoc/templates.py @@ -5,7 +5,7 @@ lxc.uts.name = {name} # Network lxc.net.0.type = veth -lxc.net.0.link = spocbr0 +lxc.net.0.link = {interface} lxc.net.0.flags = up lxc.net.0.ipv4.address = {ip_address}/{ip_netmask} lxc.net.0.ipv4.gateway = {ip_gateway} @@ -15,7 +15,7 @@ lxc.rootfs.path = {rootfs} # Mounts lxc.mount.entry = shm dev/shm tmpfs rw,nodev,noexec,nosuid,relatime,mode=1777,create=dir 0 0 -lxc.mount.entry = /etc/resolv.conf etc/resolv.conf none bind,ro,create=file 0 0 +lxc.mount.entry = {resolv_conf} etc/resolv.conf none bind,ro,create=file 0 0 lxc.mount.entry = {hosts} etc/hosts none bind,ro,create=file 0 0 {mounts}