diff options
author | Rick Wright <rickw@google.com> | 2019-05-06 13:33:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-06 13:33:25 -0700 |
commit | 730307675a93ab6da551412878f81d3bb61d2b1f (patch) | |
tree | a06558aab5a8b0130f551c8a7dcbbb80a2162696 /packages | |
parent | fbeb0d93d2198c56fdfee1f3607912ad8a116435 (diff) | |
parent | 49d2969bb81ecc1061f475ce304e6316b5980273 (diff) | |
download | google-compute-image-packages-730307675a93ab6da551412878f81d3bb61d2b1f.tar.gz |
Merge branch 'development' into hostkeys
Diffstat (limited to 'packages')
17 files changed, 125 insertions, 40 deletions
diff --git a/packages/gce-disk-expand/packaging/gce-disk-expand.spec b/packages/gce-disk-expand/packaging/gce-disk-expand.spec index d34b08d..a1fb6dd 100644 --- a/packages/gce-disk-expand/packaging/gce-disk-expand.spec +++ b/packages/gce-disk-expand/packaging/gce-disk-expand.spec @@ -33,13 +33,13 @@ This package resizes the root partition on first boot using parted. %install mv src/expandfs-lib.sh src/usr/share/dracut/modules.d/50expand_rootfs/ -%if 0%{?rhel} == 7 +%if 0%{?rhel} >= 7 ./dracut6_7.sh %endif rsync -Pravz src/ %{buildroot} %files -%if 0%{?rhel} == 7 +%if 0%{?rhel} >= 7 %attr(755,root,root) /usr/lib/dracut/modules.d/50expand_rootfs/* %else %attr(755,root,root) /usr/share/dracut/modules.d/50expand_rootfs/* diff --git a/packages/gce-disk-expand/packaging/setup_deb.sh b/packages/gce-disk-expand/packaging/setup_deb.sh index 8880efe..ca5be92 100755 --- a/packages/gce-disk-expand/packaging/setup_deb.sh +++ b/packages/gce-disk-expand/packaging/setup_deb.sh @@ -26,7 +26,7 @@ fi sudo apt-get -y install dh-systemd # DEB creation tools. -sudo apt-get -y install debhelper devscripts build-essential +sudo apt-get -y install debhelper devscripts build-essential rsync rm -rf /tmp/debpackage mkdir /tmp/debpackage diff --git a/packages/gce-disk-expand/packaging/setup_rpm.sh b/packages/gce-disk-expand/packaging/setup_rpm.sh index 52f6a36..106aa6f 100755 --- a/packages/gce-disk-expand/packaging/setup_rpm.sh +++ b/packages/gce-disk-expand/packaging/setup_rpm.sh @@ -24,7 +24,7 @@ if [[ $(basename "$working_dir") != $NAME ]]; then fi # RPM creation tools. -sudo yum -y install rpmdevtools +sudo yum -y install rpmdevtools rsync rm -rf ${rpm_working_dir} mkdir -p ${rpm_working_dir}/{SOURCES,SPECS} diff --git a/packages/gce-disk-expand/src/expandfs-lib.sh b/packages/gce-disk-expand/src/expandfs-lib.sh index 5126602..92e9ed5 100755 --- a/packages/gce-disk-expand/src/expandfs-lib.sh +++ b/packages/gce-disk-expand/src/expandfs-lib.sh @@ -24,7 +24,7 @@ resize_filesystem() { case "${fs_type}" in xfs) echo "XFS filesystems must be mounted to be resized, deferring." - expand_xfs="true" + echo "true" > /tmp/xfs_resize return 1 ;; ext*) @@ -136,6 +136,7 @@ parted_resizepart() { echo "Unable to resize ${disk}${partnum}: ${out}" return 1 fi + udevadm settle } # Resizes partition by deleting and recreating with end position. @@ -184,4 +185,5 @@ parted_resize_mkpart() ( return 1 fi done + udevadm settle ) diff --git a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs.sh b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs.sh index 055f083..cc831b3 100755 --- a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs.sh +++ b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -expand_xfs="" # Global to message next script. - # Contains dracut-specific logic for detecting disk, then calls appropriate # library functions. main() { @@ -26,11 +24,7 @@ main() { return fi - # Wait for any of the initial udev events to finish otherwise growpart - # might fail. - udevsettle - - if ! out=$(get_partition "$rootdev"); then + if ! out=$(split_partition "$rootdev"); then echo "Failed to detect disk and partition info: ${out}" return fi @@ -63,8 +57,6 @@ main() { fi fi - udevsettle - if ! out=$(resize_filesystem "$rootdev"); then echo "Failed to resize filesystem: ${out}" return diff --git a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs_dummy.sh b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs_dummy.sh new file mode 100755 index 0000000..c037109 --- /dev/null +++ b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs_dummy.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Dummy script, to make sure systemd executes the cmdline stage (which exports +# the 'root' variable required for expand_root) diff --git a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/install b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/install index 4b68069..cdd021d 100755 --- a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/install +++ b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/install @@ -16,8 +16,9 @@ # Dracut install script for RHEL/CentOS inst "$moddir/expandfs-lib.sh" "/lib/expandfs-lib.sh" +inst_hook cmdline 50 "$moddir/expand_rootfs_dummy.sh" inst_hook pre-mount 50 "$moddir/expand_rootfs.sh" -inst_hook pre-pivot 50 "$moddir/xfs_growfs.sh" +inst_hook pre-pivot 99 "$moddir/xfs_growfs.sh" dracut_install parted dracut_install cut @@ -25,4 +26,5 @@ dracut_install sed dracut_install grep dracut_install resize2fs dracut_install e2fsck +dracut_install udevadm dracut_install -o xfs_growfs diff --git a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/xfs_growfs.sh b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/xfs_growfs.sh index af8d05d..0e77185 100755 --- a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/xfs_growfs.sh +++ b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/xfs_growfs.sh @@ -14,7 +14,7 @@ # limitations under the License. main() { - if [ -z "$expand_xfs" ]; then + if [ ! -e /tmp/xfs_resize ]; then return fi @@ -23,11 +23,18 @@ main() { return fi if xfs_growfs -d -n /sysroot; then + echo "Mounting filesystem rw." + if ! $(mount -o rw,remount /sysroot); then + echo "Remount failed." + return + fi echo "Resizing XFS filesystem" if ! out=$(xfs_growfs -d /sysroot); then echo "Failed to resize: ${out}" + mount -o ro,remount /sysroot return fi + mount -o ro,remount /sysroot fi } diff --git a/packages/google-compute-engine-oslogin/packaging/google-compute-engine-oslogin.spec b/packages/google-compute-engine-oslogin/packaging/google-compute-engine-oslogin.spec index 7e0799d..b8b0e67 100644 --- a/packages/google-compute-engine-oslogin/packaging/google-compute-engine-oslogin.spec +++ b/packages/google-compute-engine-oslogin/packaging/google-compute-engine-oslogin.spec @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Force the dist to be el7 to avoid el7.centos. +# For EL7, if building on CentOS, override dist to be el7. %if 0%{?rhel} == 7 %define dist .el7 %endif @@ -29,11 +29,17 @@ BuildRequires: boost-devel BuildRequires: gcc-c++ BuildRequires: make BuildRequires: libcurl -BuildRequires: json-c +BuildRequires: json-c-devel BuildRequires: pam-devel +%if 0%{?rhel} == 8 +BuildRequires: python3-policycoreutils +Requires: python3-policycoreutils +%else BuildRequires: policycoreutils-python -Requires: boost-regex Requires: policycoreutils-python +%endif +Requires: boost-regex +Requires: json-c %define pam_install_path /%{_lib}/security @@ -41,6 +47,8 @@ Requires: policycoreutils-python This package contains several libraries and changes to enable OS Login functionality for Google Compute Engine. +%global debug_package %{nil} + %prep %setup @@ -53,10 +61,14 @@ make install DESTDIR=%{buildroot} NSS_INSTALL_PATH=/%{_lib} PAM_INSTALL_PATH=%{p %files %doc -/%{_lib}/libnss_%{name}-%{version}.so -/%{_lib}/libnss_cache_%{name}-%{version}.so -%{pam_install_path}/pam_oslogin_admin.so -%{pam_install_path}/pam_oslogin_login.so +%attr(0755,-,-) /%{_lib}/libnss_%{name}-%{version}.so +%attr(0755,-,-) /%{_lib}/libnss_cache_%{name}-%{version}.so +%if 0%{?rhel} == 8 +/%{_lib}/libnss_oslogin.so.2 +/%{_lib}/libnss_cache_oslogin.so.2 +%endif +%attr(0755,-,-) %{pam_install_path}/pam_oslogin_admin.so +%attr(0755,-,-) %{pam_install_path}/pam_oslogin_login.so /usr/bin/google_authorized_keys /usr/bin/google_oslogin_control /usr/bin/google_oslogin_nss_cache diff --git a/packages/google-compute-engine-oslogin/packaging/setup_rpm.sh b/packages/google-compute-engine-oslogin/packaging/setup_rpm.sh index f174efe..519247d 100755 --- a/packages/google-compute-engine-oslogin/packaging/setup_rpm.sh +++ b/packages/google-compute-engine-oslogin/packaging/setup_rpm.sh @@ -24,11 +24,14 @@ if [[ $(basename "$working_dir") != $NAME ]]; then exit 1 fi -# Build dependencies. -sudo yum -y install make gcc-c++ libcurl-devel json-c json-c-devel pam-devel policycoreutils-python boost-devel +sudo yum -y install rpmdevtools make gcc-c++ json-c \ + libcurl-devel pam-devel boost-devel json-c-devel -# RPM creation tools. -sudo yum -y install rpmdevtools +if grep -q '^\(CentOS\|Red Hat\)[^0-9]*8\..' /etc/redhat-release; then + sudo yum -y install python3-policycoreutils +else + sudo yum -y install policycoreutils-python +fi rm -rf /tmp/rpmpackage mkdir -p ${rpm_working_dir}/{SOURCES,SPECS} diff --git a/packages/google-compute-engine/packaging/google-compute-engine.spec b/packages/google-compute-engine/packaging/google-compute-engine.spec index 39307cb..aba148d 100644 --- a/packages/google-compute-engine/packaging/google-compute-engine.spec +++ b/packages/google-compute-engine/packaging/google-compute-engine.spec @@ -12,16 +12,25 @@ # 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 Version: %{_version} -Release: 1.el7 +Release: 1%{?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 +%if 0%{?rhel} == 8 +Requires: python3-google-compute-engine = %{version} +%else Requires: python-google-compute-engine = %{version} +%endif Requires: rsyslog BuildArch: noarch diff --git a/packages/google-compute-engine/packaging/setup_rpm.sh b/packages/google-compute-engine/packaging/setup_rpm.sh index d98c2aa..4537982 100755 --- a/packages/google-compute-engine/packaging/setup_rpm.sh +++ b/packages/google-compute-engine/packaging/setup_rpm.sh @@ -23,10 +23,6 @@ if [[ $(basename "$working_dir") != $NAME ]]; then exit 1 fi -# Build dependencies. -sudo yum -y install make gcc-c++ libcurl-devel json-c json-c-devel pam-devel \ - policycoreutils-python boost-devel - # RPM creation tools. sudo yum -y install rpmdevtools diff --git a/packages/python-google-compute-engine/google_compute_engine/boto/tests/compute_auth_test.py b/packages/python-google-compute-engine/google_compute_engine/boto/tests/compute_auth_test.py index 0c31052..93e55ae 100644 --- a/packages/python-google-compute-engine/google_compute_engine/boto/tests/compute_auth_test.py +++ b/packages/python-google-compute-engine/google_compute_engine/boto/tests/compute_auth_test.py @@ -15,11 +15,16 @@ """Unittest for compute_auth.py module.""" -from google_compute_engine.boto import compute_auth +import sys + from google_compute_engine.test_compat import mock from google_compute_engine.test_compat import unittest +if sys.version_info < (3, 0): + from google_compute_engine.boto import compute_auth + +@unittest.skipIf(sys.version_info > (3, 0), 'Skipping for python3.') class ComputeAuthTest(unittest.TestCase): def setUp(self): diff --git a/packages/python-google-compute-engine/google_compute_engine/compat.py b/packages/python-google-compute-engine/google_compute_engine/compat.py index eb69763..3d18c12 100644 --- a/packages/python-google-compute-engine/google_compute_engine/compat.py +++ b/packages/python-google-compute-engine/google_compute_engine/compat.py @@ -19,7 +19,7 @@ import logging import subprocess import sys -if sys.version_info >= (3, 6): +if sys.version_info >= (3, 7): import distro else: import platform as distro diff --git a/packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec b/packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec new file mode 100644 index 0000000..6bf3291 --- /dev/null +++ b/packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec @@ -0,0 +1,47 @@ +# Copyright 2019 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: python3-google-compute-engine +Version: %{_version} +Release: 1%{?dist} +Summary: Google Compute Engine python3 library +License: ASL 2.0 +Url: https://github.com/GoogleCloudPlatform/compute-image-packages +Source0: %{name}_%{version}.orig.tar.gz + +BuildArch: noarch +BuildRequires: python36-devel python3-setuptools + +Requires: python3-setuptools + +%description +Google Compute Engine python library for Python 3.x. + +%prep +%autosetup + +%build +%py3_build + +%install +%py3_install + +%files +%{python3_sitelib}/google_compute_engine/ +%{python3_sitelib}/google_compute_engine*.egg-info/ +%{_bindir}/google_accounts_daemon +%{_bindir}/google_clock_skew_daemon +%{_bindir}/google_instance_setup +%{_bindir}/google_metadata_script_runner +%{_bindir}/google_network_daemon diff --git a/packages/python-google-compute-engine/packaging/setup_rpm.sh b/packages/python-google-compute-engine/packaging/setup_rpm.sh index d1eccc3..a9514af 100755 --- a/packages/python-google-compute-engine/packaging/setup_rpm.sh +++ b/packages/python-google-compute-engine/packaging/setup_rpm.sh @@ -23,12 +23,17 @@ if [[ $(basename "$working_dir") != $NAME ]]; then exit 1 fi -# Build dependencies. -sudo yum -y install python2-devel python-setuptools python-boto - -# RPM creation tools. sudo yum -y install rpmdevtools +# RHEL/CentOS 8 uses python3. +if grep -q '^\(CentOS\|Red Hat\)[^0-9]*8\..' /etc/redhat-release; then + NAME="python3-google-compute-engine" + rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION} + sudo yum -y install python36-devel python3-setuptools python36-rpm-macros +else + sudo yum -y install python2-devel python-setuptools python-boto +fi + rm -rf /tmp/rpmpackage mkdir -p ${rpm_working_dir}/{SOURCES,SPECS} diff --git a/packages/python-google-compute-engine/setup.py b/packages/python-google-compute-engine/setup.py index 59a61b3..53f970a 100755 --- a/packages/python-google-compute-engine/setup.py +++ b/packages/python-google-compute-engine/setup.py @@ -20,8 +20,10 @@ import sys import setuptools -install_requires = ['boto', 'setuptools'] -if sys.version_info >= (3, 6): +install_requires = ['setuptools'] +if sys.version_info < (3, 0): + install_requires += ['boto'] +if sys.version_info >= (3, 7): install_requires += ['distro'] setuptools.setup( |