Skip to content
Merged
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions installer/sharch_body.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@ fi

echo " OK."

image_size=$(du "$0" | awk '{print $1}')
# Untar and launch install script in a tmpfs
cur_wd=$(pwd)
export cur_wd
archive_path=$(realpath "$0")
tmp_dir=$(mktemp -d)
if [ "$(id -u)" = "0" ] ; then
mount -t tmpfs tmpfs-installer $tmp_dir || exit 1
mount_size=$(df $tmp_dir | tail -1 | tr -s ' ' | cut -d' ' -f4)
if [ "$mount_size" -lt "$((image_size*3))" ]; then
Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image_size*3

This seems an estimation. How do you know *3 is enough? Could you get the accurate required size? #Closed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that must be generated from the build process.

Copy link
Copy Markdown
Collaborator

@lguohan lguohan May 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use this to get the original size?

lgh@p330:~$ gzip -l docker-sonic-vs.gz 
         compressed        uncompressed  ratio uncompressed_name
          242618472           684168704  64.5% docker-sonic-vs

Copy link
Copy Markdown
Contributor

@antony-rheneus antony-rheneus May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script untars sonic-platform.bin, which is a ONIE image. We cannot use gzip command.
Will update the logic by getting image size from the "tar" command, excluding the ONIE installer script

Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image_size

Is image_sizes*1 is good enough? #Closed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have addressed the comment. Please review

mount_size=$((((image_size*3)/1024/1024)+1))
mount -o remount,size="${mount_size}G" -t tmpfs tmpfs-installer $tmp_dir || exit 1
fi
fi
cd $tmp_dir
echo -n "Preparing image archive ..."
Expand Down