summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diskimage_builder/elements/ubuntu-core/README.rst15
-rw-r--r--diskimage_builder/elements/ubuntu-core/element-deps3
-rw-r--r--diskimage_builder/elements/ubuntu-core/element-provides1
-rw-r--r--diskimage_builder/elements/ubuntu-core/environment.d/10-ubuntu-distro-name.bash1
-rw-r--r--diskimage_builder/elements/ubuntu-core/package-installs.yaml3
-rwxr-xr-xdiskimage_builder/elements/ubuntu-core/root.d/10-cache-ubuntu-image74
6 files changed, 0 insertions, 97 deletions
diff --git a/diskimage_builder/elements/ubuntu-core/README.rst b/diskimage_builder/elements/ubuntu-core/README.rst
deleted file mode 100644
index 559ae29..0000000
--- a/diskimage_builder/elements/ubuntu-core/README.rst
+++ /dev/null
@@ -1,15 +0,0 @@
1===========
2ubuntu-core
3===========
4Use Ubuntu Core cloud images as the baseline for built disk images.
5
6Overrides:
7
8 * To use a non-default URL for downloading base Ubuntu cloud images,
9 use the environment variable DIB\_CLOUD\_IMAGES
10 * To download a non-default release of Ubuntu cloud images, use the
11 environment variable DIB\_RELEASE
12 * To use different mirrors rather than the default of archive.ubuntu.com and
13 security.ubuntu.com, use the environment variable DIB\_DISTRIBUTION\_MIRROR
14
15.. element_deps::
diff --git a/diskimage_builder/elements/ubuntu-core/element-deps b/diskimage_builder/elements/ubuntu-core/element-deps
deleted file mode 100644
index 4b60983..0000000
--- a/diskimage_builder/elements/ubuntu-core/element-deps
+++ /dev/null
@@ -1,3 +0,0 @@
1cache-url
2dpkg
3ubuntu-common
diff --git a/diskimage_builder/elements/ubuntu-core/element-provides b/diskimage_builder/elements/ubuntu-core/element-provides
deleted file mode 100644
index a72e049..0000000
--- a/diskimage_builder/elements/ubuntu-core/element-provides
+++ /dev/null
@@ -1 +0,0 @@
1operating-system
diff --git a/diskimage_builder/elements/ubuntu-core/environment.d/10-ubuntu-distro-name.bash b/diskimage_builder/elements/ubuntu-core/environment.d/10-ubuntu-distro-name.bash
deleted file mode 100644
index 0fb9152..0000000
--- a/diskimage_builder/elements/ubuntu-core/environment.d/10-ubuntu-distro-name.bash
+++ /dev/null
@@ -1 +0,0 @@
1export DISTRO_NAME=ubuntu
diff --git a/diskimage_builder/elements/ubuntu-core/package-installs.yaml b/diskimage_builder/elements/ubuntu-core/package-installs.yaml
deleted file mode 100644
index 85d46ff..0000000
--- a/diskimage_builder/elements/ubuntu-core/package-installs.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
1apt-xapian-index:
2 phase: pre-install.d
3 uninstall: True
diff --git a/diskimage_builder/elements/ubuntu-core/root.d/10-cache-ubuntu-image b/diskimage_builder/elements/ubuntu-core/root.d/10-cache-ubuntu-image
deleted file mode 100755
index f3a36ab..0000000
--- a/diskimage_builder/elements/ubuntu-core/root.d/10-cache-ubuntu-image
+++ /dev/null
@@ -1,74 +0,0 @@
1#!/bin/bash
2# These are useful, or at worst not harmful, for all images we build.
3
4# dib-lint: disable=safe_sudo
5
6if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
7 set -x
8fi
9set -eu
10set -o pipefail
11
12[ -n "$ARCH" ]
13[ -n "$TARGET_ROOT" ]
14
15shopt -s extglob
16
17DIB_RELEASE=${DIB_RELEASE:-trusty}
18
19declare -A release_numbers
20release_numbers[trusty]=14.04
21release_numbers[vivid]=15.04
22release_numbers[wily]=15.10
23release_numbers[xenial]=16.04
24release_numbers[yakkety]=16.10
25release_numbers[zesty]=17.04
26release_numbers[bionic]=18.04
27
28numeric_release=${release_numbers[$DIB_RELEASE]}
29DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cdimage.ubuntu.com/ubuntu-core/releases/$numeric_release/release}
30BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-ubuntu-core-$numeric_release-core-$ARCH.tar.gz}
31SHA256SUMS=${SHA256SUMS:-$DIB_CLOUD_IMAGES/SHA256SUMS}
32CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
33CACHED_FILE_LOCK=$DIB_LOCKFILES/$BASE_IMAGE_FILE.lock
34CACHED_SUMS=$DIB_IMAGE_CACHE/SHA256SUMS.ubuntu-core.$DIB_RELEASE.$ARCH
35
36function get_ubuntu_tarball() {
37 if [ -n "$DIB_OFFLINE" -a -f "$CACHED_FILE" ] ; then
38 echo "Not checking freshness of cached $CACHED_FILE."
39 else
40 echo "Fetching Base Image"
41 $TMP_HOOKS_PATH/bin/cache-url $SHA256SUMS $CACHED_SUMS
42 $TMP_HOOKS_PATH/bin/cache-url \
43 $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $CACHED_FILE
44 pushd $DIB_IMAGE_CACHE
45 if ! grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - ; then
46 # It is likely that an upstream http(s) proxy has given us a skewed
47 # result - either a cached SHA file or a cached image. Use cache-busting
48 # to get (as long as caches are compliant...) fresh files.
49 # Try the sha256sum first, just in case that is the stale one (avoiding
50 # downloading the larger image), and then if the sums still fail retry
51 # the image.
52 $TMP_HOOKS_PATH/bin/cache-url -f $SHA256SUMS $CACHED_SUMS
53 if ! grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - ; then
54 $TMP_HOOKS_PATH/bin/cache-url -f \
55 $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $CACHED_FILE
56 grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check -
57 fi
58 fi
59 popd
60 fi
61 # Extract the base image (use --numeric-owner to avoid UID/GID mismatch between
62 # image tarball and host OS e.g. when building Ubuntu image on an openSUSE host)
63 sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
64}
65
66(
67 echo "Getting $CACHED_FILE_LOCK: $(date)"
68 # Wait up to 20 minutes for another process to download
69 if ! flock -w 1200 9 ; then
70 echo "Did not get $CACHED_FILE_LOCK: $(date)"
71 exit 1
72 fi
73 get_ubuntu_tarball
74) 9> $CACHED_FILE_LOCK