Merge "Don't provide dib-run-parts"
This commit is contained in:
		| @@ -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 | 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 | # License for the specific language governing permissions and limitations | ||||||
| # under the License. | # 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() { | function tmpfs_check() { | ||||||
|   local echo_message=${1:-1} |   local echo_message=${1:-1} | ||||||
|   [ "$DIB_NO_TMPFS" == "0" ] || return 1 |   [ "$DIB_NO_TMPFS" == "0" ] || return 1 | ||||||
| @@ -223,12 +228,12 @@ function run_d() { | |||||||
|     if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then |     if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then | ||||||
|         echo "Running hooks from ${TMP_HOOKS_PATH}/$1.d" |         echo "Running hooks from ${TMP_HOOKS_PATH}/$1.d" | ||||||
|         if [ -n "$2" ]; then |         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 |             if [[ ${PIPESTATUS[0]} != 0 ]]; then | ||||||
|                 return 1 |                 return 1 | ||||||
|             fi |             fi | ||||||
|         else |         else | ||||||
|             dib-run-parts ${TMP_HOOKS_PATH}/$1.d |             ${DIB_RUN_PARTS} ${TMP_HOOKS_PATH}/$1.d | ||||||
|         fi |         fi | ||||||
|     fi |     fi | ||||||
|     check_break after-$1 bash |     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 |       check_break before-$1 run_in_target bash | ||||||
|       [ -z "$break_outside_target" ] && in_target_arg="run_in_target" || in_target_arg= |       [ -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 |       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 |       run_in_target dib-run-parts /tmp/in_target.d/$1.d | ||||||
|       trap - ERR |       trap - ERR | ||||||
|       check_break after-$1 run_in_target bash |       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 |     dib-block-device = diskimage_builder.block_device:main | ||||||
|     disk-image-create = diskimage_builder.disk_image_create:main |     disk-image-create = diskimage_builder.disk_image_create:main | ||||||
|     ramdisk-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 = | diskimage_builder.block_device.plugin = | ||||||
|     local_loop = diskimage_builder.block_device.level0.localloop:LocalLoop |     local_loop = diskimage_builder.block_device.level0.localloop:LocalLoop | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jenkins
					Jenkins