[aboot]: use pipe to extract docker archive to save disk space (#677)
This commit is contained in:
parent
fedfb82ebf
commit
b968cf73a1
@ -57,11 +57,8 @@ extract_image() {
|
|||||||
|
|
||||||
mkdir -p "$image_path"
|
mkdir -p "$image_path"
|
||||||
|
|
||||||
## Unzip the image
|
## Unzip the image except boot0 and dockerfs archive
|
||||||
unzip -oq "$swipath" -x boot0 -d "$image_path"
|
unzip -oq "$swipath" -x boot0 {{ FILESYSTEM_DOCKERFS }} -d "$image_path"
|
||||||
|
|
||||||
## Remove installer swi as it has lots of redundunt contents
|
|
||||||
rm -f $swipath
|
|
||||||
|
|
||||||
## detect rootfs type
|
## detect rootfs type
|
||||||
rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3`
|
rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3`
|
||||||
@ -75,17 +72,19 @@ extract_image() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
## extract docker archive
|
## extract docker archive
|
||||||
tar xf "$image_path/{{ FILESYSTEM_DOCKERFS }}" -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION
|
unzip -oqp "$swipath" {{ FILESYSTEM_DOCKERFS }} | tar xzf - -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION
|
||||||
|
|
||||||
## clean up docker archive
|
|
||||||
rm -f "$image_path/{{ FILESYSTEM_DOCKERFS }}"
|
|
||||||
else
|
else
|
||||||
|
## save dockerfs archive in the image directory
|
||||||
|
unzip -oq "$swipath" {{ FILESYSTEM_DOCKERFS }} -d "$image_path"
|
||||||
echo "$target_path is $rootfs_type, extract {{ FILESYSTEM_DOCKERFS }} in later stage"
|
echo "$target_path is $rootfs_type, extract {{ FILESYSTEM_DOCKERFS }} in later stage"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## use new reduced-size boot swi
|
## use new reduced-size boot swi
|
||||||
echo "SWI=flash:image-%%IMAGE_VERSION%%/{{ ABOOT_BOOT_IMAGE }}" > "$target_path/boot-config"
|
echo "SWI=flash:image-%%IMAGE_VERSION%%/{{ ABOOT_BOOT_IMAGE }}" > "$target_path/boot-config"
|
||||||
|
|
||||||
|
## Remove installer swi as it has lots of redundunt contents
|
||||||
|
rm -f "$swipath"
|
||||||
|
|
||||||
## sync disk operations
|
## sync disk operations
|
||||||
sync
|
sync
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user