summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam Hopkins <liamh@google.com>2020-04-29 09:38:44 -0700
committerGitHub <noreply@github.com>2020-04-29 09:38:44 -0700
commitac9cd8f0b1cb0c55b1821d54fab78dc8707ea794 (patch)
treeb2990c9191e486d3e0881d269bf00835ed95bcc9
parent4dcd267dfa76d960d1e511abb242690b1c43b128 (diff)
downloadgoogle-compute-image-packages-ac9cd8f0b1cb0c55b1821d54fab78dc8707ea794.tar.gz
move GCE to guest-configs, deprecate python (#887)
-rw-r--r--README.md124
-rw-r--r--packages/google-compute-engine/README.md4
-rw-r--r--packages/google-compute-engine/packaging/debian/changelog260
-rw-r--r--packages/google-compute-engine/packaging/debian/compat1
-rw-r--r--packages/google-compute-engine/packaging/debian/control35
-rw-r--r--packages/google-compute-engine/packaging/debian/copyright27
-rw-r--r--packages/google-compute-engine/packaging/debian/google-compute-engine.links1
-rw-r--r--packages/google-compute-engine/packaging/debian/install6
-rwxr-xr-xpackages/google-compute-engine/packaging/debian/preinst30
-rwxr-xr-xpackages/google-compute-engine/packaging/debian/rules7
-rw-r--r--packages/google-compute-engine/packaging/debian/source/format1
-rw-r--r--packages/google-compute-engine/packaging/google-compute-engine.el6.spec70
-rw-r--r--packages/google-compute-engine/packaging/google-compute-engine.spec75
-rwxr-xr-xpackages/google-compute-engine/packaging/setup_deb.sh43
-rwxr-xr-xpackages/google-compute-engine/packaging/setup_rpm.sh43
-rw-r--r--packages/google-compute-engine/src/etc/apt/apt.conf.d/01autoremove-gce10
-rw-r--r--packages/google-compute-engine/src/etc/apt/apt.conf.d/99ipv4-only2
-rwxr-xr-xpackages/google-compute-engine/src/etc/dhcp/dhclient.d/google_hostname.sh21
-rw-r--r--packages/google-compute-engine/src/etc/modprobe.d/gce-blacklist.conf5
-rw-r--r--packages/google-compute-engine/src/etc/rsyslog.d/90-google.conf6
-rw-r--r--packages/google-compute-engine/src/etc/sysctl.d/11-gce-network-security.conf61
-rw-r--r--packages/google-compute-engine/src/lib/udev/rules.d/64-gce-disk-removal.rules17
-rw-r--r--packages/google-compute-engine/src/lib/udev/rules.d/65-gce-disk-naming.rules38
-rwxr-xr-xpackages/google-compute-engine/src/usr/bin/google_optimize_local_ssd95
-rwxr-xr-xpackages/google-compute-engine/src/usr/bin/google_set_hostname60
-rwxr-xr-xpackages/google-compute-engine/src/usr/bin/google_set_multiqueue160
-rwxr-xr-xpackages/google-compute-engine/src/usr/sbin/google-dhclient-script806
27 files changed, 27 insertions, 1981 deletions
diff --git a/README.md b/README.md
index a8d427f..10d2043 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,14 @@
## Linux Guest Environment for Google Compute Engine
-[![Build Status](https://travis-ci.org/GoogleCloudPlatform/compute-image-packages.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/compute-image-packages) [![codecov](https://codecov.io/gh/GoogleCloudPlatform/compute-image-packages/branch/master/graph/badge.svg)](https://codecov.io/gh/GoogleCloudPlatform/compute-image-packages)
-
-This repository stores the collection of packages installed on Google supported
-Compute Engine [images](https://cloud.google.com/compute/docs/images).
+This repository historically stored the collection of packages installed on
+Google supported Compute Engine [images](https://cloud.google.com/compute/docs/images).
+Documentation here summarizes these packages and points to new locations for
+various software components.
**Table of Contents**
* [Background](#background)
* [Packaging](#packaging)
- * [Version Updates](#version-updates)
* [Package Distribution](#package-distribution)
* [Troubleshooting](#troubleshooting)
* [Contributing](#contributing)
@@ -17,7 +16,7 @@ Compute Engine [images](https://cloud.google.com/compute/docs/images).
## Background
-The Linux guest environment denotes the Google provided configuration and
+The Linux guest environment comprises the Google provided configuration and
tooling inside of a [Google Compute Engine](https://cloud.google.com/compute/)
(GCE) virtual machine. The
[metadata server](https://cloud.google.com/compute/docs/metadata) is a
@@ -28,80 +27,34 @@ machine run properly on our platform.
## Packaging
-The guest Python code is packaged as a
-[compliant PyPI Python package](https://packaging.python.org/)
-that can be used as a library or run independently. In addition to the Python
-package, deb and rpm packages are created with appropriate init configuration
-for supported GCE distros. The packages are targeted towards distribution
-provided Python versions.
-
-Distro | Package Type | Python Version | Init System
------------- | ------------ | -------------- | -----------
-SLES 12 | rpm | 2.7 | systemd
-SLES 15 | rpm | 3.6 | systemd
-CentOS 6 | rpm | 2.6 | upstart
-CentOS 7 | rpm | 2.7 | systemd
-CentOS 8 | rpm | 3.6 | systemd
-RHEL 6 | rpm | 2.6 | upstart
-RHEL 7 | rpm | 2.7 | systemd
-RHEL 8 | rpm | 3.6 | systemd
-Ubuntu 14.04 | deb | 2.7 | upstart
-Ubuntu 16.04 | deb | 3.5 or 2.7 | systemd
-Ubuntu 18.04 | deb | 3.6 | systemd
-Ubuntu 19.04 | deb | 3.7 | systemd
-Debian 9 | deb | 3.5 or 2.7 | systemd
-Debian 10 | deb | 3.7 | systemd
-
We build the following packages for the Linux guest environment.
-* `google-compute-engine`
+* `google-compute-engine`(located in the [guest-configs](https://github.com/GoogleCloudPlatform/guest-configs) repo)
* System init scripts (systemd, upstart, or sysvinit).
* Includes udev rules, sysctl rules, rsyslog configs, dhcp configs for
hostname setting.
- * Entry point scripts created by the Python package located in `/usr/bin`.
- * Includes bash scripts used by `instance_setup`.
-* `python-google-compute-engine`
- * The Python 2 package for Linux daemons and libraries.
-* `python3-google-compute-engine`
- * The Python 3 package for Linux daemons and libraries.
-* `google-compute-engine-oslogin`
+ * Includes bash scripts used during instance setup.
+ * This package depends on the other necessary packages, and can be used as
+ an entry point to [install the guest environment](https://cloud.google.com/compute/docs/images/install-guest-environment).
+* `google-compute-engine-oslogin`(located in the [guest-oslogin](https://github.com/GoogleCloudPlatform/guest-oslogin) repo)
* The PAM and NSS modules for [OS Login](https://cloud.google.com/compute/docs/oslogin/)
+* `google-guest-agent`(located in the [guest-agent](https://github.com/GoogleCloudPlatform/guest-agent) repo)
+ * The guest agent which performs all on-guest actions needed to support GCE
+ features.
* `gce-disk-expand`
* The on-boot resize scripts for root partition.
-The package sources (RPM spec files and Debian packaging directories) are also
-included in this project. There are also [Daisy](https://github.com/GoogleCloudPlatform/compute-image-tools/tree/master/daisy)
-workflows for spinning up GCE VM's to automatically build the packages for
-Debian, Red Hat, and CentOS. See the [README](packaging/README.md) in the
-packaging directory for more details.
-
-#### Version Updates
-
-Versions are described as 1:YYYYMMDD.NN-gN, meaning epoch 1 to denote from a
-distro maintained package which will be 0, a date string formatted as year,
-month, day, an incrementing minor release, and gN representing the Google
-package release. Debian, Ubuntu, and SUSE maintain distro packages which may be
-out of date, have different versioning, or naming.
-
-The method for making version updates differs by package.
-
-* All packages need the `VERSION` variable set in the `setup_{deb,rpm}.sh` build
- scripts.
-* All packages need the `debian/changelog` file updated. Please use `dch(1)` to
- update it.
-* `python-google-compute-engine` additionally needs the version specified in
- `setup.py`. This is used for entry points through the Python egg and PyPI.
-* `google-compute-engine-oslogin` needs the version also updated in the
- `Makefile`.
+The legacy [guest Python code](packages/python-google-compute-engine) is
+packaged as a [compliant PyPI Python package](https://packaging.python.org/)
+that can be used as a library or run independently.
#### Package Distribution
The deb and rpm packages are published to Google Cloud repositories. Debian,
CentOS, and RHEL use these repositories to install and update the
`google-compute-engine`, `google-compute-engine-oslogin` and
-`python-google-compute-engine` (and `python3-google-compute-engine` for Python
-3) packages. If you are creating a custom image, you can also use these
-repositories in your image.
+`google-guest-agent` packages. If you are creating a custom image, you can also
+use these repositories in your image.
**For Debian, run the following commands as root:**
@@ -147,14 +100,14 @@ EOM
You are then able to install any of the packages from this repo.
-## Troubleshooting
-
-**Deprecated Packages**
+## Deprecated packages
Deprecated Package | Replacement
------------------------------------ | ---------------------------------------------------------
-`google-compute-engine-jessie` | `google-compute-engine` and `python-google-compute-engine`
-`google-compute-engine-stretch` | `google-compute-engine` and `python-google-compute-engine`
+ `python-google-compute-engine` | `google-guest-agent`
+ `python3-google-compute-engine` | `google-guest-agent`
+`google-compute-engine-jessie` | `google-compute-engine`
+`google-compute-engine-stretch` | `google-compute-engine`
`google-compute-engine-init` | `google-compute-engine`
`google-compute-engine-init-jessie` | `google-compute-engine`
`google-compute-engine-init-stretch` | `google-compute-engine`
@@ -164,37 +117,6 @@ Deprecated Package | Replacement
`google-compute-daemon` | `python-google-compute-engine`
`google-startup-scripts` | `google-compute-engine`
-**An old CentOS 6 image fails to install the packages with an error on SCL**
-
-CentOS 6 images prior to `v20160526` may fail to install the package with
-the error:
-```
-http://mirror.centos.org/centos/6/SCL/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
-```
-
-Remove the stale repository file:
-`sudo rm -f /etc/yum.repos.d/CentOS-SCL.repo`
-
-**On some CentOS or RHEL 6 systems, extraneous python egg directories can cause
-the python daemons to fail.**
-
-In `/usr/lib/python2.6/site-packages` look for
-`google_compute_engine-2.4.1-py27.egg-info` directories and
-`google_compute_engine-2.5.2.egg-info` directories and delete them if you run
-into this problem.
-
-**Using boto with virtualenv**
-
-Specific to running `boto` inside of a Python
-[`virtualenv`](http://docs.python-guide.org/en/latest/dev/virtualenvs/),
-virtual environments are isolated from system site-packages. This includes the
-installed Linux guest environment libraries that are used to configure `boto`
-credentials. There are two recommended solutions:
-
-* Create a virtual environment with `virtualenv venv --system-site-packages`.
-* Install `boto` via the Linux guest environment PyPI package using
- `pip install google-compute-engine`.
-
## Contributing
Have a patch that will benefit this project? Awesome! Follow these steps to have
diff --git a/packages/google-compute-engine/README.md b/packages/google-compute-engine/README.md
new file mode 100644
index 0000000..f5923c1
--- /dev/null
+++ b/packages/google-compute-engine/README.md
@@ -0,0 +1,4 @@
+## Google Compute Engine configuration and utilities package
+
+**This package has moved. The google-compute-engine package is now located in
+the [guest-config](https://github.com/GoogleCloudPlatform/guest-config) repo**
diff --git a/packages/google-compute-engine/packaging/debian/changelog b/packages/google-compute-engine/packaging/debian/changelog
deleted file mode 100644
index 5e31890..0000000
--- a/packages/google-compute-engine/packaging/debian/changelog
+++ /dev/null
@@ -1,260 +0,0 @@
-google-compute-engine (1:20200113.00-g1) stable; urgency=medium
-
- * Remove python daemon configs.
- * Add dependency on guest-agent package.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 13 Jan 2020 13:27:55 -0700
-
-google-compute-engine (1:20190916.00-g2) stable; urgency=medium
-
- * Update dependencies.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 16 Sep 2019 15:51:24 -0700
-
-google-compute-engine (1:20190916.00-g1) stable; urgency=medium
-
- * Bump version to match python package release.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 16 Sep 2019 15:51:24 -0700
-
-google-compute-engine (1:20190905.00-g1) stable; urgency=medium
-
- * Bump version to match python package release.
-
- -- Google Cloud Team <gc-team@google.com> Thu, 05 Sep 2019 12:00:22 -0700
-
-google-compute-engine (1:20190801.00-g1) stable; urgency=medium
-
- * Re-enable boto config and drop writing plugin directory.
- * Fix metadata script retrieval.
-
- -- Google Cloud Team <gc-team@google.com> Thu, 01 Aug 2019 14:06:02 -0700
-
-google-compute-engine (1:20190729.00-g1) stable; urgency=medium
-
- * Suport Google Private Access over IPv6.
- * Switch to v1 guest attributes URL.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 29 Jul 2019 10:07:29 -0700
-
-google-compute-engine (1:20190708.00-g1) stable; urgency=medium
-
- * Drop unnecessary build and package dependencies.
- * Log to journal and console directly from systemd service files.
- * Update Debian build dependencies.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 08 Jul 2019 10:20:15 -0700
-
-google-compute-engine (2.8.16-1) stable; urgency=low
-
- * Fix instance setup in Python 3 environments.
-
- -- Google Cloud Team <gc-team@google.com> Wed, 22 May 2019 12:00:00 -0700
-
-google-compute-engine (2.8.15-1) stable; urgency=low
-
- * Fix XPS settings with more than 64 vCPUs.
-
- -- Google Cloud Team <gc-team@google.com> Tue, 21 May 2019 12:00:00 -0700
-
-google-compute-engine (2.8.14-1) stable; urgency=low
-
- * Upstart systems: only run startup scripts at boot.
-
- -- Google Cloud Team <gc-team@google.com> Tue, 16 Apr 2019 12:00:00 -0700
-
-google-compute-engine (2.8.13-1) stable; urgency=low
-
- * Fix metadata script retrieval to support Python 3.
-
- -- Google Cloud Team <gc-team@google.com> Thu, 24 Jan 2019 12:00:00 -0700
-
-google-compute-engine (2.8.12-1) stable; urgency=low
-
- * Fix two factor enablement on change.
-
- -- Google Cloud Team <gc-team@google.com> Wed, 05 Dec 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.11-1) stable; urgency=low
-
- * Split up the gpasswd command into two commands.
- * Update two factor enablement on change.
-
- -- Google Cloud Team <gc-team@google.com> Tue, 04 Dec 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.10-1) stable; urgency=low
-
- * Fix the gpasswd command default.
-
- -- Google Cloud Team <gc-team@google.com> Fri, 30 Nov 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.9-1) stable; urgency=low
-
- * Support enabling OS Login two factor authentication.
- * Improve accounts support for FreeBSD.
- * Improve SELinux support.
-
- -- Google Cloud Team <gc-team@google.com> Wed, 28 Nov 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.8-1) stable; urgency=low
-
- * Update sudoer group membership without overriding local groups.
-
- -- Google Cloud Team <gc-team@google.com> Tue, 23 Oct 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.7-1) stable; urgency=low
-
- * Remove users from sudoers group on removal (fixed).
-
- -- Google Cloud Team <gc-team@google.com> Thu, 18 Oct 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.6-1) stable; urgency=low
-
- * Revert PR: Remove users from sudoers group on removal.
-
- -- Google Cloud Team <gc-team@google.com> Thu, 11 Oct 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.5-1) stable; urgency=low
-
- * Remove users from sudoers group on removal.
- * Remove gsutil dependency for metadata scripts.
-
- -- Google Cloud Team <gc-team@google.com> Thu, 05 Oct 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.4-1) stable; urgency=low
-
- * Remove ntp dependency.
- * Support Debian 10 Buster.
- * Restart the network daemon if networking is restarted.
- * Prevent setup of the default ethernet interface.
- * Accounts daemon can now verify username is 32 characters or less.
-
- -- Google Cloud Team <gc-team@google.com> Wed, 05 Sep 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.3-1) stable; urgency=low
-
- * Prevent IP forwarding daemon log spam.
- * Make default shell configurable when executing metadata scripts.
- * Rename distro directory to distro_lib.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 11 June 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.2-1) stable; urgency=low
-
- * Prevent delay in configuring IP forwarding routes.
- * Improve instance setup support for FreeBSD.
-
- -- Google Cloud Team <gc-team@google.com> Thu, 10 May 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.1-1) stable; urgency=low
-
- * Improve OS Login disablement.
-
- -- Google Cloud Team <gc-team@google.com> Fri, 04 May 2018 12:00:00 -0700
-
-google-compute-image-packages (2.8.0-1) stable; urgency=low
-
- * Create a new network daemon.
- * Refactor the IP forwarding daemon and network setup.
- * Improvements for using NSS cache in the accounts daemon.
-
- -- Google Cloud Team <gc-team@google.com> Tue, 01 May 2018 12:00:00 -0700
-
-google-compute-image-packages (2.7.7-1) stable; urgency=low
-
- * Add support for NSS cache in OS Login.
-
- -- Google Cloud Team <gc-team@google.com> Thu, 08 Mar 2018 12:00:00 -0700
-
-google-compute-image-packages (2.7.6-1) stable; urgency=low
-
- * Add distro specific logic.
-
- -- Google Cloud Team <gc-team@google.com> Wed, 21 Feb 2018 12:00:00 -0700
-
-google-compute-image-packages (2.7.5-2) stable; urgency=low
-
- * Fix dependencies for syslog.
-
- -- Google Cloud Team <gc-team@google.com> Tue, 06 Feb 2018 12:00:00 -0700
-
-google-compute-image-packages (2.7.5-1) stable; urgency=low
-
- * Revert hostname setting change in Debian.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 29 Jan 2018 12:00:00 -0700
-
-google-compute-image-packages (2.7.4-1) stable; urgency=low
-
- * Fix hostname setting in Debian.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 29 Jan 2018 12:00:00 -0700
-
-google-compute-image-packages (2.7.3-1) stable; urgency=low
-
- * Improve hostname setting and correctly restart rsyslog.
-
- -- Google Cloud Team <gc-team@google.com> Thu, 25 Jan 2018 12:00:00 -0700
-
-google-compute-image-packages (2.7.2-2) stable; urgency=low
-
- * Force IPv4 for apt.
-
- -- Google Cloud Team <gc-team@google.com> Wed, 13 Dec 2017 12:00:00 -0700
-
-google-compute-image-packages (2.7.2-1) stable; urgency=low
-
- * Generate SSH host keys when none are present.
- * Improve logging when activating OS Login.
-
- -- Google Cloud Team <gc-team@google.com> Wed, 29 Nov 2017 12:00:00 -0700
-
-google-compute-image-packages (2.7.1-1) stable; urgency=low
-
- * Update set_hostname file name to prevent conflict.
- * Add apt config to prevent auto-removal of google-compute-engine.
-
- -- Google Cloud Team <gc-team@google.com> Wed, 25 Oct 2017 12:00:00 -0700
-
-google-compute-image-packages (2.7.0-6) stable; urgency=low
-
- * Linux guest environment support for OS Login.
-
- -- Google Cloud Team <gc-team@google.com> Tue, 17 Oct 2017 12:00:00 -0700
-
-google-compute-image-packages (2.6.2-1) stable; urgency=low
-
- * Fix system hang during VM shutdown.
-
- -- Google Cloud Team <gc-team@google.com> Fri, 06 Oct 2017 12:00:00 -0700
-
-google-compute-image-packages (2.6.1-1) stable; urgency=low
-
- * Use curl to download metadata script files for SSL certificate validation.
- * Use netifaces for retrieving MAC address names if the import exists.
-
- -- Google Cloud Team <gc-team@google.com> Thurs, 14 Sep 2017 12:00:00 -0700
-
-google-compute-image-packages (2.6.0-4) stable; urgency=low
-
- * Fix DHCP exit hook install.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 28 Aug 2017 12:00:00 -0700
-
-google-compute-image-packages (2.6.0-3) stable; urgency=low
-
- * Add systemd preset.
-
- -- Google Cloud Team <gc-team@google.com> Fri, 25 Aug 2017 14:00:00 -0700
-
-google-compute-image-packages (2.6.0-2) stable; urgency=low
-
- * Add DHCP exit hook script back into package.
-
- -- Google Cloud Team <gc-team@google.com> Fri, 25 Aug 2017 12:00:00 -0700
-
-google-compute-image-packages (2.6.0-1) stable; urgency=low
-
- * New packaging.
-
- -- Google Cloud Team <gc-team@google.com> Mon, 27 Jun 2017 12:00:00 -0700
diff --git a/packages/google-compute-engine/packaging/debian/compat b/packages/google-compute-engine/packaging/debian/compat
deleted file mode 100644
index f599e28..0000000
--- a/packages/google-compute-engine/packaging/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-10
diff --git a/packages/google-compute-engine/packaging/debian/control b/packages/google-compute-engine/packaging/debian/control
deleted file mode 100644
index 350c63d..0000000
--- a/packages/google-compute-engine/packaging/debian/control
+++ /dev/null
@@ -1,35 +0,0 @@
-Source: google-compute-engine
-Section: admin
-Priority: optional
-Maintainer: Google Cloud Team <gc-team@google.com>
-Build-Depends: debhelper (>= 10)
-Standards-Version: 3.9.8
-Homepage: https://github.com/GoogleCloudPlatform/compute-image-packages
-
-Package: google-compute-engine
-Architecture: all
-Depends: google-compute-engine-oslogin,
- google-guest-agent,
- ${misc:Depends}
-Recommends: rsyslog | system-log-daemon
-Provides: irqbalance
-Conflicts: google-compute-engine-jessie,
- google-compute-engine-init-jessie,
- google-config-jessie,
- google-compute-engine-stretch,
- google-compute-engine-init-stretch,
- google-config-stretch,
- google-compute-daemon,
- google-startup-scripts,
- irqbalance
-Replaces: google-compute-engine-jessie,
- google-compute-engine-init-jessie,
- google-config-jessie,
- google-compute-engine-stretch,
- google-compute-engine-init-stretch,
- google-config-stretch,
- google-compute-daemon,
- google-startup-scripts
-Description: Google Compute Engine guest environment.
- This package contains scripts and configuration files for
- features specific to the Google Compute Engine cloud environment.
diff --git a/packages/google-compute-engine/packaging/debian/copyright b/packages/google-compute-engine/packaging/debian/copyright
deleted file mode 100644
index 9f4356b..0000000
--- a/packages/google-compute-engine/packaging/debian/copyright
+++ /dev/null
@@ -1,27 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: google-compute-engine
-Upstream-Contact: gc-team@google.com
-
-Files: *
-Copyright: Copyright 2017 Google Inc.
-License: Apache-2.0
-
-Files: debian/*
-Copyright: Copyright 2017 Google Inc.
-License: Apache-2.0
-
-License: Apache-2.0
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- .
- http://www.apache.org/licenses/LICENSE-2.0
- .
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- .
- On Debian systems, the complete text of the Apache version 2.0 license
- can be found in "/usr/share/common-licenses/Apache-2.0".
diff --git a/packages/google-compute-engine/packaging/debian/google-compute-engine.links b/packages/google-compute-engine/packaging/debian/google-compute-engine.links
deleted file mode 100644
index a8ebeff..0000000
--- a/packages/google-compute-engine/packaging/debian/google-compute-engine.links
+++ /dev/null
@@ -1 +0,0 @@
-usr/bin/google_set_hostname etc/dhcp/dhclient-exit-hooks.d/google_set_hostname
diff --git a/packages/google-compute-engine/packaging/debian/install b/packages/google-compute-engine/packaging/debian/install
deleted file mode 100644
index 22d4b3d..0000000
--- a/packages/google-compute-engine/packaging/debian/install
+++ /dev/null
@@ -1,6 +0,0 @@
-etc/apt/apt.conf.d/*
-etc/modprobe.d/*
-etc/rsyslog.d/*
-etc/sysctl.d/*
-lib/udev/rules.d/*
-usr/bin/*
diff --git a/packages/google-compute-engine/packaging/debian/preinst b/packages/google-compute-engine/packaging/debian/preinst
deleted file mode 100755
index f3ce046..0000000
--- a/packages/google-compute-engine/packaging/debian/preinst
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-# Copyright 2018 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -e
-if [ "$1" = upgrade ]; then
- # Remove old services if they exist on upgrade.
- for svc in google-ip-forwarding-daemon google-network-setup \
- google-network-daemon google-accounts-daemon google-clock-skew-daemon \
- google-instance-setup; do
- if systemctl is-enabled ${svc}.service >/dev/null 2>&1; then
- systemctl --no-reload disable ${svc}.service >/dev/null 2>&1 || :
- if [ -d /run/systemd/system ]; then
- systemctl stop ${svc}.service >/dev/null 2>&1 || :
- fi
- fi
- done
- systemdctl daemon-reload >/dev/null 2>&1 || :
-fi
diff --git a/packages/google-compute-engine/packaging/debian/rules b/packages/google-compute-engine/packaging/debian/rules
deleted file mode 100755
index 2dd01ce..0000000
--- a/packages/google-compute-engine/packaging/debian/rules
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/make -f
-
-%:
- dh $@
-
-override_dh_install:
- dh_install --sourcedir=src
diff --git a/packages/google-compute-engine/packaging/debian/source/format b/packages/google-compute-engine/packaging/debian/source/format
deleted file mode 100644
index 163aaf8..0000000
--- a/packages/google-compute-engine/packaging/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/packages/google-compute-engine/packaging/google-compute-engine.el6.spec b/packages/google-compute-engine/packaging/google-compute-engine.el6.spec
deleted file mode 100644
index aeb29be..0000000
--- a/packages/google-compute-engine/packaging/google-compute-engine.el6.spec
+++ /dev/null
@@ -1,70 +0,0 @@
-# Copyright 2017 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-Name: google-compute-engine
-Epoch: 1
-Version: %{_version}
-Release: g2.el6
-Summary: Google Compute Engine guest environment.
-License: ASL 2.0
-Url: https://github.com/GoogleCloudPlatform/compute-image-packages
-Source0: %{name}_%{version}.orig.tar.gz
-Requires: curl
-Requires: google-compute-engine-oslogin
-Requires: google-guest-agent
-Requires: rsyslog
-# Old packages.
-Obsoletes: google-compute-engine-init
-Obsoletes: google-config
-Obsoletes: google-startup-scripts
-
-BuildArch: noarch
-
-# Allow other files in the source that don't end up in the package.
-%define _unpackaged_files_terminate_build 0
-
-%description
-This package contains scripts, configuration, and init files for features
-specific to the Google Compute Engine cloud environment.
-
-%prep
-%autosetup
-
-%install
-cp -a src/{etc,usr} %{buildroot}
-install -d %{buildroot}/lib/
-cp -a src/lib/udev %{buildroot}/lib
-mkdir -p %{buildroot}/etc/dhcp
-ln -sf /usr/bin/google_set_hostname %{buildroot}/etc/dhcp/dhclient-exit-hooks
-
-%files
-%defattr(0644,root,root,0755)
-%attr(0755,-,-) %{_bindir}/*
-%attr(0755,-,-) %{_sbindir}/*
-/lib/udev/rules.d/*
-/etc/dhcp/dhclient-exit-hooks
-%config /etc/modprobe.d/*
-%config /etc/rsyslog.d/*
-%config /etc/sysctl.d/*
-
-%pre
-if [ $1 -gt 1 ] ; then
- # This is an upgrade. Stop services previously owned by this package, if any.
- for svc in google-ip-forwarding-daemon google-network-setup \
- google-network-daemon google-accounts-daemon google-clock-skew-daemon; do
- if initctl status $svc >/dev/null 2>&1; then
- initctl stop ${svc} || :
- fi
- done
-fi
diff --git a/packages/google-compute-engine/packaging/google-compute-engine.spec b/packages/google-compute-engine/packaging/google-compute-engine.spec
deleted file mode 100644
index c0833f3..0000000
--- a/packages/google-compute-engine/packaging/google-compute-engine.spec
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright 2018 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# For EL7, if building on CentOS, override dist to be el7.
-%if 0%{?rhel} == 7
- %define dist .el7
-%endif
-
-Name: google-compute-engine
-Epoch: 1
-Version: %{_version}
-Release: g2%{?dist}
-Summary: Google Compute Engine guest environment.
-License: ASL 2.0
-Url: https://github.com/GoogleCloudPlatform/compute-image-packages
-Source0: %{name}_%{version}.orig.tar.gz
-Requires: curl
-Requires: google-compute-engine-oslogin
-Requires: google-guest-agent
-Requires: rsyslog
-
-BuildArch: noarch
-
-# Allow other files in the source that don't end up in the package.
-%define _unpackaged_files_terminate_build 0
-
-%description
-This package contains scripts, configuration, and init files for features
-specific to the Google Compute Engine cloud environment.
-
-%prep
-%autosetup
-
-%install
-cp -a src/{etc,usr} %{buildroot}
-install -d %{buildroot}/%{_udevrulesdir}
-cp -a src/lib/udev/rules.d/* %{buildroot}/%{_udevrulesdir}
-
-%files
-%defattr(0644,root,root,0755)
-%attr(0755,-,-) %{_bindir}/*
-%attr(0755,-,-) /etc/dhcp/dhclient.d/google_hostname.sh
-%{_udevrulesdir}/*
-%config /etc/modprobe.d/*
-%config /etc/rsyslog.d/*
-%config /etc/sysctl.d/*
-
-%pre
-if [ $1 -gt 1 ] ; then
- # This is an upgrade. Stop and disable services previously owned by this
- # package, if any.
- for svc in google-ip-forwarding-daemon google-network-setup \
- google-network-daemon google-accounts-daemon google-clock-skew-daemon \
- google-instance-setup; do
- if systemctl is-enabled ${svc}.service >/dev/null 2>&1; then
- systemctl --no-reload disable ${svc}.service >/dev/null 2>&1 || :
- if [ -d /run/systemd/system ]; then
- systemctl stop ${svc}.service >/dev/null 2>&1 || :
- fi
- fi
- done
- systemctl daemon-reload >/dev/null 2>&1 || :
-fi
-
diff --git a/packages/google-compute-engine/packaging/setup_deb.sh b/packages/google-compute-engine/packaging/setup_deb.sh
deleted file mode 100755
index 19b4521..0000000
--- a/packages/google-compute-engine/packaging/setup_deb.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-# Copyright 2018 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-NAME="google-compute-engine"
-VERSION="20200113.00"
-
-working_dir=${PWD}
-if [[ $(basename "$working_dir") != $NAME ]]; then
- echo "Packaging scripts must be run from top of package dir."
- exit 1
-fi
-
-# Build dependencies.
-sudo apt-get -y install dh-systemd
-
-# .deb creation tools.
-sudo apt-get -y install debhelper devscripts build-essential
-
-rm -rf /tmp/debpackage
-mkdir /tmp/debpackage
-cd src
-tar czvf /tmp/debpackage/${NAME}_${VERSION}.orig.tar.gz --transform "s/^\./${NAME}-${VERSION}/" .
-
-cd /tmp/debpackage
-tar xzvf ${NAME}_${VERSION}.orig.tar.gz
-
-cd ${NAME}-${VERSION}
-
-cp -r ${working_dir}/packaging/debian ./
-
-debuild -us -uc
diff --git a/packages/google-compute-engine/packaging/setup_rpm.sh b/packages/google-compute-engine/packaging/setup_rpm.sh
deleted file mode 100755
index 801c9aa..0000000
--- a/packages/google-compute-engine/packaging/setup_rpm.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-# Copyright 2018 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-NAME="google-compute-engine"
-VERSION="20200113.00"
-
-rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION}
-working_dir=${PWD}
-if [[ $(basename "$working_dir") != $NAME ]]; then
- echo "Packaging scripts must be run from top of package dir."
- exit 1
-fi
-
-# RPM creation tools.
-sudo yum -y install rpmdevtools
-
-rm -rf /tmp/rpmpackage
-mkdir -p ${rpm_working_dir}/{SOURCES,SPECS}
-
-# EL6 has a separate .spec file.
-if [[ -e /etc/redhat-release ]] && grep -q release\ 6 /etc/redhat-release; then
- cp packaging/${NAME}-el6.spec ${rpm_working_dir}/SPECS/${NAME}.spec
-else
- cp packaging/${NAME}.spec ${rpm_working_dir}/SPECS/
-fi
-
-tar czvf ${rpm_working_dir}/SOURCES/${NAME}_${VERSION}.orig.tar.gz \
- --exclude .git --exclude packaging --transform "s/^\./${NAME}-${VERSION}/" .
-
-rpmbuild --define "_topdir ${rpm_working_dir}/" --define "_version ${VERSION}" \
- -ba ${rpm_working_dir}/SPECS/${NAME}.spec
diff --git a/packages/google-compute-engine/src/etc/apt/apt.conf.d/01autoremove-gce b/packages/google-compute-engine/src/etc/apt/apt.conf.d/01autoremove-gce
deleted file mode 100644
index be2d7f5..0000000
--- a/packages/google-compute-engine/src/etc/apt/apt.conf.d/01autoremove-gce
+++ /dev/null
@@ -1,10 +0,0 @@
-APT
-{
- NeverAutoRemove
- {
- "gce-compute-image-packages.*";
- "google-compute-engine.*";
- "python-google-compute-engine.*";
- "python3-google-compute-engine.*";
- };
-};
diff --git a/packages/google-compute-engine/src/etc/apt/apt.conf.d/99ipv4-only b/packages/google-compute-engine/src/etc/apt/apt.conf.d/99ipv4-only
deleted file mode 100644
index efca3b6..0000000
--- a/packages/google-compute-engine/src/etc/apt/apt.conf.d/99ipv4-only
+++ /dev/null
@@ -1,2 +0,0 @@
-# Force IPv4 for Apt.
-Acquire::ForceIPv4 "true";
diff --git a/packages/google-compute-engine/src/etc/dhcp/dhclient.d/google_hostname.sh b/packages/google-compute-engine/src/etc/dhcp/dhclient.d/google_hostname.sh
deleted file mode 100755
index abe8ce2..0000000
--- a/packages/google-compute-engine/src/etc/dhcp/dhclient.d/google_hostname.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-google_hostname_config() {
- google_set_hostname
-}
-google_hostname_restore() {
- :
-}
diff --git a/packages/google-compute-engine/src/etc/modprobe.d/gce-blacklist.conf b/packages/google-compute-engine/src/etc/modprobe.d/gce-blacklist.conf
deleted file mode 100644
index 9b7700e..0000000
--- a/packages/google-compute-engine/src/etc/modprobe.d/gce-blacklist.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# nouveau does not work with GCE GPU's.
-blacklist nouveau
-
-# GCE does not have a floppy device.
-blacklist floppy
diff --git a/packages/google-compute-engine/src/etc/rsyslog.d/90-google.conf b/packages/google-compute-engine/src/etc/rsyslog.d/90-google.conf
deleted file mode 100644
index 81b2ed7..0000000
--- a/packages/google-compute-engine/src/etc/rsyslog.d/90-google.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-# Google Compute Engine default console logging.
-#
-# daemon: logging from Google provided daemons.
-# kern: logging information in case of an unexpected crash during boot.
-#
-daemon,kern.* /dev/console
diff --git a/packages/google-compute-engine/src/etc/sysctl.d/11-gce-network-security.conf b/packages/google-compute-engine/src/etc/sysctl.d/11-gce-network-security.conf
deleted file mode 100644
index 0e4db8c..0000000
--- a/packages/google-compute-engine/src/etc/sysctl.d/11-gce-network-security.conf
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Google-recommended kernel parameters
-
-# Turn on SYN-flood protections. Starting with 2.6.26, there is no loss
-# of TCP functionality/features under normal conditions. When flood
-# protections kick in under high unanswered-SYN load, the system
-# should remain more stable, with a trade off of some loss of TCP
-# functionality/features (e.g. TCP Window scaling).
-net.ipv4.tcp_syncookies=1
-
-# Ignore source-routed packets
-net.ipv4.conf.all.accept_source_route=0
-net.ipv4.conf.default.accept_source_route=0
-
-# Ignore ICMP redirects from non-GW hosts
-net.ipv4.conf.all.accept_redirects=0
-net.ipv4.conf.default.accept_redirects=0
-net.ipv4.conf.all.secure_redirects=1
-net.ipv4.conf.default.secure_redirects=1
-
-# Don't pass traffic between networks or act as a router
-net.ipv4.ip_forward=0
-net.ipv4.conf.all.send_redirects=0
-net.ipv4.conf.default.send_redirects=0
-
-# Turn on Source Address Verification in all interfaces to
-# prevent some spoofing attacks.
-net.ipv4.conf.all.rp_filter=1
-net.ipv4.conf.default.rp_filter=1
-
-# Ignore ICMP broadcasts to avoid participating in Smurf attacks
-net.ipv4.icmp_echo_ignore_broadcasts=1
-
-# Ignore bad ICMP errors
-net.ipv4.icmp_ignore_bogus_error_responses=1
-
-# Log spoofed, source-routed, and redirect packets
-net.ipv4.conf.all.log_martians=1
-net.ipv4.conf.default.log_martians=1
-
-# RFC 1337 fix
-net.ipv4.tcp_rfc1337=1
-
-# Addresses of mmap base, heap, stack and VDSO page are randomized
-kernel.randomize_va_space=2
-
-# Reboot the machine soon after a kernel panic.
-kernel.panic=10
diff --git a/packages/google-compute-engine/src/lib/udev/rules.d/64-gce-disk-removal.rules b/packages/google-compute-engine/src/lib/udev/rules.d/64-gce-disk-removal.rules
deleted file mode 100644
index 4ff1f99..0000000
--- a/packages/google-compute-engine/src/lib/udev/rules.d/64-gce-disk-removal.rules
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# When a disk is removed, unmount any remaining attached volumes.
-
-ACTION=="remove", SUBSYSTEM=="block", KERNEL=="sd*|vd*", RUN+="/bin/sh -c '/bin/umount -fl /dev/$name && /usr/bin/logger -p daemon.warn -s WARNING: hot-removed /dev/$name that was still mounted, data may have been corrupted'"
diff --git a/packages/google-compute-engine/src/lib/udev/rules.d/65-gce-disk-naming.rules b/packages/google-compute-engine/src/lib/udev/rules.d/65-gce-disk-naming.rules
deleted file mode 100644
index e258548..0000000
--- a/packages/google-compute-engine/src/lib/udev/rules.d/65-gce-disk-naming.rules
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Name the attached disks as the specified by deviceName.
-
-ACTION!="add|change", GOTO="gce_disk_naming_end"
-SUBSYSTEM!="block", GOTO="gce_disk_naming_end"
-
-# SCSI naming
-KERNEL=="sd*|vd*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode"
-
-# NVME naming
-KERNEL=="nvme0n1*", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-0"
-KERNEL=="nvme0n2*", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-1"
-KERNEL=="nvme0n3*", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-2"
-KERNEL=="nvme0n4*", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-3"
-KERNEL=="nvme0n5*", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-4"
-KERNEL=="nvme0n6*", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-5"
-KERNEL=="nvme0n7*", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-6"
-KERNEL=="nvme0n8*", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-7"
-KERNEL=="nvme*", ENV{ID_SERIAL}="Google_EphemeralDisk_$env{ID_SERIAL_SHORT}"
-
-# Symlinks
-KERNEL=="sd*|vd*|nvme*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/google-$env{ID_SERIAL_SHORT}"
-KERNEL=="sd*|vd*|nvme*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/google-$env{ID_SERIAL_SHORT}-part%n"
-
-LABEL="gce_disk_naming_end"
diff --git a/packages/google-compute-engine/src/usr/bin/google_optimize_local_ssd b/packages/google-compute-engine/src/usr/bin/google_optimize_local_ssd
deleted file mode 100755
index 15238b9..0000000
--- a/packages/google-compute-engine/src/usr/bin/google_optimize_local_ssd
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-total_cpus=$(nproc)
-
-config_nvme()
-{
- current_cpu=0
- for dev in /sys/bus/pci/drivers/nvme/*
- do
- if [ ! -d "$dev" ]
- then
- continue
- fi
- for irq_info in $dev/msi_irqs/*
- do
- if [ ! -f "$irq_info" ]
- then
- continue
- fi
- current_cpu=$((current_cpu % total_cpus))
- cpu_mask=$(printf "%x" $((1<<current_cpu)))
- irq=$(basename "$irq_info")$a
- echo "Setting IRQ $irq smp_affinity to $cpu_mask."
- echo "$cpu_mask" > "/proc/irq/$irq/smp_affinity"
- current_cpu=$((current_cpu+1))
- done
- done
-}
-
-config_scsi()
-{
- irqs=()
- for device in /sys/bus/virtio/drivers/virtio_scsi/virtio*
- do
- ssd=0
- for target_path in $device/host*/target*/*
- do
- if [ ! -f "$target_path/model" ]
- then
- continue
- fi
- model=$(cat "$target_path/model")
- if [[ $model =~ .*EphemeralDisk.* ]]
- then
- ssd=1
- for queue_path in $target_path/block/sd*/queue
- do
- echo noop > "$queue_path/scheduler"
- echo 0 > "$queue_path/add_random"
- echo 512 > "$queue_path/nr_requests"
- echo 0 > "$queue_path/rotational"
- echo 0 > "$queue_path/rq_affinity"
- echo 1 > "$queue_path/nomerges"
- done
- fi
- done
- if [[ $ssd == 1 ]]
- then
- request_queue=$(basename "$device")-request
- irq=$(cat /proc/interrupts | grep "$request_queue" | awk '{print $1}'| sed 's/://')
- irqs+=($irq)
- fi
- done
- irq_count=${#irqs[@]}
- if [ "$irq_count" != 0 ]
- then
- stride=$((total_cpus / irq_count))
- stride=$((stride < 1 ? 1 : stride))
- current_cpu=0
- for irq in "${irqs[@]}"
- do
- current_cpu=$(($current_cpu % $total_cpus))
- cpu_mask=$(printf "%x" $((1<<$current_cpu)))
- echo "Setting IRQ $irq smp_affinity to $cpu_mask."
- echo "$cpu_mask" > "/proc/irq/$irq/smp_affinity"
- current_cpu=$((current_cpu+stride))
- done
- fi
-}
-
-config_nvme
-config_scsi
diff --git a/packages/google-compute-engine/src/usr/bin/google_set_hostname b/packages/google-compute-engine/src/usr/bin/google_set_hostname
deleted file mode 100755
index 7e203e7..0000000
--- a/packages/google-compute-engine/src/usr/bin/google_set_hostname
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/bash
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Deal with a new hostname assignment.
-
-if [ -n "$new_host_name" ] && [ -n "$new_ip_address" ]; then
- # Delete entries with new_host_name or new_ip_address in /etc/hosts.
- sed -i"" '/Added by Google/d' /etc/hosts
-
- # Add an entry for our new_host_name/new_ip_address in /etc/hosts.
- echo "${new_ip_address} ${new_host_name} ${new_host_name%%.*} # Added by Google" >> /etc/hosts
-
- # Add an entry for reaching the metadata server in /etc/hosts.
- echo "169.254.169.254 metadata.google.internal # Added by Google" >> /etc/hosts
-fi
-
-# /sbin/dhclient-scripts in both ubuntu and centos have some problems for us:
-# 1) BOUND doesn't always set hostname (e.g. if old_host_name is unset in
-# precise pangolin)
-# 2) Using too long of a FQDN as a hostname causes some tools to break in
-# some distros (e.g. ssh-keygen) and hostname tool complains when given
-# a FQDN that is > 64 bytes.
-#
-# As a result, we set the host name in all circumstances here, to the truncated
-# unqualified domain name.
-
-if [ -n "$new_host_name" ]; then
- hostname "${new_host_name%%.*}"
-
- # If NetworkManager is installed set the hostname with nmcli.
- # to resolve issues with NetworkManager resetting the hostname
- # to the FQDN on DHCP renew.
- nmcli=$(which nmcli 2> /dev/null)
- if [ -x "$nmcli" ]; then
- nmcli general hostname "${new_host_name%%.*}"
- fi
-
- # Restart rsyslog to update the hostname.
- systemctl=$(which systemctl 2> /dev/null)
- if [ -x "$systemctl" ]; then
- hasrsyslog=$($systemctl | grep rsyslog | cut -f1 -d' ')
- if [ ! -z "$hasrsyslog" ]; then
- $systemctl -q --no-block restart "$hasrsyslog"
- fi
- else
- pkill -HUP syslogd
- fi
-fi
diff --git a/packages/google-compute-engine/src/usr/bin/google_set_multiqueue b/packages/google-compute-engine/src/usr/bin/google_set_multiqueue
deleted file mode 100755
index 1cc4da0..0000000
--- a/packages/google-compute-engine/src/usr/bin/google_set_multiqueue
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/bin/bash
-# Copyright 2017 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# For a single-queue / no MSI-X virtionet device, sets the IRQ affinities to
-# processor 0. For this virtionet configuration, distributing IRQs to all
-# processors results in comparatively high cpu utilization and comparatively
-# low network bandwidth.
-#
-# For a multi-queue / MSI-X virtionet device, sets the IRQ affinities to the
-# per-IRQ affinity hint. The virtionet driver maps each virtionet TX (RX) queue
-# MSI-X interrupt to a unique single CPU if the number of TX (RX) queues equals
-# the number of online CPUs. The mapping of network MSI-X interrupt vector to
-# CPUs is stored in the virtionet MSI-X interrupt vector affinity hint. This
-# configuration allows network traffic to be spread across the CPUs, giving
-# each CPU a dedicated TX and RX network queue, while ensuring that all packets
-# from a single flow are delivered to the same CPU.
-#
-# For a gvnic device, set the IRQ affinities to the per-IRQ affinity hint.
-# The google virtual ethernet driver maps each queue MSI-X interrupt to a
-# unique single CPU, which is stored in the affinity_hint for each MSI-X
-# vector. In older versions of the kernel, irqblanace is expected to copy the
-# affinity_hint to smp_affinity; however, GCE instances disable irqbalance by
-# default. This script copies over the affinity_hint to smp_affinity on boot to
-# replicate the behavior of irqbalance.
-
-function is_decimal_int() {
- [ "${1}" -eq "${1}" ] > /dev/null 2>&1
-}
-
-function set_channels() {
- ethtool -L "${1}" combined "${2}" > /dev/null 2>&1
-}
-
-echo "Running $(basename $0)."
-VIRTIO_NET_DEVS=/sys/bus/virtio/drivers/virtio_net/virtio*
-
-# Loop through all the virtionet devices and enable multi-queue
-if [ -x "$(command -v ethtool)" ]; then
- for dev in $VIRTIO_NET_DEVS; do
- ETH_DEVS=${dev}/net/*
- for eth_dev in $ETH_DEVS; do
- eth_dev=$(basename "$eth_dev")
- if ! errormsg=$(ethtool -l "$eth_dev" 2>&1); then
- echo "ethtool says that $eth_dev does not support virtionet multiqueue: $errormsg."
- continue
- fi
- num_max_channels=$(ethtool -l "$eth_dev" | grep -m 1 Combined | cut -f2)
- [ "${num_max_channels}" -eq "1" ] && continue
- if is_decimal_int "$num_max_channels" && \
- set_channels "$eth_dev" "$num_max_channels"; then
- echo "Set channels for $eth_dev to $num_max_channels."
- else
- echo "Could not set channels for $eth_dev to $num_max_channels."
- fi
- done
- done
-else
- echo "ethtool not found: cannot configure virtionet multiqueue."
-fi
-
-for dev in $VIRTIO_NET_DEVS
-do
- dev=$(basename "$dev")
- irq_dir=/proc/irq/*
- for irq in $irq_dir
- do
- smp_affinity="${irq}/smp_affinity_list"
- [ ! -f "${smp_affinity}" ] && continue
- # Classify this IRQ as virtionet intx, virtionet MSI-X, or non-virtionet
- # If the IRQ type is virtionet intx, a subdirectory with the same name as
- # the device will be present. If the IRQ type is virtionet MSI-X, then
- # a subdirectory of the form <device name>-<input|output>.N will exist.
- # In this case, N is the input (output) queue number, and is specified as
- # a decimal integer ranging from 0 to K - 1 where K is the number of
- # input (output) queues in the virtionet device.
- virtionet_intx_dir="${irq}/${dev}"
- virtionet_msix_dir_regex=".*/${dev}-(input|output)\.([0-9]+)$"
- if [ -d "${virtionet_intx_dir}" ]; then
- # All virtionet intx IRQs are delivered to CPU 0
- echo "Setting ${smp_affinity} to 01 for device ${dev}."
- echo "01" > "${smp_affinity}"
- continue
- fi
- # Not virtionet intx, probe for MSI-X
- virtionet_msix_found=0
- for entry in ${irq}/${dev}*; do
- if [[ "$entry" =~ ${virtionet_msix_dir_regex} ]]; then
- virtionet_msix_found=1
- queue_num=${BASH_REMATCH[2]}
- fi
- done
- affinity_hint="${irq}/affinity_hint"
- [ "$virtionet_msix_found" -eq 0 -o ! -f "${affinity_hint}" ] && continue
-
- # Set the IRQ CPU affinity to the virtionet-initialized affinity hint
- echo "Setting ${smp_affinity} to ${queue_num} for device ${dev}."
- echo "${queue_num}" > "${smp_affinity}"
- real_affinity=`cat ${smp_affinity}`
- echo "${smp_affinity}: real affinity ${real_affinity}"
- done
-done
-
-# Set smp_affinity properly for gvnic queues. '-ntfy-block.' is unique to gve
-# and will not affect virtio queues.
-for i in /proc/irq/*; do
- if ls ${i}/*-ntfy-block.* 1> /dev/null 2>&1; then
- if [ -f ${i}/affinity_hint ]; then
- echo Setting smp_affinity on ${i} to $(cat ${i}/affinity_hint)
- cp ${i}/affinity_hint ${i}/smp_affinity
- fi
- fi
-done
-
-XPS=/sys/class/net/e*/queues/tx*/xps_cpus
-num_cpus=$(nproc)
-
-num_queues=0
-for q in $XPS; do
- num_queues=$((num_queues + 1))
-done
-
-# If we have more CPUs than queues, then stripe CPUs across tx affinity
-# as CPUNumber % queue_count.
-for q in $XPS; do
- queue_re=".*tx-([0-9]+).*$"
- if [[ "$q" =~ ${queue_re} ]]; then
- queue_num=${BASH_REMATCH[1]}
- fi
-
- xps=0
- for cpu in `seq $queue_num $num_queues $((num_cpus - 1))`; do
- xps=$((xps | (1 << cpu)))
- done
-
- # Linux xps_cpus requires a hex number with commas every 32 bits. It ignores
- # all bits above # cpus, so write a list of comma separated 32 bit hex values
- # with a comma between dwords.
- xps_dwords=()
- for i in $(seq 0 $(((num_cpus - 1) / 32)))
- do
- xps_dwords+=(`printf "%08x" $((xps & 0xffffffff))`)
- done
- xps_string=$(IFS=, ; echo "${xps_dwords[*]}")
-
-
- echo ${xps_string} > $q
- printf "Queue %d XPS=%s for %s\n" $queue_num `cat $q` $q
-done | sort -n -k2
diff --git a/packages/google-compute-engine/src/usr/sbin/google-dhclient-script b/packages/google-compute-engine/src/usr/sbin/google-dhclient-script
deleted file mode 100755
index 3b10cb9..0000000
--- a/packages/google-compute-engine/src/usr/sbin/google-dhclient-script
+++ /dev/null
@@ -1,806 +0,0 @@
-#!/bin/bash
-#
-# dhclient-script: Network interface configuration script run by
-# dhclient based on DHCP client communication
-#
-# Copyright (C) 2008-2014 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author(s): David Cantrell <dcantrell@redhat.com>
-# Jiri Popelka <jpopelka@redhat.com>
-#
-# ----------
-# This script is a rewrite/reworking on dhclient-script originally
-# included as part of dhcp-970306:
-# dhclient-script for Linux. Dan Halbert, March, 1997.
-# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
-# Modified by David Cantrell <dcantrell@redhat.com> for Fedora and RHEL
-#
-# This script is found in EL 7 and used to fix local routing in EL 6.
-# ----------
-
-PATH=/bin:/usr/bin:/sbin
-# scripts in dhclient.d/ use $SAVEDIR (#833054)
-SAVEDIR=/var/lib/dhclient
-
-LOGFACILITY="local7"
-LOGLEVEL="notice"
-
-ETCDIR="/etc/dhcp"
-
-logmessage() {
- msg="${1}"
- logger -p ${LOGFACILITY}.${LOGLEVEL} -t "NET" "dhclient: ${msg}"
-}
-
-eventually_add_hostnames_domain_to_search() {
-# For the case when hostname for this machine has a domain that is not in domain_search list
-# 1) get a hostname with `ipcalc --hostname` or `hostname`
-# 2) get the domain from this hostname
-# 3) add this domain to search line in resolv.conf if it's not already
-# there (domain list that we have recently added there is a parameter of this function)
-# We can't do this directly when generating resolv.conf in make_resolv_conf(), because
-# we need to first save the resolv.conf with obtained values before we can call `ipcalc --hostname`.
-# See bug 637763
- search="${1}"
- if need_hostname; then
- status=1
- if [ -n "${new_ip_address}" ]; then
- eval $(/bin/ipcalc --silent --hostname ${new_ip_address} ; echo "status=$?")
- elif [ -n "${new_ip6_address}" ]; then
- eval $(/bin/ipcalc --silent --hostname ${new_ip6_address} ; echo "status=$?")
- fi
-
- if [ ${status} -eq 0 ]; then
- domain=$(echo $HOSTNAME | cut -s -d "." -f 2-)
- fi
- else
- domain=$(hostname 2>/dev/null | cut -s -d "." -f 2-)
- fi
-
- if [ -n "${domain}" ] &&
- [ ! "${domain}" = "localdomain" ] &&
- [ ! "${domain}" = "localdomain6" ] &&
- [ ! "${domain}" = "(none)" ] &&
- [[ ! "${domain}" = *\ * ]]; then
- is_in="false"
- for s in ${search}; do
- if [ "${s}" = "${domain}" ] ||
- [ "${s}" = "${domain}." ]; then
- is_in="true"
- fi
- done
-
- if [ "${is_in}" = "false" ]; then
- # Add domain name to search list (#637763)
- sed -i"" -e "s/${search}/${search} ${domain}/" /etc/resolv.conf
- fi
- fi
-}
-
-make_resolv_conf() {
- [ "${PEERDNS}" = "no" ] && return
-
- if [ "${reason}" = "RENEW" ] &&
- [ "${new_domain_name}" = "${old_domain_name}" ] &&
- [ "${new_domain_name_servers}" = "${old_domain_name_servers}" ]; then
- return
- fi
-
- if [ -n "${new_domain_name}" ] ||
- [ -n "${new_domain_name_servers}" ] ||
- [ -n "${new_domain_search}" ]; then
- rscf="$(mktemp ${TMPDIR:-/tmp}/XXXXXX)"
- [[ -z "${rscf}" ]] && return
- echo "; generated by /usr/sbin/dhclient-script" > ${rscf}
-
- if [ -n "${SEARCH}" ]; then
- search="${SEARCH}"
- else
- if [ -n "${new_domain_search}" ]; then
- # Remove instaces of \032 (#450042)
- search="${new_domain_search//\\032/ }"
- elif [ -n "${new_domain_name}" ]; then
- # Note that the DHCP 'Domain Name Option' is really just a domain
- # name, and that this practice of using the domain name option as
- # a search path is both nonstandard and deprecated.
- search="${new_domain_name}"
- fi
- fi
-
- if [ -n "${search}" ]; then
- echo "search ${search}" >> $rscf
- fi
-
- if [ -n "${RES_OPTIONS}" ]; then
- echo "options ${RES_OPTIONS}" >> ${rscf}
- fi
-
- for nameserver in ${new_domain_name_servers} ; do
- echo "nameserver ${nameserver}" >> ${rscf}
- done
-
- change_resolv_conf ${rscf}
- rm -f ${rscf}
-
- if [ -n "${search}" ]; then
- eventually_add_hostnames_domain_to_search "${search}"
- fi
- elif [ -n "${new_dhcp6_name_servers}" ] ||
- [ -n "${new_dhcp6_domain_search}" ]; then
- rscf="$(mktemp ${TMPDIR:-/tmp}/XXXXXX)"
- [[ -z "${rscf}" ]] && return
- echo "; generated by /usr/sbin/dhclient-script" > ${rscf}
-
- if [ -n "${SEARCH}" ]; then
- search="${SEARCH}"
- else
- if [ -n "${new_dhcp6_domain_search}" ]; then
- search="${new_dhcp6_domain_search//\\032/ }"
- fi
- fi
-
- if [ -n "${search}" ]; then
- echo "search ${search}" >> $rscf
- fi
-
- if [ -n "${RES_OPTIONS}" ]; then
- echo "options ${RES_OPTIONS}" >> ${rscf}
- fi
-
- shopt -s nocasematch
- for nameserver in ${new_dhcp6_name_servers} ; do
- # If the nameserver has a link-local address
- # add a <zone_id> (interface name) to it.
- if [[ "$nameserver" =~ ^fe80:: ]]
- then
- zone_id="%${interface}"
- else
- zone_id=
- fi
- echo "nameserver ${nameserver}$zone_id" >> ${rscf}
- done
- shopt -u nocasematch
-
- change_resolv_conf ${rscf}
- rm -f ${rscf}
-
- if [ -n "${search}" ]; then
- eventually_add_hostnames_domain_to_search "${search}"
- fi
- fi
-}
-
-exit_with_hooks() {
- exit_status="${1}"
-
- if [ -x ${ETCDIR}/dhclient-exit-hooks ]; then
- . ${ETCDIR}/dhclient-exit-hooks
- fi
-
- exit ${exit_status}
-}
-
-quad2num() {
- if [ $# -eq 4 ]; then
- let n="${1} << 24 | ${2} << 16 | ${3} << 8 | ${4}"
- echo "${n}"
- return 0
- else
- echo "0"
- return 1
- fi
-}
-
-ip2num() {
- IFS="." quad2num ${1}
-}
-
-num2ip() {
- let n="${1}"
- let o1="(n >> 24) & 0xff"
- let o2="(n >> 16) & 0xff"
- let o3="(n >> 8) & 0xff"
- let o4="n & 0xff"
- echo "${o1}.${o2}.${o3}.${o4}"
-}
-
-get_network_address() {
-# get network address for the given IP address and (netmask or prefix)
- ip="${1}"
- nm="${2}"
-
- if [ -n "${ip}" -a -n "${nm}" ]; then
- if [[ "${nm}" = *.* ]]; then
- ipcalc -s -n ${ip} ${nm} | cut -d '=' -f 2
- else
- ipcalc -s -n ${ip}/${nm} | cut -d '=' -f 2
- fi
- fi
-}
-
-get_prefix() {
-# get prefix for the given IP address and mask
- ip="${1}"
- nm="${2}"
-
- if [ -n "${ip}" -a -n "${nm}" ]; then
- ipcalc -s -p ${ip} ${nm} | cut -d '=' -f 2
- fi
-}
-
-class_bits() {
- let ip=$(IFS='.' ip2num $1)
- let bits=32
- let mask='255'
- for ((i=0; i <= 3; i++, 'mask<<=8')); do
- let v='ip&mask'
- if [ "$v" -eq 0 ] ; then
- let bits-=8
- else
- break
- fi
- done
- echo $bits
-}
-
-is_router_reachable() {
- # handle DHCP servers that give us a router not on our subnet
- router="${1}"
- routersubnet="$(get_network_address ${router} ${new_subnet_mask})"
- mysubnet="$(get_network_address ${new_ip_address} ${new_subnet_mask})"
-
- if [ ! "${routersubnet}" = "${mysubnet}" ]; then
- ip -4 route replace ${router}/32 dev ${interface}
- if [ "$?" -ne 0 ]; then
- logmessage "failed to create host route for ${router}"
- return 1
- fi
- fi
-
- return 0
-}
-
-add_default_gateway() {
- router="${1}"
-
- if is_router_reachable ${router} ; then
- metric=""
- if [ $# -gt 1 ] && [ ${2} -gt 0 ]; then
- metric="metric ${2}"
- fi
- ip -4 route replace default via ${router} dev ${interface} ${metric}
- if [ $? -ne 0 ]; then
- logmessage "failed to create default route: ${router} dev ${interface} ${metric}"
- return 1
- else
- return 0
- fi
- fi
-
- return 1
-}
-
-execute_client_side_configuration_scripts() {
-# execute any additional client side configuration scripts we have
- if [ "${1}" == "config" ] || [ "${1}" == "restore" ]; then
- for f in ${ETCDIR}/dhclient.d/*.sh ; do
- if [ -x ${f} ]; then
- subsystem="${f%.sh}"
- subsystem="${subsystem##*/}"
- . ${f}
- "${subsystem}_${1}"
- fi
- done
- fi
-}
-
-flush_dev() {
-# Instead of bringing the interface down (#574568)
-# explicitly clear the ARP cache and flush all addresses & routes.
- ip -4 addr flush dev ${1} >/dev/null 2>&1
- ip -4 route flush dev ${1} >/dev/null 2>&1
- ip -4 neigh flush dev ${1} >/dev/null 2>&1
-}
-
-dhconfig() {
- if [ -n "${old_ip_address}" ] && [ -n "${alias_ip_address}" ] &&
- [ ! "${alias_ip_address}" = "${old_ip_address}" ]; then
- # possible new alias, remove old alias first
- ip -4 addr del ${old_ip_address} dev ${interface} label ${interface}:0
- fi
-
- if [ -n "${old_ip_address}" ] &&
- [ ! "${old_ip_address}" = "${new_ip_address}" ]; then
- # IP address changed. Delete all routes, and clear the ARP cache.
- flush_dev ${interface}
- fi
-
- if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] ||
- [ ! "${old_ip_address}" = "${new_ip_address}" ] ||
- [ ! "${old_subnet_mask}" = "${new_subnet_mask}" ] ||
- [ ! "${old_network_number}" = "${new_network_number}" ] ||
- [ ! "${old_broadcast_address}" = "${new_broadcast_address}" ] ||
- [ ! "${old_routers}" = "${new_routers}" ] ||
- [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then
- ip -4 addr add ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface} \
- valid_lft ${new_dhcp_lease_time} preferred_lft ${new_dhcp_lease_time} >/dev/null 2>&1
- ip link set dev ${interface} up
-
- # The 576 MTU is only used for X.25 and dialup connections
- # where the admin wants low latency. Such a low MTU can cause
- # problems with UDP traffic, among other things. As such,
- # disallow MTUs from 576 and below by default, so that broken
- # MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
- if [ -n "${new_interface_mtu}" ] && [ ${new_interface_mtu} -gt 576 ]; then
- ip link set dev ${interface} mtu ${new_interface_mtu}
- fi
-
- # static routes
- if [ -n "${new_classless_static_routes}" ] ||
- [ -n "${new_static_routes}" ]; then
- if [ -n "${new_classless_static_routes}" ]; then
- IFS=', |' static_routes=(${new_classless_static_routes})
- else
- IFS=', |' static_routes=(${new_static_routes})
- fi
- route_targets=()
-
- for((i=0; i<${#static_routes[@]}; i+=2)); do
- target=${static_routes[$i]}
- if [ -n "${new_classless_static_routes}" ]; then
- if [ ${target} = "0" ]; then
- # If the DHCP server returns both a Classless Static Routes option and
- # a Router option, the DHCP client MUST ignore the Router option. (RFC3442)
- new_routers=""
- prefix="0"
- else
- prefix=${target%%.*}
- target=${target#*.}
- IFS="." target_arr=(${target})
- unset IFS
- ((pads=4-${#target_arr[@]}))
- for j in $(seq $pads); do
- target="${target}.0"
- done
-
- # Client MUST zero any bits in the subnet number where the corresponding bit in the mask is zero.
- # In other words, the subnet number installed in the routing table is the logical AND of
- # the subnet number and subnet mask given in the Classless Static Routes option. (RFC3442)
- target="$(get_network_address ${target} ${prefix})"
- fi
- else
- prefix=$(class_bits ${target})
- fi
- gateway=${static_routes[$i+1]}
-
- # special case 0.0.0.0 to allow static routing for link-local addresses
- # (including IPv4 multicast) which will not have a next-hop (#769463, #787318)
- if [ "${gateway}" = "0.0.0.0" ]; then
- valid_gateway=0
- scope='scope link'
- else
- is_router_reachable ${gateway}
- valid_gateway=$?
- scope=''
- fi
- if [ ${valid_gateway} -eq 0 ]; then
- metric=''
- for t in ${route_targets[@]}; do
- if [ ${t} = ${target} ]; then
- if [ -z "${metric}" ]; then
- metric=1
- else
- ((metric=metric+1))
- fi
- fi
- done
-
- if [ -n "${metric}" ]; then
- metric="metric ${metric}"
- fi
-
- ip -4 route replace ${target}/${prefix} proto static via ${gateway} dev ${interface} ${metric} ${scope}
-
- if [ $? -ne 0 ]; then
- logmessage "failed to create static route: ${target}/${prefix} via ${gateway} dev ${interface} ${metric}"
- else
- route_targets=(${route_targets[@]} ${target})
- fi
- fi
- done
- fi
-
- # gateways
- if [[ ( "${DEFROUTE}" != "no" ) &&
- (( -z "${GATEWAYDEV}" ) || ( "${GATEWAYDEV}" = "${interface}" )) ]]; then
- if [[ ( -z "$GATEWAY" ) ||
- (( -n "$DHCLIENT_IGNORE_GATEWAY" ) && ( "$DHCLIENT_IGNORE_GATEWAY" = [Yy]* )) ]]; then
- metric="${METRIC:-}"
- let i="${METRIC:-0}"
- default_routers=()
-
- for router in ${new_routers} ; do
- added_router=-
-
- for r in ${default_routers[@]} ; do
- if [ "${r}" = "${router}" ]; then
- added_router=1
- fi
- done
-
- if [ -z "${router}" ] ||
- [ "${added_router}" = "1" ] ||
- [ $(IFS=. ip2num ${router}) -le 0 ] ||
- [[ ( "${router}" = "${new_broadcast_address}" ) &&
- ( "${new_subnet_mask}" != "255.255.255.255" ) ]]; then
- continue
- fi
-
- default_routers=(${default_routers[@]} ${router})
- add_default_gateway ${router} ${metric}
- let i=i+1
- metric=${i}
- done
- elif [ -n "${GATEWAY}" ]; then
- routersubnet=$(get_network_address ${GATEWAY} ${new_subnet_mask})
- mysubnet=$(get_network_address ${new_ip_address} ${new_subnet_mask})
-
- if [ "${routersubnet}" = "${mysubnet}" ]; then
- ip -4 route replace default via ${GATEWAY} dev ${interface}
- fi
- fi
- fi
-
- else # RENEW||REBIND - only update address lifetimes
- ip -4 addr change ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface} \
- valid_lft ${new_dhcp_lease_time} preferred_lft ${new_dhcp_lease_time} >/dev/null 2>&1
- fi
-
- if [ ! "${new_ip_address}" = "${alias_ip_address}" ] &&
- [ -n "${alias_ip_address}" ]; then
- # Reset the alias address (fix: this should really only do this on changes)
- ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
- ip -4 addr add ${alias_ip_address}/${alias_prefix} broadcast ${alias_broadcast_address} dev ${interface} label ${interface}:0
- ip -4 route replace ${alias_ip_address}/32 dev ${interface}
- fi
-
- # After dhclient brings an interface UP with a new IP address, subnet mask,
- # and routes, in the REBOOT/BOUND states -> search for "dhclient-up-hooks".
- if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] ||
- [ ! "${old_ip_address}" = "${new_ip_address}" ] ||
- [ ! "${old_subnet_mask}" = "${new_subnet_mask}" ] ||
- [ ! "${old_network_number}" = "${new_network_number}" ] ||
- [ ! "${old_broadcast_address}" = "${new_broadcast_address}" ] ||
- [ ! "${old_routers}" = "${new_routers}" ] ||
- [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then
-
- if [ -x ${ETCDIR}/dhclient-${interface}-up-hooks ]; then
- . ${ETCDIR}/dhclient-${interface}-up-hooks
- elif [ -x ${ETCDIR}/dhclient-up-hooks ]; then
- . ${ETCDIR}/dhclient-up-hooks
- fi
- fi
-
- make_resolv_conf
-
- if [ -n "${new_host_name}" ] && need_hostname; then
- hostname ${new_host_name} || echo "See -nc option in dhclient(8) man page."
- fi
-
- if [[ ( "${DHCP_TIME_OFFSET_SETS_TIMEZONE}" = [yY1]* ) &&
- ( -n "${new_time_offset}" ) ]]; then
- # DHCP option "time-offset" is requested by default and should be
- # handled. The geographical zone abbreviation cannot be determined
- # from the GMT offset, but the $ZONEINFO/Etc/GMT$offset file can be
- # used - note: this disables DST.
- ((z=new_time_offset/3600))
- ((hoursWest=$(printf '%+d' $z)))
-
- if (( $hoursWest < 0 )); then
- # tzdata treats negative 'hours west' as positive 'gmtoff'!
- ((hoursWest*=-1))
- fi
-
- tzfile=/usr/share/zoneinfo/Etc/GMT$(printf '%+d' ${hoursWest})
- if [ -e ${tzfile} ]; then
- cp -fp ${tzfile} /etc/localtime
- touch /etc/localtime
- fi
- fi
-
- execute_client_side_configuration_scripts "config"
-}
-
-# Section 18.1.8. (Receipt of Reply Messages) of RFC 3315 says:
-# The client SHOULD perform duplicate address detection on each of
-# the addresses in any IAs it receives in the Reply message before
-# using that address for traffic.
-add_ipv6_addr_with_DAD() {
- ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
- dev ${interface} scope global valid_lft ${new_max_life} \
- preferred_lft ${new_preferred_life}
-
- # repeatedly test whether newly added address passed
- # duplicate address detection (DAD)
- for i in $(seq 5); do
- sleep 1 # give the DAD some time
-
- addr=$(ip -6 addr show dev ${interface} \
- | grep ${new_ip6_address}/${new_ip6_prefixlen})
-
- # tentative flag == DAD is still not complete
- tentative=$(echo "${addr}" | grep tentative)
- # dadfailed flag == address is already in use somewhere else
- dadfailed=$(echo "${addr}" | grep dadfailed)
-
- if [ -n "${dadfailed}" ] ; then
- # address was added with valid_lft/preferred_lft 'forever', remove it
- ip -6 addr del ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface}
- exit_with_hooks 3
- fi
- if [ -z "${tentative}" ] ; then
- if [ -n "${addr}" ]; then
- # DAD is over
- return 0
- else
- # address was auto-removed (or not added at all)
- exit_with_hooks 3
- fi
- fi
- done
- return 0
-}
-
-dh6config() {
- if [ -n "${old_ip6_prefix}" ] ||
- [ -n "${new_ip6_prefix}" ]; then
- echo Prefix ${reason} old=${old_ip6_prefix} new=${new_ip6_prefix}
- exit_with_hooks 0
- fi
-
- case "${reason}" in
- BOUND6)
- if [ -z "${new_ip6_address}" ] ||
- [ -z "${new_ip6_prefixlen}" ]; then
- exit_with_hooks 2
- fi
-
- add_ipv6_addr_with_DAD
-
- make_resolv_conf
- ;;
-
- RENEW6|REBIND6)
- if [[ -n "${new_ip6_address}" ]] &&
- [[ -n "${new_ip6_prefixlen}" ]]; then
- if [[ ! "${new_ip6_address}" = "${old_ip6_address}" ]]; then
- add_ipv6_addr_with_DAD
- else # only update address lifetimes
- ip -6 addr change ${new_ip6_address}/${new_ip6_prefixlen} \
- dev ${interface} scope global valid_lft ${new_max_life} \
- preferred_lft ${new_preferred_life}
- fi
- fi
-
- if [ ! "${new_dhcp6_name_servers}" = "${old_dhcp6_name_servers}" ] ||
- [ ! "${new_dhcp6_domain_search}" = "${old_dhcp6_domain_search}" ]; then
- make_resolv_conf
- fi
- ;;
-
- DEPREF6)
- if [ -z "${new_ip6_prefixlen}" ]; then
- exit_with_hooks 2
- fi
-
- ip -6 addr change ${new_ip6_address}/${new_ip6_prefixlen} \
- dev ${interface} scope global preferred_lft 0
- ;;
- esac
-
- execute_client_side_configuration_scripts "config"
-}
-
-
-#
-# ### MAIN
-#
-
-if [ -x ${ETCDIR}/dhclient-enter-hooks ]; then
- exit_status=0
-
- # dhclient-enter-hooks can abort dhclient-script by setting
- # the exit_status variable to a non-zero value
- . ${ETCDIR}/dhclient-enter-hooks
- if [ ${exit_status} -ne 0 ]; then
- exit ${exit_status}
- fi
-fi
-
-if [ ! -r /etc/sysconfig/network-scripts/network-functions ]; then
- echo "Missing /etc/sysconfig/network-scripts/network-functions, exiting." >&2
- exit 1
-fi
-
-if [ ! -r /etc/rc.d/init.d/functions ]; then
- echo "Missing /etc/rc.d/init.d/functions, exiting." >&2
- exit 1
-fi
-
-. /etc/sysconfig/network-scripts/network-functions
-. /etc/rc.d/init.d/functions
-
-if [ -f /etc/sysconfig/network ]; then
- . /etc/sysconfig/network
-fi
-
-if [ -f /etc/sysconfig/networking/network ]; then
- . /etc/sysconfig/networking/network
-fi
-
-cd /etc/sysconfig/network-scripts
-CONFIG="${interface}"
-need_config ${CONFIG}
-source_config >/dev/null 2>&1
-
-new_prefix="$(get_prefix ${new_ip_address} ${new_subnet_mask})"
-old_prefix="$(get_prefix ${old_ip_address} ${old_subnet_mask})"
-alias_prefix="$(get_prefix ${alias_ip_address} ${alias_subnet_mask})"
-
-case "${reason}" in
- MEDIUM|ARPCHECK|ARPSEND)
- # Do nothing
- exit_with_hooks 0
- ;;
-
- PREINIT)
- if [ -n "${alias_ip_address}" ]; then
- # Flush alias, its routes will disappear too.
- ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
- fi
-
- # upstream dhclient-script removes (ifconfig $interface 0 up) old adresses in PREINIT,
- # but we sometimes (#125298) need (for iSCSI/nfs root to have a dhcp interface) to keep the existing ip
- # flush_dev ${interface}
- ip link set dev ${interface} up
- if [ -n "${DHCLIENT_DELAY}" ] && [ ${DHCLIENT_DELAY} -gt 0 ]; then
- # We need to give the kernel some time to get the interface up.
- sleep ${DHCLIENT_DELAY}
- fi
-
- exit_with_hooks 0
- ;;
-
- PREINIT6)
- # ensure interface is up
- ip link set dev ${interface} up
-
- # remove any stale addresses from aborted clients
- ip -6 addr flush dev ${interface} scope global permanent
-
- # we need a link-local address to be ready (not tentative)
- for i in $(seq 50); do
- linklocal=$(ip -6 addr show dev ${interface} scope link)
- # tentative flag means DAD is still not complete
- tentative=$(echo "${linklocal}" | grep tentative)
- [[ -n "${linklocal}" && -z "${tentative}" ]] && exit_with_hooks 0
- sleep 0.1
- done
-
- exit_with_hooks 0
- ;;
-
- BOUND|RENEW|REBIND|REBOOT)
- if [ -z "${interface}" ] || [ -z "${new_ip_address}" ]; then
- exit_with_hooks 2
- fi
- if arping -D -q -c2 -I ${interface} ${new_ip_address}; then
- dhconfig
- exit_with_hooks 0
- else # DAD failed, i.e. address is already in use
- ARP_REPLY=$(arping -D -c2 -I ${interface} ${new_ip_address} | grep reply | awk '{print toupper($5)}' | cut -d "[" -f2 | cut -d "]" -f1)
- OUR_MACS=$(ip link show | grep link | awk '{print toupper($2)}' | uniq)
- if [[ "${OUR_MACS}" = *"${ARP_REPLY}"* ]]; then
- # in RENEW the reply can come from our system, that's OK
- dhconfig
- exit_with_hooks 0
- else
- exit_with_hooks 1
- fi
- fi
- ;;
-
- BOUND6|RENEW6|REBIND6|DEPREF6)
- dh6config
- exit_with_hooks 0
- ;;
-
- EXPIRE6|RELEASE6|STOP6)
- if [ -z "${old_ip6_address}" ] || [ -z "${old_ip6_prefixlen}" ]; then
- exit_with_hooks 2
- fi
-
- ip -6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \
- dev ${interface}
-
- execute_client_side_configuration_scripts "restore"
-
- if [ -x ${ETCDIR}/dhclient-${interface}-down-hooks ]; then
- . ${ETCDIR}/dhclient-${interface}-down-hooks
- elif [ -x ${ETCDIR}/dhclient-down-hooks ]; then
- . ${ETCDIR}/dhclient-down-hooks
- fi
-
- exit_with_hooks 0
- ;;
-
- EXPIRE|FAIL|RELEASE|STOP)
- execute_client_side_configuration_scripts "restore"
-
- if [ -x ${ETCDIR}/dhclient-${interface}-down-hooks ]; then
- . ${ETCDIR}/dhclient-${interface}-down-hooks
- elif [ -x ${ETCDIR}/dhclient-down-hooks ]; then
- . ${ETCDIR}/dhclient-down-hooks
- fi
-
- if [ -n "${alias_ip_address}" ]; then
- # Flush alias
- ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
- fi
-
- if [ -n "${old_ip_address}" ]; then
- # Delete addresses/routes/arp cache.
- flush_dev ${interface}
- fi
-
- if [ -n "${alias_ip_address}" ]; then
- ip -4 addr add ${alias_ip_address}/${alias_prefix} broadcast ${alias_broadcast_address} dev ${interface} label ${interface}:0
- ip -4 route replace ${alias_ip_address}/32 dev ${interface}
- fi
-
- exit_with_hooks 0
- ;;
-
- TIMEOUT)
- if [ -n "${new_routers}" ]; then
- if [ -n "${alias_ip_address}" ]; then
- ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
- fi
-
- ip -4 addr add ${new_ip_address}/${new_prefix} \
- broadcast ${new_broadcast_address} dev ${interface} \
- valid_lft ${new_dhcp_lease_time} preferred_lft ${new_dhcp_lease_time}
- set ${new_routers}
-
- if ping -q -c 1 -w 10 -I ${interface} ${1}; then
- dhconfig
- exit_with_hooks 0
- fi
-
- flush_dev ${interface}
- exit_with_hooks 1
- else
- exit_with_hooks 1
- fi
- ;;
-
- *)
- logmessage "unhandled state: ${reason}"
- exit_with_hooks 1
- ;;
-esac
-
-exit_with_hooks 0