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]: extract dockerfs in initramfs stage when the root fs is vfat #266

Merged
merged 1 commit into from
Feb 6, 2017
Merged
Show file tree
Hide file tree
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
18 changes: 13 additions & 5 deletions files/Aboot/boot0.j2
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,19 @@ extract_image() {
## Remove installer swi as it has lots of redundunt contents
rm -f $swipath

## Further extract docker archive
tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path"

## clean up docker archive
rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}"
## detect rootfs type
rootfs_type=`grep /mnt/flash /proc/mounts | cut -d' ' -f3`

## vfat does not support symbol link
if [ $rootfs_type != "vfat" ]; then
## Further extract docker archive
tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path"

## clean up docker archive
rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}"
else
echo "/mnt/flash is $rootfs_type, extract {{ FILESYSTEM_DOCKERFS }} in later stage"
fi

## replace with boot swi
mv "$target_path/{{ ABOOT_BOOT_IMAGE }}" "$swipath"
Expand Down
5 changes: 4 additions & 1 deletion files/initramfs-tools/arista-convertfs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ err_msg="Error: mounting $root_dev to $root_mnt failed"
cmd="mount -t ext4 $root_dev $root_mnt"
run_cmd "$cmd" "$err_msg"

err_msg="Error: extract docker directory"
cmd="[ -f $tmp_mnt/dockerfs.tar.gz ] && rm -rf $tmp_mnt/var && tar xzf $tmp_mnt/dockerfs.tar.gz -C $root_mnt && rm -f $tmp_mnt/dockerfs.tar.gz"
run_cmd "$cmd" "$err_msg"

err_msg="Error: copying files form $tmp_mnt to $root_mnt failed"
cmd="cp -a $tmp_mnt/. $root_mnt/"
run_cmd "$cmd" "$err_msg"