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

[docker]: change hardcoded value to DOCKERFS_DIR for docker directory… #269

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
2 changes: 1 addition & 1 deletion build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ sudo du -hs $FILESYSTEM_ROOT
sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker

## Compress docker files
pushd $FILESYSTEM_ROOT && sudo tar czf $OLDPWD/$FILESYSTEM_DOCKERFS var/lib/docker; popd
pushd $FILESYSTEM_ROOT && sudo tar czf $OLDPWD/$FILESYSTEM_DOCKERFS -C var/lib/docker .; popd

## Compress together with /boot and /var/lib/docker as an installer payload zip file
pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/; popd
Expand Down
8 changes: 5 additions & 3 deletions files/Aboot/boot0.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extract_image() {
rm -rf "$target_path/rw"

## Clean docker directory
rm -rf "$target_path/var"
rm -rf "$target_path/{{ DOCKERFS_DIR }}"

## Unzip the image
unzip -oq "$swipath" -x boot0 -d "$target_path"
Expand All @@ -58,8 +58,10 @@ extract_image() {

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

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

## clean up docker archive
rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ 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"
cmd="[ -f $tmp_mnt/{{ FILESYSTEM_DOCKERFS }} ] && rm -rf $root_mnt/{{ DOCKERFS_DIR }} && mkdir $root_mnt/{{ DOCKERFS_DIR }} && tar xzf $tmp_mnt/{{ FILESYSTEM_DOCKERFS }} -C $root_mnt/{{ DOCKERFS_DIR }} && rm -f $tmp_mnt/{{ FILESYSTEM_DOCKERFS }}"
run_cmd "$cmd" "$err_msg"

err_msg="Error: copying files form $tmp_mnt to $root_mnt failed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mount -n -o dirs=${rootmnt}/host/rw:${rootmnt}=ro -t aufs root-aufs ${rootmnt}
mount ${ROOT} ${rootmnt}/host
## Mount the working directory of docker engine in the raw partition, bypass the aufs
mkdir -p ${rootmnt}/var/lib/docker
mount --bind ${rootmnt}/host/var/lib/docker ${rootmnt}/var/lib/docker
mount --bind ${rootmnt}/host/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker
## Mount the boot directory in the raw partition, bypass the aufs
mkdir -p ${rootmnt}/boot
mount --bind ${rootmnt}/host/boot ${rootmnt}/boot
2 changes: 1 addition & 1 deletion installer/x86_64/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ ${onie_bin} mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || {
unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt

if [ -f $demo_mnt/$FILESYSTEM_DOCKERFS ]; then
cd $demo_mnt && tar xf $FILESYSTEM_DOCKERFS; cd $OLDPWD
cd $demo_mnt && mkdir -p $DOCKERFS_DIR && tar xf $FILESYSTEM_DOCKERFS -C $DOCKERFS_DIR; cd $OLDPWD
fi

# Store machine description in target file system
Expand Down
3 changes: 3 additions & 0 deletions onie-image.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ ONIE_INSTALLER_PAYLOAD=fs.zip
## Filename for docker file system
FILESYSTEM_DOCKERFS=dockerfs.tar.gz

## docker directory on the root filesystem
DOCKERFS_DIR=docker

## Output file name for onie installer
OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin

Expand Down
5 changes: 4 additions & 1 deletion slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA
###############################################################################

# targets for building installers with base image
$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS))
$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS))
$(HEADER)
## Pass initramfs and linux kernel explicitly. They are used for all platforms
export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)"
Expand All @@ -310,6 +310,9 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform
export installer_start_scrips="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))"
export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker)_CONTAINER_NAME)))"

j2 -f env files/initramfs-tools/union-mount.j2 onie-image.conf > files/initramfs-tools/union-mount
j2 -f env files/initramfs-tools/arista-convertfs.j2 onie-image.conf > files/initramfs-tools/arista-convertfs

$(if $($*_DOCKERS),
j2 files/build_templates/sonic_debian_extension.j2 > sonic_debian_extension.sh
chmod +x sonic_debian_extension.sh,
Expand Down