allow editing filesystem.squashfs with inject-subiquity-snap

This commit is contained in:
Michael Hudson-Doyle 2017-12-19 15:51:39 +13:00
parent d77b4148ef
commit 168d372e68
1 changed files with 18 additions and 1 deletions

View File

@ -4,7 +4,8 @@ set -eux
cmds=
interactive=no
while getopts ":ic:" opt; do
edit_filesystem=no
while getopts ":ifc:" opt; do
case "${opt}" in
i)
interactive=yes
@ -12,6 +13,9 @@ while getopts ":ic:" opt; do
c)
cmds=$OPTARG
;;
f)
edit_filesystem=yes
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
@ -89,6 +93,14 @@ cp $SUBIQUITY_SNAP_PATH new_installer/var/lib/snapd/seed/snaps/
mkdir new_iso
add_overlay old_iso new_iso
if [ "$edit_filesystem" = "yes" ]; then
mkdir old_filesystem new_filesystem
mount -t squashfs old_iso/casper/filesystem.squashfs old_filesystem
add_mount old_filesystem
add_overlay old_filesystem new_filesystem
fi
if [ -n "$cmds" ]; then
bash -c "$cmds"
fi
@ -96,6 +108,11 @@ if [ "$interactive" = "yes" ]; then
bash
fi
if [ "$edit_filesystem" = "yes" ]; then
rm new_iso/casper/filesystem.squashfs
mksquashfs new_filesystem new_iso/casper/filesystem.squashfs
fi
rm new_iso/casper/installer.squashfs
mksquashfs new_installer new_iso/casper/installer.squashfs