diff --git a/sysutils/google-compute-engine/Makefile b/sysutils/google-compute-engine/Makefile new file mode 100644 index 00000000000..93395aabbac --- /dev/null +++ b/sysutils/google-compute-engine/Makefile @@ -0,0 +1,33 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +COMMENT = Google Cloud Platform (GCP) Compute Engine daemon + +MODPY_EGG_VERSION = 2.4.0 +DISTNAME = google-compute-engine-${MODPY_EGG_VERSION} + +GH_ACCOUNT = GoogleCloudPlatform +GH_PROJECT = compute-image-packages +GH_TAGNAME = 20170609 + +CATEGORIES = sysutils net + +MAINTAINER = Helen Koike + +# Apache 2.0 +PERMIT_PACKAGE_CDROM = Yes + +MODULES = lang/python + +MODPY_SETUPTOOLS = Yes + +RUN_DEPENDS = net/py-boto \ + net/py-netifaces \ + net/py-netaddr + +TEST_DEPENDS = ${RUN_DEPENDS} + +pre-configure: + cd ${WRKSRC}/google_compute_engine && ${SUBST_CMD} \ + config_manager.py instance_setup/instance_{config,setup}.py + +.include diff --git a/sysutils/google-compute-engine/distinfo b/sysutils/google-compute-engine/distinfo new file mode 100644 index 00000000000..2bb22176ac9 --- /dev/null +++ b/sysutils/google-compute-engine/distinfo @@ -0,0 +1,2 @@ +SHA256 (google-compute-engine-2.4.0.tar.gz) = Gjo4fh4mIESGBbFGrwe1LmJE7VOX30NkGllnlvuZBzA= +SIZE (google-compute-engine-2.4.0.tar.gz) = 105166 diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_accounts_accounts_daemon_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_accounts_accounts_daemon_py new file mode 100644 index 00000000000..bd52bfba7ed --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_accounts_accounts_daemon_py @@ -0,0 +1,14 @@ +$OpenBSD: patch-google_compute_engine_accounts_accounts_daemon_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/accounts/accounts_daemon.py +--- google_compute_engine/accounts/accounts_daemon.py.orig ++++ google_compute_engine/accounts/accounts_daemon.py +@@ -27,7 +27,7 @@ from google_compute_engine import logger + from google_compute_engine import metadata_watcher + from google_compute_engine.accounts import accounts_utils + +-LOCKFILE = '/var/lock/google_accounts.lock' ++LOCKFILE = '/var/spool/lock/google_accounts.lock' + + + class AccountsDaemon(object): diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_accounts_accounts_utils_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_accounts_accounts_utils_py new file mode 100644 index 00000000000..1a9b6881cca --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_accounts_accounts_utils_py @@ -0,0 +1,53 @@ +$OpenBSD: patch-google_compute_engine_accounts_accounts_utils_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/accounts/accounts_utils.py +--- google_compute_engine/accounts/accounts_utils.py.orig ++++ google_compute_engine/accounts/accounts_utils.py +@@ -43,7 +43,7 @@ class AccountsUtils(object): + """ + self.logger = logger + self.google_sudoers_group = 'google-sudoers' +- self.google_sudoers_file = '/etc/sudoers.d/google_sudoers' ++ self.google_sudoers_file = '/etc/doas.conf' + self.google_users_dir = '/var/lib/google' + self.google_users_file = os.path.join(self.google_users_dir, 'google_users') + +@@ -75,17 +75,18 @@ class AccountsUtils(object): + except subprocess.CalledProcessError as e: + self.logger.warning('Could not create the sudoers group. %s.', str(e)) + +- if not os.path.exists(self.google_sudoers_file): +- try: +- with open(self.google_sudoers_file, 'w') as group: +- message = '%{0} ALL=(ALL:ALL) NOPASSWD:ALL'.format( +- self.google_sudoers_group) +- group.write(message) +- except IOError as e: +- self.logger.error( +- 'Could not write sudoers file. %s. %s', +- self.google_sudoers_file, str(e)) +- return ++ try: ++ with open(self.google_sudoers_file, 'a+') as group: ++ group.seek(0) ++ message = 'permit nopass keepenv :{0}'.format( ++ self.google_sudoers_group) ++ if not any(message == x.rstrip('\r\n') for x in group): ++ group.write(message + '\n') ++ except IOError as e: ++ self.logger.error( ++ 'Could not write sudoers file. %s. %s', ++ self.google_sudoers_file, str(e)) ++ return + + file_utils.SetPermissions( + self.google_sudoers_file, mode=0o440, uid=0, gid=0) +@@ -126,7 +127,7 @@ class AccountsUtils(object): + # + # To solve the issue, make the password '*' which is also recognized + # as locked but does not prevent SSH login. +- command = ['useradd', '-m', '-s', '/bin/bash', '-p', '*', user] ++ command = ['useradd', '-m', user] + try: + subprocess.check_call(command) + except subprocess.CalledProcessError as e: diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_clock_skew_clock_skew_daemon_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_clock_skew_clock_skew_daemon_py new file mode 100644 index 00000000000..5be4ff9319b --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_clock_skew_clock_skew_daemon_py @@ -0,0 +1,29 @@ +$OpenBSD: patch-google_compute_engine_clock_skew_clock_skew_daemon_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/clock_skew/clock_skew_daemon.py +--- google_compute_engine/clock_skew/clock_skew_daemon.py.orig ++++ google_compute_engine/clock_skew/clock_skew_daemon.py +@@ -24,7 +24,7 @@ from google_compute_engine import file_utils + from google_compute_engine import logger + from google_compute_engine import metadata_watcher + +-LOCKFILE = '/var/lock/google_clock_skew.lock' ++LOCKFILE = '/var/spool/lock/google_clock_skew.lock' + + + class ClockSkewDaemon(object): +@@ -58,9 +58,12 @@ class ClockSkewDaemon(object): + response: string, the metadata response with the new drift token value. + """ + self.logger.info('Clock drift token has changed: %s.', response) +- command = ['/sbin/hwclock', '--hctosys'] ++ ++ ntpd_inactive = subprocess.call(['/etc/rc.d/ntpd', 'check']) + try: +- subprocess.check_call(command) ++ if not ntpd_inactive: subprocess.check_call(['/etc/rc.d/ntpd', 'stop']) ++ subprocess.check_call('rdate `awk \'$1=="servers" {print $2}\' /etc/ntpd.conf`', shell=True) ++ if not ntpd_inactive: subprocess.check_call(['/etc/rc.d/ntpd', 'start']) + except subprocess.CalledProcessError: + self.logger.warning('Failed to sync system time with hardware clock.') + else: diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_config_manager_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_config_manager_py new file mode 100644 index 00000000000..9cb8305bd03 --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_config_manager_py @@ -0,0 +1,23 @@ +$OpenBSD: patch-google_compute_engine_config_manager_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/config_manager.py +--- google_compute_engine/config_manager.py.orig ++++ google_compute_engine/config_manager.py +@@ -21,7 +21,7 @@ import textwrap + from google_compute_engine import file_utils + from google_compute_engine.compat import parser + +-CONFIG = '/etc/default/instance_configs.cfg' ++CONFIG = '${SYSCONFDIR}/instance_configs.cfg' + + + class ConfigManager(object): +@@ -101,7 +101,7 @@ class ConfigManager(object): + """ + config_file = config_file or self.config_file + config_name = os.path.splitext(os.path.basename(config_file))[0] +- config_lock = '/var/lock/google_%s.lock' % config_name ++ config_lock = '/var/spool/lock/google_%s.lock' % config_name + with file_utils.LockFile(config_lock): + with open(config_file, 'w') as config_fp: + if self.config_header: diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_instance_setup_instance_config_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_instance_setup_instance_config_py new file mode 100644 index 00000000000..455ba8acf36 --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_instance_setup_instance_config_py @@ -0,0 +1,48 @@ +$OpenBSD: patch-google_compute_engine_instance_setup_instance_config_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/instance_setup/instance_config.py +--- google_compute_engine/instance_setup/instance_config.py.orig ++++ google_compute_engine/instance_setup/instance_config.py +@@ -16,8 +16,8 @@ + """A library used to set up the instance's default configurations file. + + Note that the configurations in +-/etc/default/instance_configs.cfg.template override the values set in +-/etc/default/instance_configs.cfg. The system instance_configs.cfg may be ++${SYSCONFDIR}/instance_configs.cfg.template override the values set in ++${SYSCONFDIR}/instance_configs.cfg. The system instance_configs.cfg may be + overridden during package upgrade. + """ + +@@ -32,7 +32,7 @@ from google_compute_engine.compat import stringio + class InstanceConfig(config_manager.ConfigManager): + """Creates a defaults config file for instance configuration.""" + +- instance_config = '/etc/default/instance_configs.cfg' ++ instance_config = '${SYSCONFDIR}/instance_configs.cfg' + instance_config_distro = '%s.distro' % instance_config + instance_config_template = '%s.template' % instance_config + instance_config_script = os.path.abspath(__file__) +@@ -40,7 +40,7 @@ class InstanceConfig(config_manager.ConfigManager): + 'This file is automatically created at boot time by the %s script. Do ' + 'not edit this file directly. If you need to add items to this file, ' + 'create or edit %s instead and then run ' +- '/usr/bin/google_instance_setup.') ++ '${PREFIX}/bin/google_instance_setup.') + instance_config_options = { + 'Accounts': { + 'deprovision_remove': 'false', +@@ -55,11 +55,11 @@ class InstanceConfig(config_manager.ConfigManager): + 'instance_id': '0', + }, + 'InstanceSetup': { +- 'optimize_local_ssd': 'true', ++ 'optimize_local_ssd': 'false', + 'network_enabled': 'true', + 'set_boto_config': 'true', + 'set_host_keys': 'true', +- 'set_multiqueue': 'true', ++ 'set_multiqueue': 'false', + }, + 'IpForwarding': { + 'ethernet_proto_id': '66', diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_instance_setup_instance_setup_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_instance_setup_instance_setup_py new file mode 100644 index 00000000000..9d90d119499 --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_instance_setup_instance_setup_py @@ -0,0 +1,26 @@ +$OpenBSD: patch-google_compute_engine_instance_setup_instance_setup_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/instance_setup/instance_setup.py +--- google_compute_engine/instance_setup/instance_setup.py.orig ++++ google_compute_engine/instance_setup/instance_setup.py +@@ -142,17 +142,9 @@ class InstanceSetup(object): + def _StartSshd(self): + """Initialize the SSH daemon.""" + # Exit as early as possible. +- # Instance setup systemd scripts block sshd from starting. +- if os.path.exists('/bin/systemctl'): +- return +- elif (os.path.exists('/etc/init.d/ssh') or +- os.path.exists('/etc/init/ssh.conf')): +- subprocess.call(['service', 'ssh', 'start']) +- subprocess.call(['service', 'ssh', 'reload']) +- elif (os.path.exists('/etc/init.d/sshd') or +- os.path.exists('/etc/init/sshd.conf')): +- subprocess.call(['service', 'sshd', 'start']) +- subprocess.call(['service', 'sshd', 'reload']) ++ if (os.path.exists('/etc/rc.d/sshd')): ++ subprocess.call(['/etc/rc.d/sshd', 'start']) ++ subprocess.call(['/etc/rc.d/sshd', 'reload']) + + def _SetSshHostKeys(self): + """Regenerates SSH host keys when the VM is restarted with a new IP address. diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_ip_forwarding_ip_forwarding_daemon_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_ip_forwarding_ip_forwarding_daemon_py new file mode 100644 index 00000000000..4980440106f --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_ip_forwarding_ip_forwarding_daemon_py @@ -0,0 +1,35 @@ +$OpenBSD: patch-google_compute_engine_ip_forwarding_ip_forwarding_daemon_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/ip_forwarding/ip_forwarding_daemon.py +--- google_compute_engine/ip_forwarding/ip_forwarding_daemon.py.orig ++++ google_compute_engine/ip_forwarding/ip_forwarding_daemon.py +@@ -38,7 +38,7 @@ from google_compute_engine import network_utils + + from google_compute_engine.ip_forwarding import ip_forwarding_utils + +-LOCKFILE = '/var/lock/google_ip_forwarding.lock' ++LOCKFILE = '/var/spool/lock/google_ip_forwarding.lock' + + + class IpForwardingDaemon(object): +@@ -131,18 +131,18 @@ class IpForwardingDaemon(object): + Args: + result: dict, the metadata response with the new network interfaces. + """ ++ ip_addresses = [] + for network_interface in result: + mac_address = network_interface.get('mac') + interface = self.network_utils.GetNetworkInterface(mac_address) +- ip_addresses = [] + if interface: + ip_addresses.extend(network_interface.get('forwardedIps', [])) + if self.ip_aliases: + ip_addresses.extend(network_interface.get('ipAliases', [])) +- self._HandleForwardedIps(ip_addresses, interface) + else: + message = 'Network interface not found for MAC address: %s.' + self.logger.warning(message, mac_address) ++ self._HandleForwardedIps(ip_addresses, 'lo' + self.ip_forwarding_utils.proto_id) + + + def main(): diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_ip_forwarding_ip_forwarding_utils_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_ip_forwarding_ip_forwarding_utils_py new file mode 100644 index 00000000000..6384c3881cb --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_ip_forwarding_ip_forwarding_utils_py @@ -0,0 +1,82 @@ +$OpenBSD: patch-google_compute_engine_ip_forwarding_ip_forwarding_utils_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/ip_forwarding/ip_forwarding_utils.py +--- google_compute_engine/ip_forwarding/ip_forwarding_utils.py.orig ++++ google_compute_engine/ip_forwarding/ip_forwarding_utils.py +@@ -17,6 +17,8 @@ + + import re + import subprocess ++import netifaces ++import netaddr + + IP_REGEX = re.compile(r'\A(\d{1,3}\.){3}\d{1,3}\Z') + IP_ALIAS_REGEX = re.compile(r'\A(\d{1,3}\.){3}\d{1,3}/\d{1,2}\Z') +@@ -51,8 +53,8 @@ class IpForwardingUtils(object): + options.update(kwargs) + return options + +- def _RunIpRoute(self, args=None, options=None): +- """Run a command with ip route and return the response. ++ def _RunIfconfig(self, args=None, options=None): ++ """Run a command with ifconfig and return the response. + + Args: + args: list, the string ip route command args to execute. +@@ -63,7 +65,7 @@ class IpForwardingUtils(object): + """ + args = args or [] + options = options or {} +- command = ['ip', 'route'] ++ command = ['ifconfig'] + command.extend(args) + for item in options.items(): + command.extend(item) +@@ -108,10 +110,17 @@ class IpForwardingUtils(object): + Returns: + list, the IP address strings. + """ +- args = ['ls', 'table', 'local', 'type', 'local'] +- options = self._CreateRouteOptions(dev=interface) +- result = self._RunIpRoute(args=args, options=options) +- return self.ParseForwardedIps(result.split()) ++ try: ++ ips = netifaces.ifaddresses('lo' + self.proto_id) ++ ips = ips[netifaces.AF_INET] ++ except (ValueError, KeyError) as e: ++ return [] ++ forwarded_ips = [] ++ for ip in ips: ++ netmask = int(subprocess.check_output("ifconfig lo%s | grep %s | awk '{printf $NF}'" % ++ (self.proto_id, ip['addr']), shell=True), 16) ++ forwarded_ips.append(ip['addr'] + '/' + str(netaddr.IPAddress(netmask).netmask_bits())) ++ return self.ParseForwardedIps(forwarded_ips) + + def AddForwardedIp(self, address, interface): + """Configure a new IP address on the network interface. +@@ -121,9 +130,12 @@ class IpForwardingUtils(object): + interface: string, the output device to use. + """ + address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address +- args = ['add', 'to', 'local', address] +- options = self._CreateRouteOptions(dev=interface) +- self._RunIpRoute(args=args, options=options) ++ cmd = 'alias' ++ try: ++ forwarded_ips = netifaces.ifaddresses(interface) ++ except (ValueError, KeyError) as e: ++ cmd = 'create' ++ self._RunIfconfig(args=[interface, cmd, address]) + + def RemoveForwardedIp(self, address, interface): + """Delete an IP address on the network interface. +@@ -132,7 +144,5 @@ class IpForwardingUtils(object): + address: string, the IP address to configure. + interface: string, the output device to use. + """ +- address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address +- args = ['delete', 'to', 'local', address] +- options = self._CreateRouteOptions(dev=interface) +- self._RunIpRoute(args=args, options=options) ++ address = address if IP_REGEX.match(address) else address[:-3] ++ self._RunIfconfig(args=[interface, '-alias', address]) diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_metadata_scripts_script_executor_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_metadata_scripts_script_executor_py new file mode 100644 index 00000000000..7e8aada5a19 --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_metadata_scripts_script_executor_py @@ -0,0 +1,14 @@ +$OpenBSD: patch-google_compute_engine_metadata_scripts_script_executor_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/metadata_scripts/script_executor.py +--- google_compute_engine/metadata_scripts/script_executor.py.orig ++++ google_compute_engine/metadata_scripts/script_executor.py +@@ -50,7 +50,7 @@ class ScriptExecutor(object): + metadata_script: string, the file location of an executable script. + """ + process = subprocess.Popen( +- metadata_script, shell=True, executable='/bin/bash', ++ metadata_script, shell=True, executable='/bin/ksh', + stderr=subprocess.STDOUT, stdout=subprocess.PIPE) + while True: + for line in iter(process.stdout.readline, b''): diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_network_setup_network_setup_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_network_setup_network_setup_py new file mode 100644 index 00000000000..6a38ba5da4e --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_network_setup_network_setup_py @@ -0,0 +1,30 @@ +$OpenBSD: patch-google_compute_engine_network_setup_network_setup_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/network_setup/network_setup.py +--- google_compute_engine/network_setup/network_setup.py.orig ++++ google_compute_engine/network_setup/network_setup.py +@@ -106,12 +106,18 @@ class NetworkSetup(object): + self.logger.info('Enabling the Ethernet interfaces %s.', interfaces) + dhclient_command = ['dhclient'] + if os.path.exists(self.dhclient_script): +- dhclient_command += ['-sf', self.dhclient_script] +- try: +- subprocess.check_call(dhclient_command + ['-x'] + interfaces) +- subprocess.check_call(dhclient_command + interfaces) +- except subprocess.CalledProcessError: +- self.logger.warning('Could not enable interfaces %s.', interfaces) ++ dhclient_conf = '/etc/dhclient.conf' ++ if os.path.exists(dhclient_conf): ++ subprocess.call('sed -i "/^script/d" ' + dhclient_conf, shell=True) ++ subprocess.call('echo \'script "%s";\' >> %s' % (self.dhclient_script, dhclient_conf), shell=True) ++ for interface in interfaces: ++ try: ++ subprocess.check_call(['ifconfig', interface, 'down', 'delete']) ++ # wait previous dhclient to exit ++ subprocess.check_call(['sleep', '3']) ++ subprocess.check_call(dhclient_command + [interface]) ++ except subprocess.CalledProcessError: ++ self.logger.warning('Could not enable interface %s.', interface) + + def _EnableNetworkInterfaces(self, interfaces): + """Enable the list of network interfaces. diff --git a/sysutils/google-compute-engine/patches/patch-google_compute_engine_network_utils_py b/sysutils/google-compute-engine/patches/patch-google_compute_engine_network_utils_py new file mode 100644 index 00000000000..99b643339b1 --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-google_compute_engine_network_utils_py @@ -0,0 +1,30 @@ +$OpenBSD: patch-google_compute_engine_network_utils_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: google_compute_engine/network_utils.py +--- google_compute_engine/network_utils.py.orig ++++ google_compute_engine/network_utils.py +@@ -17,6 +17,7 @@ + + import logging + import os ++import netifaces + + + class NetworkUtils(object): +@@ -38,11 +39,12 @@ class NetworkUtils(object): + dict, string MAC addresses mapped to the string network interface name. + """ + interfaces = {} +- for interface in os.listdir('/sys/class/net'): ++ for interface in netifaces.interfaces(): + try: +- mac_address = open( +- '/sys/class/net/%s/address' % interface).read().strip() +- except (IOError, OSError) as e: ++ mac_address = netifaces.ifaddresses(interface)[netifaces.AF_LINK][0]['addr'] ++ if mac_address == interface: ++ raise Exception('No MAC Address') ++ except Exception, e: + message = 'Unable to determine MAC address for %s. %s.' + self.logger.warning(message, interface, str(e)) + else: diff --git a/sysutils/google-compute-engine/patches/patch-setup_py b/sysutils/google-compute-engine/patches/patch-setup_py new file mode 100644 index 00000000000..fc19d0f4f60 --- /dev/null +++ b/sysutils/google-compute-engine/patches/patch-setup_py @@ -0,0 +1,13 @@ +$OpenBSD: patch-setup_py,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +Index: setup.py +--- setup.py.orig ++++ setup.py +@@ -30,7 +30,6 @@ setuptools.setup( + long_description='Google Compute Engine guest environment.', + name='google-compute-engine', + packages=setuptools.find_packages(), +- scripts=glob.glob('scripts/*'), + url='https://github.com/GoogleCloudPlatform/compute-image-packages', + version='2.4.0', + # Entry points create scripts in /usr/bin that call a function. diff --git a/sysutils/google-compute-engine/pkg/DESCR b/sysutils/google-compute-engine/pkg/DESCR new file mode 100644 index 00000000000..8a5a2f6c0e0 --- /dev/null +++ b/sysutils/google-compute-engine/pkg/DESCR @@ -0,0 +1,12 @@ +Google Compute Engine offers scripts and daemons which runs in the +background and provides the following services: + +- Accounts daemon to setup and manage user accounts, and to enable SSH key based + authentication. +- Clock skew daemon to keep the system clock in sync after VM start and stop + events. +- Instance setup scripts to execute VM configuration scripts during boot. +- IP forwarding daemon that integrates network load balancing with forwarding + rule changes into the guest. +- Metadata scripts to run user provided scripts at VM startup and shutdown. +- Network setup service to enable multiple network interfaces on boot. diff --git a/sysutils/google-compute-engine/pkg/PLIST b/sysutils/google-compute-engine/pkg/PLIST new file mode 100644 index 00000000000..3317bdb31ac --- /dev/null +++ b/sysutils/google-compute-engine/pkg/PLIST @@ -0,0 +1,83 @@ +@comment $OpenBSD: PLIST,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ +bin/google_accounts_daemon +bin/google_clock_skew_daemon +bin/google_instance_setup +bin/google_ip_forwarding_daemon +bin/google_metadata_script_runner +bin/google_network_setup +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/ +lib/python${MODPY_VERSION}/site-packages/google_compute_engine-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/ +lib/python${MODPY_VERSION}/site-packages/google_compute_engine-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/PKG-INFO +lib/python${MODPY_VERSION}/site-packages/google_compute_engine-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/SOURCES.txt +lib/python${MODPY_VERSION}/site-packages/google_compute_engine-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/dependency_links.txt +lib/python${MODPY_VERSION}/site-packages/google_compute_engine-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/entry_points.txt +lib/python${MODPY_VERSION}/site-packages/google_compute_engine-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/requires.txt +lib/python${MODPY_VERSION}/site-packages/google_compute_engine-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/top_level.txt +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/__init__.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/__init__.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/accounts/ +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/accounts/__init__.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/accounts/__init__.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/accounts/accounts_daemon.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/accounts/accounts_daemon.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/accounts/accounts_utils.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/accounts/accounts_utils.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/boto/ +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/boto/__init__.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/boto/__init__.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/boto/boto_config.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/boto/boto_config.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/boto/compute_auth.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/boto/compute_auth.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/clock_skew/ +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/clock_skew/__init__.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/clock_skew/__init__.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/clock_skew/clock_skew_daemon.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/clock_skew/clock_skew_daemon.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/compat.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/compat.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/config_manager.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/config_manager.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/file_utils.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/file_utils.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/instance_setup/ +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/instance_setup/__init__.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/instance_setup/__init__.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/instance_setup/instance_config.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/instance_setup/instance_config.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/instance_setup/instance_setup.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/instance_setup/instance_setup.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/ip_forwarding/ +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/ip_forwarding/__init__.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/ip_forwarding/__init__.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/ip_forwarding/ip_forwarding_daemon.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/ip_forwarding/ip_forwarding_daemon.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/ip_forwarding/ip_forwarding_utils.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/ip_forwarding/ip_forwarding_utils.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/logger.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/logger.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_scripts/ +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_scripts/__init__.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_scripts/__init__.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_scripts/script_executor.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_scripts/script_executor.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_scripts/script_manager.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_scripts/script_manager.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_scripts/script_retriever.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_scripts/script_retriever.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_watcher.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/metadata_watcher.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/network_setup/ +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/network_setup/__init__.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/network_setup/__init__.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/network_setup/network_setup.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/network_setup/network_setup.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/network_utils.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/network_utils.pyc +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/test_compat.py +lib/python${MODPY_VERSION}/site-packages/google_compute_engine/test_compat.pyc +share/doc/pkg-readmes/${FULLPKGNAME} +@rcscript ${RCDIR}/google_accounts_daemon +@rcscript ${RCDIR}/google_clock_skew_daemon +@rcscript ${RCDIR}/google_ip_forwarding_daemon +@rcscript ${RCDIR}/google_compute_engine diff --git a/sysutils/google-compute-engine/pkg/README b/sysutils/google-compute-engine/pkg/README new file mode 100644 index 00000000000..3a5108aa3e6 --- /dev/null +++ b/sysutils/google-compute-engine/pkg/README @@ -0,0 +1,13 @@ +$OpenBSD: README,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + ++------------------------------------------------------------------------------- +| Running ${FULLPKGNAME} on OpenBSD ++------------------------------------------------------------------------------- + +Configuring google_compute_engine scripts to run at boot +======================================================== + +The rc.d(8) scripts are not enabled by default, you can enable them using the +following command as root: + + rcctl enable google_compute_engine diff --git a/sysutils/google-compute-engine/pkg/google_accounts_daemon.rc b/sysutils/google-compute-engine/pkg/google_accounts_daemon.rc new file mode 100644 index 00000000000..aa8b329f4c0 --- /dev/null +++ b/sysutils/google-compute-engine/pkg/google_accounts_daemon.rc @@ -0,0 +1,12 @@ +#!/bin/sh +# +# $OpenBSD: google_accounts_daemon.rc,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +daemon="${MODPY_BIN} ${TRUEPREFIX}/bin/google_accounts_daemon" + +. /etc/rc.d/rc.subr + +rc_bg=YES +rc_reload=NO + +rc_cmd $1 diff --git a/sysutils/google-compute-engine/pkg/google_clock_skew_daemon.rc b/sysutils/google-compute-engine/pkg/google_clock_skew_daemon.rc new file mode 100644 index 00000000000..f310faf3ac2 --- /dev/null +++ b/sysutils/google-compute-engine/pkg/google_clock_skew_daemon.rc @@ -0,0 +1,12 @@ +#!/bin/sh +# +# $OpenBSD: google_clock_skew_daemon.rc,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +daemon="${MODPY_BIN} ${TRUEPREFIX}/bin/google_clock_skew_daemon" + +. /etc/rc.d/rc.subr + +rc_bg=YES +rc_reload=NO + +rc_cmd $1 diff --git a/sysutils/google-compute-engine/pkg/google_compute_engine.rc b/sysutils/google-compute-engine/pkg/google_compute_engine.rc new file mode 100644 index 00000000000..d6e37f6863b --- /dev/null +++ b/sysutils/google-compute-engine/pkg/google_compute_engine.rc @@ -0,0 +1,33 @@ +#!/bin/sh +# +# $OpenBSD: google_compute_engine.rc,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +# "meta" script running the following rc.d(8) scripts with the given argument; +# note that daemon_flags, daemon_user, daemon_timeout and daemon_class are not +# passed to the child scripts. +_pkg_scripts="google_accounts_daemon google_clock_skew_daemon google_ip_forwarding_daemon" + +if [ "$1" = restart ]; then + $0 stop && $0 start + exit +fi + +if [ "$1" = stop ]; then + for _i in ${_pkg_scripts}; do _l="${_i} ${_l}"; done + _pkg_scripts=${_l% } + ${MODPY_BIN} ${TRUEPREFIX}/bin/google_metadata_script_runner \ + --script-type=shutdown || exit +fi + +if [ "$1" = start ]; then + ${MODPY_BIN} ${TRUEPREFIX}/bin/google_instance_setup || exit + ${MODPY_BIN} ${TRUEPREFIX}/bin/google_network_setup || exit + ${MODPY_BIN} ${TRUEPREFIX}/bin/google_metadata_script_runner \ + --script-type=startup || exit +fi + +for _i in ${_pkg_scripts}; do + if [[ -x ${RCDIR}/${_i} ]]; then + ${RCDIR}/${_i} $@ || exit $? + fi +done diff --git a/sysutils/google-compute-engine/pkg/google_ip_forwarding_daemon.rc b/sysutils/google-compute-engine/pkg/google_ip_forwarding_daemon.rc new file mode 100644 index 00000000000..d431a4baa46 --- /dev/null +++ b/sysutils/google-compute-engine/pkg/google_ip_forwarding_daemon.rc @@ -0,0 +1,12 @@ +#!/bin/sh +# +# $OpenBSD: google_ip_forwarding_daemon.rc,v 1.1.1.1 2017/06/29 14:35:10 ajacoutot Exp $ + +daemon="${MODPY_BIN} ${TRUEPREFIX}/bin/google_ip_forwarding_daemon" + +. /etc/rc.d/rc.subr + +rc_bg=YES +rc_reload=NO + +rc_cmd $1