Don't provide dib-run-parts
It was an oversight during v2 development for dib to start providing dib-run-parts. The intention was for dib to use a vendored dib-run-parts directly from $_LIB and have no dependencies on dib-utils at all. By exporting dib-run-parts, we created an unintentional conflict with the dib-utils package which provides the same script. Tools that depend on dib-utils are unaffected by this (os-refresh-config). The only tool that installs diskimage-builder and then assumes dib-run-parts is available in the path is instack. I have proposed Ibfe972208df40fa092b11b5419043524c903f1b4 to modify that to use our internal version. Change-Id: I149c345d38d761a49b3a6ccc4833482f09f1cd05
This commit is contained in:
parent
8e822768f9
commit
fd424757a6
@ -1,37 +0,0 @@
|
||||
# Copyright 2016 Ian Wienand (iwienand@redhat.com)
|
||||
#
|
||||
# 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.
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
import diskimage_builder.paths
|
||||
|
||||
|
||||
# simply wrap the dib-run-parts in lib
|
||||
#
|
||||
# Note to would-be modifiers : the same dib-run-parts script we are
|
||||
# calling in "lib" here is actually copied into the chroot's
|
||||
# /usr/local/bin by the dib-run-parts element, where it is run diretly
|
||||
# by disk-image-create. Ergo, if you do something clever in here, it
|
||||
# won't be reflected in the dib-run-parts that actually runs in the
|
||||
# chroot. It may not always be like this, but it does reduce reliance
|
||||
# on Python inside the chroot image.
|
||||
def main():
|
||||
environ = os.environ
|
||||
|
||||
script = "%s/%s" % (diskimage_builder.paths.get_path('lib'),
|
||||
os.path.basename(sys.argv[0]))
|
||||
|
||||
os.execve("/bin/bash", ['bash', script] + sys.argv[1:], environ)
|
@ -4,4 +4,7 @@ dib-run-parts
|
||||
|
||||
Install ``dib-run-parts`` into the chroot environment
|
||||
|
||||
|
||||
Currently this element copies the ``dib-run-parts`` used by
|
||||
diskimage-builder outside the chroot to inside. However, note while
|
||||
the interface remains the same this element may be provided in future
|
||||
with a different interface.
|
||||
|
@ -14,6 +14,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# This is the "internal" verison of dib-run-parts. Note the currently
|
||||
# this is copied by the dib-run-parts element into the chroot. If you
|
||||
# modify this, be aware that it needs to run in both contexts.
|
||||
DIB_RUN_PARTS=${_LIB}/dib-run-parts
|
||||
|
||||
function tmpfs_check() {
|
||||
local echo_message=${1:-1}
|
||||
[ "$DIB_NO_TMPFS" == "0" ] || return 1
|
||||
@ -223,12 +228,12 @@ function run_d() {
|
||||
if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then
|
||||
echo "Running hooks from ${TMP_HOOKS_PATH}/$1.d"
|
||||
if [ -n "$2" ]; then
|
||||
dib-run-parts ${TMP_HOOKS_PATH}/$1.d | tee $2
|
||||
${DIB_RUN_PARTS} ${TMP_HOOKS_PATH}/$1.d | tee $2
|
||||
if [[ ${PIPESTATUS[0]} != 0 ]]; then
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
dib-run-parts ${TMP_HOOKS_PATH}/$1.d
|
||||
${DIB_RUN_PARTS} ${TMP_HOOKS_PATH}/$1.d
|
||||
fi
|
||||
fi
|
||||
check_break after-$1 bash
|
||||
|
0
diskimage_builder/lib/dib-run-parts
Normal file → Executable file
0
diskimage_builder/lib/dib-run-parts
Normal file → Executable file
@ -86,6 +86,8 @@ function run_d_in_target () {
|
||||
check_break before-$1 run_in_target bash
|
||||
[ -z "$break_outside_target" ] && in_target_arg="run_in_target" || in_target_arg=
|
||||
trap "check_break after-error $in_target_arg ${break_cmd:-bash}" ERR
|
||||
# NOTE: this is the dib-run-parts copied into the chroot by the
|
||||
# dib-run-parts element.
|
||||
run_in_target dib-run-parts /tmp/in_target.d/$1.d
|
||||
trap - ERR
|
||||
check_break after-$1 run_in_target bash
|
||||
|
9
releasenotes/notes/dib-run-parts-e18cc3a6c2d66c24.yaml
Normal file
9
releasenotes/notes/dib-run-parts-e18cc3a6c2d66c24.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
dib no longer exports ``dib-run-parts``. Adding this was an
|
||||
oversight made during v2 development, since ``dib-utils`` already
|
||||
provides this. The ``dib-run-parts`` used internally
|
||||
(``diskimage_builder/lib/dib-run-parts``) is not intended to be
|
||||
used by external tools. If you require ``dib-run-parts``, you
|
||||
should install the ``dib-utils`` package.
|
@ -55,7 +55,6 @@ console_scripts =
|
||||
dib-block-device = diskimage_builder.block_device:main
|
||||
disk-image-create = diskimage_builder.disk_image_create:main
|
||||
ramdisk-image-create = diskimage_builder.disk_image_create:main
|
||||
dib-run-parts = diskimage_builder.dib_run_parts:main
|
||||
|
||||
diskimage_builder.block_device.plugin =
|
||||
local_loop = diskimage_builder.block_device.level0.localloop:LocalLoop
|
||||
|
Loading…
Reference in New Issue
Block a user