[docker]: change hardcoded value to DOCKERFS_DIR for docker directory on the disk (#269)
This commit is contained in:
parent
2358678497
commit
8826beb597
@ -267,7 +267,7 @@ sudo du -hs $FILESYSTEM_ROOT
|
|||||||
sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker
|
sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker
|
||||||
|
|
||||||
## Compress docker files
|
## 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
|
## 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
|
pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/; popd
|
||||||
|
@ -45,7 +45,7 @@ extract_image() {
|
|||||||
rm -rf "$target_path/rw"
|
rm -rf "$target_path/rw"
|
||||||
|
|
||||||
## Clean docker directory
|
## Clean docker directory
|
||||||
rm -rf "$target_path/var"
|
rm -rf "$target_path/{{ DOCKERFS_DIR }}"
|
||||||
|
|
||||||
## Unzip the image
|
## Unzip the image
|
||||||
unzip -oq "$swipath" -x boot0 -d "$target_path"
|
unzip -oq "$swipath" -x boot0 -d "$target_path"
|
||||||
@ -58,8 +58,10 @@ extract_image() {
|
|||||||
|
|
||||||
## vfat does not support symbol link
|
## vfat does not support symbol link
|
||||||
if [ $rootfs_type != "vfat" ]; then
|
if [ $rootfs_type != "vfat" ]; then
|
||||||
## Further extract docker archive
|
mkdir -p "$target_path/{{ DOCKERFS_DIR }}"
|
||||||
tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path"
|
|
||||||
|
## extract docker archive
|
||||||
|
tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path/{{ DOCKERFS_DIR }}"
|
||||||
|
|
||||||
## clean up docker archive
|
## clean up docker archive
|
||||||
rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}"
|
rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}"
|
||||||
|
@ -165,7 +165,7 @@ cmd="mount -t ext4 $root_dev $root_mnt"
|
|||||||
run_cmd "$cmd" "$err_msg"
|
run_cmd "$cmd" "$err_msg"
|
||||||
|
|
||||||
err_msg="Error: extract docker directory"
|
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"
|
run_cmd "$cmd" "$err_msg"
|
||||||
|
|
||||||
err_msg="Error: copying files form $tmp_mnt to $root_mnt failed"
|
err_msg="Error: copying files form $tmp_mnt to $root_mnt failed"
|
@ -12,7 +12,7 @@ mount -n -o dirs=${rootmnt}/host/rw:${rootmnt}=ro -t aufs root-aufs ${rootmnt}
|
|||||||
mount ${ROOT} ${rootmnt}/host
|
mount ${ROOT} ${rootmnt}/host
|
||||||
## Mount the working directory of docker engine in the raw partition, bypass the aufs
|
## Mount the working directory of docker engine in the raw partition, bypass the aufs
|
||||||
mkdir -p ${rootmnt}/var/lib/docker
|
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
|
## Mount the boot directory in the raw partition, bypass the aufs
|
||||||
mkdir -p ${rootmnt}/boot
|
mkdir -p ${rootmnt}/boot
|
||||||
mount --bind ${rootmnt}/host/boot ${rootmnt}/boot
|
mount --bind ${rootmnt}/host/boot ${rootmnt}/boot
|
@ -398,7 +398,7 @@ ${onie_bin} mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || {
|
|||||||
unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt
|
unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt
|
||||||
|
|
||||||
if [ -f $demo_mnt/$FILESYSTEM_DOCKERFS ]; then
|
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
|
fi
|
||||||
|
|
||||||
# Store machine description in target file system
|
# Store machine description in target file system
|
||||||
|
@ -21,6 +21,9 @@ ONIE_INSTALLER_PAYLOAD=fs.zip
|
|||||||
## Filename for docker file system
|
## Filename for docker file system
|
||||||
FILESYSTEM_DOCKERFS=dockerfs.tar.gz
|
FILESYSTEM_DOCKERFS=dockerfs.tar.gz
|
||||||
|
|
||||||
|
## docker directory on the root filesystem
|
||||||
|
DOCKERFS_DIR=docker
|
||||||
|
|
||||||
## Output file name for onie installer
|
## Output file name for onie installer
|
||||||
OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin
|
OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin
|
||||||
|
|
||||||
|
5
slave.mk
5
slave.mk
@ -285,7 +285,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# targets for building installers with base image
|
# 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)
|
$(HEADER)
|
||||||
## Pass initramfs and linux kernel explicitly. They are used for all platforms
|
## Pass initramfs and linux kernel explicitly. They are used for all platforms
|
||||||
export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)"
|
export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)"
|
||||||
@ -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_start_scrips="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))"
|
||||||
export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(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),
|
$(if $($*_DOCKERS),
|
||||||
j2 files/build_templates/sonic_debian_extension.j2 > sonic_debian_extension.sh
|
j2 files/build_templates/sonic_debian_extension.j2 > sonic_debian_extension.sh
|
||||||
chmod +x sonic_debian_extension.sh,
|
chmod +x sonic_debian_extension.sh,
|
||||||
|
Loading…
Reference in New Issue
Block a user