diff options
author | Vlastimil Holer <vlastimil.holer@gmail.com> | 2013-02-21 11:57:25 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-02-21 11:57:25 -0500 |
commit | d4886b65549c886499141872a9928412a74bbea2 (patch) | |
tree | 200a0bc7217b5f8415205acd1c063e143978e34f | |
parent | 174bc39e6b2c1cac3f73f67f25fad87cab16fa42 (diff) | |
parent | 10ea1c0bb933b21d32012d89b218a3bbbd15a75a (diff) | |
download | vyos-cloud-init-d4886b65549c886499141872a9928412a74bbea2.tar.gz vyos-cloud-init-d4886b65549c886499141872a9928412a74bbea2.zip |
Few patches to make life on Debian 6 stable happier:
* Added arguments to packages/bddeb:
-d pass through '-d' to debuild
--no-cloud-utils don't depend on cloud-utils package (default: False)
These are essential for building on Debian 6, because there are
no python-mocker (build dependency) and cloud-utils (install dependency)
in squeeze and squeeze-backports.
* SysVinit startup scripts modified to run both on RHEL and Debian,
* (Unfortunately) New option INIT_SYSTEM=sysvinit_deb for Debian /etc/init.d/
directory
* Make separate Ubuntu and Debian APT source template (cc_apt_configure)
I'm now generating working Debian 6 package following way:
INIT_SYSTEM=sysvinit_deb packages/bddeb -us -uc --no-cloud-utils -d
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | cloudinit/config/cc_apt_configure.py | 9 | ||||
-rwxr-xr-x | packages/bddeb | 17 | ||||
-rw-r--r-- | packages/debian/control.in | 3 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rwxr-xr-x | sysvinit/cloud-config | 11 | ||||
-rwxr-xr-x | sysvinit/cloud-final | 11 | ||||
-rwxr-xr-x | sysvinit/cloud-init | 11 | ||||
-rwxr-xr-x | sysvinit/cloud-init-local | 11 | ||||
-rw-r--r-- | templates/sources.list.debian.tmpl | 28 | ||||
-rw-r--r-- | templates/sources.list.ubuntu.tmpl (renamed from templates/sources.list.tmpl) | 0 |
11 files changed, 68 insertions, 37 deletions
@@ -40,6 +40,8 @@ - cloud-init-container.conf: ensure /run/network before running ifquery - DataSourceNoCloud: allow user-data and meta-data to be specified in config (LP: #1115833). + - improve debian support in sysvinit scripts, package build scripts, and + split sources.list template to be distro specific. 0.7.1: - sysvinit: fix missing dependency in cloud-init job for RHEL 5.6 - config-drive: map hostname to local-hostname (LP: #1061964) diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py index f8664160..3ce3b351 100644 --- a/cloudinit/config/cc_apt_configure.py +++ b/cloudinit/config/cc_apt_configure.py @@ -140,10 +140,13 @@ def get_release(): def generate_sources_list(codename, mirrors, cloud, log): - template_fn = cloud.get_template_filename('sources.list') + template_fn = cloud.get_template_filename('sources.list.%s' % + (cloud.distro.name)) if not template_fn: - log.warn("No template found, not rendering /etc/apt/sources.list") - return + template_fn = cloud.get_template_filename('sources.list') + if not template_fn: + log.warn("No template found, not rendering /etc/apt/sources.list") + return params = {'codename': codename} for k in mirrors: diff --git a/packages/bddeb b/packages/bddeb index bda3170d..61399739 100755 --- a/packages/bddeb +++ b/packages/bddeb @@ -36,10 +36,10 @@ PKG_MP = { 'prettytable': 'python-prettytable', 'pyyaml': 'python-yaml', } -DEBUILD_ARGS = ["-us", "-S", "-uc"] +DEBUILD_ARGS = ["-us", "-S", "-uc", "-d"] -def write_debian_folder(root, version, revno): +def write_debian_folder(root, version, revno, append_requires=[]): deb_dir = util.abs_join(root, 'debian') os.makedirs(deb_dir) @@ -58,7 +58,7 @@ def write_debian_folder(root, version, revno): pkgs = [p.lower().strip() for p in stdout.splitlines()] # Map to known packages - requires = [] + requires = append_requires for p in pkgs: tgt_pkg = PKG_MP.get(p) if not tgt_pkg: @@ -87,6 +87,11 @@ def main(): " (default: %(default)s)"), default=False, action='store_true') + parser.add_argument("--no-cloud-utils", dest="no_cloud_utils", + help=("don't depend on cloud-utils package" + " (default: %(default)s)"), + default=False, + action='store_true') for ent in DEBUILD_ARGS: parser.add_argument(ent, dest="debuild_args", action='append_const', @@ -128,7 +133,11 @@ def main(): shutil.move(extracted_name, xdir) print("Creating a debian/ folder in %r" % (xdir)) - write_debian_folder(xdir, version, revno) + if not args.no_cloud_utils: + append_requires=['cloud-utils'] + else: + append_requires=[] + write_debian_folder(xdir, version, revno, append_requires) # The naming here seems to follow some debian standard # so it will whine if it is changed... diff --git a/packages/debian/control.in b/packages/debian/control.in index edb5aff5..b9352f5b 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -18,8 +18,7 @@ Standards-Version: 3.9.3 Package: cloud-init Architecture: all -Depends: cloud-utils, - procps, +Depends: procps, python, #for $r in $requires ${r}, @@ -38,11 +38,13 @@ def is_f(p): INITSYS_FILES = { 'sysvinit': [f for f in glob('sysvinit/*') if is_f(f)], + 'sysvinit_deb': [f for f in glob('sysvinit/*') if is_f(f)], 'systemd': [f for f in glob('systemd/*') if is_f(f)], 'upstart': [f for f in glob('upstart/*') if is_f(f)], } INITSYS_ROOTS = { 'sysvinit': '/etc/rc.d/init.d', + 'sysvinit_deb': '/etc/init.d', 'systemd': '/etc/systemd/system/', 'upstart': '/etc/init/', } diff --git a/sysvinit/cloud-config b/sysvinit/cloud-config index e587446d..ad8ed831 100755 --- a/sysvinit/cloud-config +++ b/sysvinit/cloud-config @@ -29,15 +29,13 @@ # Should-Start: $time # Required-Stop: # Should-Stop: -# Default-Start: 3 5 -# Default-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: The config cloud-init job # Description: Start cloud-init and runs the config phase # and any associated config modules as desired. ### END INIT INFO -. /etc/init.d/functions - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -60,8 +58,9 @@ prog="cloud-init" cloud_init="/usr/bin/cloud-init" conf="/etc/cloud/cloud.cfg" -# If there exists a sysconfig variable override file use it... +# If there exist sysconfig/default variable override files use it... [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init +[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init start() { [ -x $cloud_init ] || return 5 @@ -80,8 +79,6 @@ stop() { return $RETVAL } -. /etc/init.d/functions - case "$1" in start) start diff --git a/sysvinit/cloud-final b/sysvinit/cloud-final index 5deb8457..aeae8903 100755 --- a/sysvinit/cloud-final +++ b/sysvinit/cloud-final @@ -29,15 +29,13 @@ # Should-Start: $time # Required-Stop: # Should-Stop: -# Default-Start: 3 5 -# Default-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: The final cloud-init job # Description: Start cloud-init and runs the final phase # and any associated final modules as desired. ### END INIT INFO -. /etc/init.d/functions - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -60,8 +58,9 @@ prog="cloud-init" cloud_init="/usr/bin/cloud-init" conf="/etc/cloud/cloud.cfg" -# If there exists a sysconfig variable override file use it... +# If there exist sysconfig/default variable override files use it... [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init +[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init start() { [ -x $cloud_init ] || return 5 @@ -80,8 +79,6 @@ stop() { return $RETVAL } -. /etc/init.d/functions - case "$1" in start) start diff --git a/sysvinit/cloud-init b/sysvinit/cloud-init index f8ab5d5f..c1c92ad0 100755 --- a/sysvinit/cloud-init +++ b/sysvinit/cloud-init @@ -29,15 +29,13 @@ # Should-Start: $time # Required-Stop: # Should-Stop: -# Default-Start: 3 5 -# Default-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: The initial cloud-init job (net and fs contingent) # Description: Start cloud-init and runs the initialization phase # and any associated initial modules as desired. ### END INIT INFO -. /etc/init.d/functions - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -60,8 +58,9 @@ prog="cloud-init" cloud_init="/usr/bin/cloud-init" conf="/etc/cloud/cloud.cfg" -# If there exists a sysconfig variable override file use it... +# If there exist sysconfig/default variable override files use it... [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init +[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init start() { [ -x $cloud_init ] || return 5 @@ -80,8 +79,6 @@ stop() { return $RETVAL } -. /etc/init.d/functions - case "$1" in start) start diff --git a/sysvinit/cloud-init-local b/sysvinit/cloud-init-local index 0c63b9b0..b53e0db2 100755 --- a/sysvinit/cloud-init-local +++ b/sysvinit/cloud-init-local @@ -29,15 +29,13 @@ # Should-Start: $time # Required-Stop: # Should-Stop: -# Default-Start: 3 5 -# Default-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: The initial cloud-init job (local fs contingent) # Description: Start cloud-init and runs the initialization phases # and any associated initial modules as desired. ### END INIT INFO -. /etc/init.d/functions - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -60,8 +58,9 @@ prog="cloud-init" cloud_init="/usr/bin/cloud-init" conf="/etc/cloud/cloud.cfg" -# If there exists a sysconfig variable override file use it... +# If there exist sysconfig/default variable override files use it... [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init +[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init start() { [ -x $cloud_init ] || return 5 @@ -80,8 +79,6 @@ stop() { return $RETVAL } -. /etc/init.d/functions - case "$1" in start) start diff --git a/templates/sources.list.debian.tmpl b/templates/sources.list.debian.tmpl new file mode 100644 index 00000000..609bc6bd --- /dev/null +++ b/templates/sources.list.debian.tmpl @@ -0,0 +1,28 @@ +\## Note, this file is written by cloud-init on first boot of an instance +\## modifications made here will not survive a re-bundle. +\## if you wish to make changes you can: +\## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg +\## or do the same in user-data +\## b.) add sources in /etc/apt/sources.list.d +\## c.) make changes to template file /etc/cloud/templates/sources.list.debian.tmpl +\### + +# See http://www.debian.org/releases/stable/i386/release-notes/ch-upgrading.html +# for how to upgrade to newer versions of the distribution. +deb $mirror $codename main contrib non-free +deb-src $mirror $codename main contrib non-free + +\## Major bug fix updates produced after the final release of the +\## distribution. +deb $security $codename/updates main contrib non-free +deb-src $security $codename/updates main contrib non-free +deb $mirror $codename-updates main contrib non-free +deb-src $mirror $codename-updates main contrib non-free + +\## Uncomment the following two lines to add software from the 'backports' +\## repository. +\## N.B. software from this repository may not have been tested as +\## extensively as that contained in the main release, although it includes +\## newer versions of some applications which may provide useful features. +# deb http://backports.debian.org/debian-backports $codename-backports main contrib non-free +# deb-src http://backports.debian.org/debian-backports $codename-backports main contrib non-free diff --git a/templates/sources.list.tmpl b/templates/sources.list.ubuntu.tmpl index ce395b3d..ce395b3d 100644 --- a/templates/sources.list.tmpl +++ b/templates/sources.list.ubuntu.tmpl |