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

Adding mount size #48

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
10 changes: 10 additions & 0 deletions installer/sharch_body.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if [ "$sha1" != "$payload_sha1" ] ; then
fi

echo " OK."
image_size_in_kb=$((($(sed -e '1,/^exit_marker$/d' "$0" | tar --to-stdout -xf - | wc -c) + 1023 ) / 1024))

# Untar and launch install script in a tmpfs
cur_wd=$(pwd)
Expand All @@ -32,6 +33,15 @@ archive_path=$(realpath "$0")
tmp_dir=$(mktemp -d)
if [ "$(id -u)" = "0" ] ; then
mount -t tmpfs tmpfs-installer $tmp_dir || exit 1
mount_size_in_kb=$(df $tmp_dir | tail -1 | tr -s ' ' | cut -d' ' -f4)
#checking extra 100KB space in tmp_dir, after image extraction
padding=102400
Copy link
Contributor

Choose a reason for hiding this comment

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

write the size value, also in the comment in KBs or MBs

Copy link
Contributor

Choose a reason for hiding this comment

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

not adding, only checking extra space after extraction

Copy link
Author

Choose a reason for hiding this comment

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

@antony-rheneus pls review the comments

Copy link
Author

Choose a reason for hiding this comment

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

@antony-rheneus Please review updated commit.

if [ "$mount_size_in_kb" -le "$((image_size_in_kb + padding))" ]; then
image_size_in_mb=$(((image_size_in_kb + 1023) / 1024))
#Adding extra 32MB free space for image extraction.
mount_size_in_mb=$((((image_size_in_mb + 31) / 32) * 32))
mount -o remount,size="${mount_size_in_mb}M" -t tmpfs tmpfs-installer $tmp_dir || exit 1
fi
fi
cd $tmp_dir
echo -n "Preparing image archive ..."
Expand Down