diff --git a/live-build/auto/build b/live-build/auto/build index ce32376c..80499b9b 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -551,7 +551,7 @@ fi # '--initramfs none' produces different manifest names. if [ -e "binary/$INITFS/filesystem.packages" ]; then - ./snap_seed_parse.py $CHROOT_ROOT >> "binary/$INITFS/filesystem.packages" + /build/config/snap_seed_parse ${CHROOT_ROOT} >> "binary/${INITFS}/filesystem.packages" ln "binary/$INITFS/filesystem.packages" "$PREFIX.manifest" chmod 644 "$PREFIX.manifest" fi diff --git a/live-build/auto/config b/live-build/auto/config index 5ab67fac..ee1dd181 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -33,6 +33,7 @@ fi mkdir -p config cp -af /usr/share/livecd-rootfs/live-build/functions config/functions +cp -af /usr/share/livecd-rootfs/live-build/snap_seed_parse.py config/snap_seed_parse mkdir -p config/package-lists diff --git a/live-build/functions b/live-build/functions index 393b79e2..e05e59ce 100644 --- a/live-build/functions +++ b/live-build/functions @@ -44,11 +44,12 @@ create_empty_disk_image() { } create_manifest() { - local dpkg_opts=$1 - local target_file=$2 - local chroot_root=$3 - dpkg-query $dpkg_opts > $target_file - ./snap_seed_parse.py $chroot_root >> $target_file + local dpkg_opts=${1} + local target_file=${2} + local chroot_root=${3} + dpkg-query ${dpkg_opts} > ${target_file} + (>&2 echo "create_manifest chroot_root: ${chroot_root}") + /build/config/snap_seed_parse "${chroot_root}" >> ${target_file} } make_ext4_partition() { diff --git a/live-build/snap_seed_parse.py b/live-build/snap_seed_parse.py index 0921248c..2227aac1 100755 --- a/live-build/snap_seed_parse.py +++ b/live-build/snap_seed_parse.py @@ -8,14 +8,29 @@ given manifest file. import re import sys import yaml +import os.path -CHROOT_ROOT = sys.argv[1] if len(sys.argv) > 1 else '' +sys.stderr.write("Parsing seed.yaml\n") + +CHROOT_ROOT = sys.argv[1] if len(sys.argv) > 1 and len(sys.argv[1]) > 0 \ + else '' '''The chroot rooth path should be passed in by the caller''' -YAML_PATH = str(CHROOT_ROOT) + 'var/lib/snapd/seed/seed.yaml' +sys.stderr.write("CHROOT_ROOT: {}\n".format(CHROOT_ROOT)) + +if len(CHROOT_ROOT) > 0 and CHROOT_ROOT[-1] == '/': + CHROOT_ROOT = CHROOT_ROOT[:-1] +YAML_PATH = CHROOT_ROOT + '/var/lib/snapd/seed/seed.yaml' '''This is where we expect to find the seed.yaml file''' LINE_PREFIX = 'snap:' '''Snaps are prepended with this string in the manifest''' +sys.stderr.write("yaml path: {}\n".format(YAML_PATH)) +if not os.path.isfile(YAML_PATH): + sys.stderr.write("yaml path not found.\n") + exit(0) +else: + sys.stderr.write("yaml path found.\n") + # Open the seed.yaml and ingest its contents with open(YAML_PATH, 'r') as fh: yaml_lines = yaml.load(fh)['snaps'] diff --git a/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary b/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary index 9b7266d1..3d29ef5e 100755 --- a/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary +++ b/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary @@ -27,4 +27,4 @@ mkdir -p $rootfs_dir/lib/modules teardown_mountpoint $rootfs_dir # dpkg-query --admindir=$rootfs_dir/var/lib/dpkg -W > $rootfs_dir.manifest -create_manifest "--admindir=$rootfs_dir/var/lib/dpkg -W" "$rootfs_dir.manifest" $roofs_dir +create_manifest "--admindir=${rootfs_dir}/var/lib/dpkg -W" "${rootfs_dir}.manifest" "${rootfs_dir}"