diff --git a/diskimage_builder/disk_image_create.py b/diskimage_builder/disk_image_create.py index 35388d148..67da2045a 100644 --- a/diskimage_builder/disk_image_create.py +++ b/diskimage_builder/disk_image_create.py @@ -60,6 +60,10 @@ def main(): # pre-seed some paths for the shell script environ['_LIB'] = diskimage_builder.paths.get_path('lib') + # export the path to the current python + if not os.environ.get('DIB_PYTHON_EXEC'): + os.environ['DIB_PYTHON_EXEC'] = sys.executable + # we have to handle being called as "disk-image-create" or # "ramdisk-image-create". ramdisk-iamge-create is just a symlink # to disk-image-create diff --git a/diskimage_builder/elements/package-installs/extra-data.d/99-squash-package-install b/diskimage_builder/elements/package-installs/extra-data.d/99-squash-package-install index 1f3e6a8c0..37c8f5f4c 100755 --- a/diskimage_builder/elements/package-installs/extra-data.d/99-squash-package-install +++ b/diskimage_builder/elements/package-installs/extra-data.d/99-squash-package-install @@ -5,8 +5,4 @@ fi set -eu set -o pipefail -# Search for python first in case we are in a venv with python3 which -# should take precedence -python_path=$(command -v python || command -v python2 || command -v python3) - -sudo -E $python_path $(dirname $0)/../bin/package-installs-squash --elements="$IMAGE_ELEMENT" --path=$ELEMENTS_PATH $TMP_MOUNT_PATH/tmp/package-installs.json +sudo -E $DIB_PYTHON_EXEC $(dirname $0)/../bin/package-installs-squash --elements="$IMAGE_ELEMENT" --path=$ELEMENTS_PATH $TMP_MOUNT_PATH/tmp/package-installs.json