mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-08-16 11:14:06 +00:00
Changes to add snaps to manifests
This commit is contained in:
parent
e453f96548
commit
5bd200fd7a
@ -551,6 +551,7 @@ fi
|
|||||||
|
|
||||||
# '--initramfs none' produces different manifest names.
|
# '--initramfs none' produces different manifest names.
|
||||||
if [ -e "binary/$INITFS/filesystem.packages" ]; then
|
if [ -e "binary/$INITFS/filesystem.packages" ]; then
|
||||||
|
./snap_seed_parse.py $CHROOT_ROOT >> "binary/$INITFS/filesystem.packages"
|
||||||
ln "binary/$INITFS/filesystem.packages" "$PREFIX.manifest"
|
ln "binary/$INITFS/filesystem.packages" "$PREFIX.manifest"
|
||||||
chmod 644 "$PREFIX.manifest"
|
chmod 644 "$PREFIX.manifest"
|
||||||
fi
|
fi
|
||||||
|
@ -43,6 +43,14 @@ create_empty_disk_image() {
|
|||||||
dd if=/dev/zero of="$1" bs=1 count=0 seek="${imagesize}"
|
dd if=/dev/zero of="$1" bs=1 count=0 seek="${imagesize}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
make_ext4_partition() {
|
make_ext4_partition() {
|
||||||
device="$1"
|
device="$1"
|
||||||
label=${fs_label:+-L "${fs_label}"}
|
label=${fs_label:+-L "${fs_label}"}
|
||||||
|
37
live-build/snap_seed_parse.py
Executable file
37
live-build/snap_seed_parse.py
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
"""
|
||||||
|
This file parses the seed.yaml file for the chroot and appends it to the
|
||||||
|
given manifest file.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
CHROOT_ROOT = sys.argv[1] if len(sys.argv) > 1 else ''
|
||||||
|
'''The chroot rooth path should be passed in by the caller'''
|
||||||
|
YAML_PATH = str(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'''
|
||||||
|
|
||||||
|
# Open the seed.yaml and ingest its contents
|
||||||
|
with open(YAML_PATH, 'r') as fh:
|
||||||
|
yaml_lines = yaml.load(fh)['snaps']
|
||||||
|
|
||||||
|
to_write = ''
|
||||||
|
# Loop over dict items, generating one manifest line from each
|
||||||
|
# triplet
|
||||||
|
for item in yaml_lines:
|
||||||
|
filestring = item['file']
|
||||||
|
revision = filestring[filestring.rindex('_')+1:]
|
||||||
|
revision = re.sub(r'[^0-9]', '', revision)
|
||||||
|
to_write += "{}{}\t{}\t{}\n".format(LINE_PREFIX,
|
||||||
|
item['name'],
|
||||||
|
item['channel'],
|
||||||
|
revision,
|
||||||
|
)
|
||||||
|
|
||||||
|
# write accumulated text to stdout for redirection
|
||||||
|
print(to_write.strip('\n'))
|
@ -26,4 +26,5 @@ mkdir -p $rootfs_dir/lib/modules
|
|||||||
|
|
||||||
teardown_mountpoint $rootfs_dir
|
teardown_mountpoint $rootfs_dir
|
||||||
|
|
||||||
dpkg-query --admindir=$rootfs_dir/var/lib/dpkg -W > $rootfs_dir.manifest
|
# 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
|
||||||
|
@ -28,7 +28,8 @@ cp -a chroot/* binary/boot/squashfs.dir
|
|||||||
squashfs_f="${PWD}/livecd.${PROJECT}.squashfs"
|
squashfs_f="${PWD}/livecd.${PROJECT}.squashfs"
|
||||||
squashfs_f_manifest="${squashfs_f}.manifest"
|
squashfs_f_manifest="${squashfs_f}.manifest"
|
||||||
|
|
||||||
dpkg-query --admindir=binary/boot/squashfs.dir/var/lib/dpkg -W > ${squashfs_f_manifest}
|
# dpkg-query --admindir=binary/boot/squashfs.dir/var/lib/dpkg -W > ${squashfs_f_manifest}
|
||||||
|
create_manifest "--admindir=binary/boot/squashfs.dir/var/lib/dpkg -W" "${squashfs_f_manifest}" "binary/boot/squashfs.dir"
|
||||||
|
|
||||||
(cd "binary/boot/squashfs.dir/" &&
|
(cd "binary/boot/squashfs.dir/" &&
|
||||||
mksquashfs . ${squashfs_f} \
|
mksquashfs . ${squashfs_f} \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user