Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aboot]: use pipe to extract docker archive to save disk space #677

Merged
merged 1 commit into from
Jun 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions files/Aboot/boot0.j2
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,8 @@ extract_image() {

mkdir -p "$image_path"

## Unzip the image
unzip -oq "$swipath" -x boot0 -d "$image_path"

## Remove installer swi as it has lots of redundunt contents
rm -f $swipath
## Unzip the image except boot0 and dockerfs archive
unzip -oq "$swipath" -x boot0 {{ FILESYSTEM_DOCKERFS }} -d "$image_path"

## detect rootfs type
rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3`
Expand All @@ -75,17 +72,19 @@ extract_image() {
fi

## extract docker archive
tar xf "$image_path/{{ FILESYSTEM_DOCKERFS }}" -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION

## clean up docker archive
rm -f "$image_path/{{ FILESYSTEM_DOCKERFS }}"
unzip -oqp "$swipath" {{ FILESYSTEM_DOCKERFS }} | tar xzf - -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION
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"
fi

## use new reduced-size boot swi
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
}
Expand Down