Added absolute path for snap seed script, and cleaned up formatting

of some shell code.
This commit is contained in:
Cody Shepherd 2018-10-16 08:04:33 -07:00
parent 5bd200fd7a
commit 40c4519a20
No known key found for this signature in database
GPG Key ID: 0DB7E5F05C3FAB5F
5 changed files with 26 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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() {

View File

@ -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']

View File

@ -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}"