d65678678e
Move dib-run-parts from dib-utils into diskimage-builder directly. For calling outside the chroot, we provide a standard entry-point script. However, as noted in the warning comment, the underlying script is still copied directly into the chroot by the dib-run-parts element. I believe this to be the KISS approach. This removes the dependency on dib-utils. We have discussed this previously and nobody seemed to think retiring dib-utils was going to be an issue. This also updates the documentation to not mention dib-utils, or using disk-image-create via $PATH setup, but rather gives instructions on installing from pip with a virtualenv. Change-Id: Ic1e22ba498d2c368da7d72e2e2b70ff34324feb8
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
# 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)
|