From 474349979a1a3b6a65486edf7c1e033543446308 Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 7 Apr 2021 16:32:10 +0530 Subject: [PATCH 01/15] Adding mount size --- installer/sharch_body.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index d22fe26b6..c59907624 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -31,7 +31,8 @@ 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) + mount -o size="${mount_size}K" -t tmpfs tmpfs-installer $tmp_dir || exit 1 fi cd $tmp_dir echo -n "Preparing image archive ..." From 707747d84cadaf02c2389cacfca1cfe19a8ae12f Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Tue, 27 Apr 2021 11:07:46 +0530 Subject: [PATCH 02/15] Updating mount size --- installer/sharch_body.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index c59907624..c9a57cdf4 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -25,14 +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) - mount -o size="${mount_size}K" -t tmpfs tmpfs-installer $tmp_dir || exit 1 + if [ "$mount_size" -lt "$((image_size*3))" ]; then + mount_size=$((image_size*3)) + mount -o remount,size="${mount_size}K" -t tmpfs tmpfs-installer $tmp_dir || exit 1 + fi fi cd $tmp_dir echo -n "Preparing image archive ..." From 8438c340bf1bdc7ac51ff899bf70520c8b7e47cf Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 28 Apr 2021 10:33:25 +0530 Subject: [PATCH 03/15] Align mount_size to next power of 2 --- installer/sharch_body.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index c9a57cdf4..6dd8a8106 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -35,7 +35,8 @@ 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 - mount_size=$((image_size*3)) + #align mount_size to next power of two + mount_size=$(echo $((image_size*3)) | awk '{ print 2^int(((log($1)/log(2))+ 1)) }') mount -o remount,size="${mount_size}K" -t tmpfs tmpfs-installer $tmp_dir || exit 1 fi fi From d4f43e944f63a912aeba41c07aa1fb739f674ccb Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 28 Apr 2021 14:50:29 +0530 Subject: [PATCH 04/15] Updating mount_size in Gb --- installer/sharch_body.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index 6dd8a8106..1a8e4c33a 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -35,9 +35,8 @@ 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 - #align mount_size to next power of two - mount_size=$(echo $((image_size*3)) | awk '{ print 2^int(((log($1)/log(2))+ 1)) }') - mount -o remount,size="${mount_size}K" -t tmpfs tmpfs-installer $tmp_dir || exit 1 + mount_size=$((((image_size*3)/1000/1000)+1)) + mount -o remount,size="${mount_size}G" -t tmpfs tmpfs-installer $tmp_dir || exit 1 fi fi cd $tmp_dir From d9de9b3ef8a1fa21638f669cb278353ca9b76181 Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 28 Apr 2021 15:45:45 +0530 Subject: [PATCH 05/15] updating mount size --- installer/sharch_body.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index 1a8e4c33a..4448f44a5 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -35,7 +35,7 @@ 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 - mount_size=$((((image_size*3)/1000/1000)+1)) + 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 From 98312e7240cc9704379012b8b5749ed5c4eb1c59 Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Mon, 17 May 2021 16:37:55 +0530 Subject: [PATCH 06/15] update command to get actual size of compressed image. --- installer/sharch_body.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index 4448f44a5..7f03c6ec6 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -25,7 +25,7 @@ fi echo " OK." -image_size=$(du "$0" | awk '{print $1}') +image_size=$(( $(sed -e '1,/^exit_marker$/d' "$0" | tar --to-stdout -xf - | wc -c) / 1024)) # Untar and launch install script in a tmpfs cur_wd=$(pwd) export cur_wd From 06c2388a00bda2c519183e02154573c2bd42fbf9 Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Tue, 18 May 2021 17:47:20 +0530 Subject: [PATCH 07/15] updating image size check --- installer/sharch_body.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index 7f03c6ec6..d2d14020f 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -34,7 +34,7 @@ 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 + if [ "$mount_size" -lt "$((image_size))" ] || [ "$mount_size" -eq "$((image_size))" ]; then mount_size=$((((image_size*3)/1024/1024)+1)) mount -o remount,size="${mount_size}G" -t tmpfs tmpfs-installer $tmp_dir || exit 1 fi From da117660076736c7fd93f122baddd1becc464ef2 Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 19 May 2021 14:11:04 +0530 Subject: [PATCH 08/15] Add paddig to image size --- installer/sharch_body.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index d2d14020f..5efc8636f 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -25,6 +25,7 @@ fi echo " OK." +padding=102400 image_size=$(( $(sed -e '1,/^exit_marker$/d' "$0" | tar --to-stdout -xf - | wc -c) / 1024)) # Untar and launch install script in a tmpfs cur_wd=$(pwd) @@ -34,8 +35,8 @@ 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))" ] || [ "$mount_size" -eq "$((image_size))" ]; then - mount_size=$((((image_size*3)/1024/1024)+1)) + if [ "$mount_size" -le "$((image_size + $padding))" ]; then + mount_size=$((((image_size + $padding)/1024/1024)+1)) mount -o remount,size="${mount_size}G" -t tmpfs tmpfs-installer $tmp_dir || exit 1 fi fi From 538f077890dacbc1f964f8cb3cb3564f1e4bbdb8 Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 19 May 2021 15:58:54 +0530 Subject: [PATCH 09/15] Added comments for padding --- installer/sharch_body.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index 5efc8636f..e15fe66c8 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -25,7 +25,6 @@ fi echo " OK." -padding=102400 image_size=$(( $(sed -e '1,/^exit_marker$/d' "$0" | tar --to-stdout -xf - | wc -c) / 1024)) # Untar and launch install script in a tmpfs cur_wd=$(pwd) @@ -35,6 +34,8 @@ 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) + # Extra space for tmp + padding=102400 if [ "$mount_size" -le "$((image_size + $padding))" ]; then mount_size=$((((image_size + $padding)/1024/1024)+1)) mount -o remount,size="${mount_size}G" -t tmpfs tmpfs-installer $tmp_dir || exit 1 From 884b1695b639f1d7131a06339f552f9e62197e8b Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 19 May 2021 16:53:53 +0530 Subject: [PATCH 10/15] Updated padding --- installer/sharch_body.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index e15fe66c8..b1a2fa71d 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -36,8 +36,8 @@ if [ "$(id -u)" = "0" ] ; then mount_size=$(df $tmp_dir | tail -1 | tr -s ' ' | cut -d' ' -f4) # Extra space for tmp padding=102400 - if [ "$mount_size" -le "$((image_size + $padding))" ]; then - mount_size=$((((image_size + $padding)/1024/1024)+1)) + if [ "$mount_size" -le "$((image_size + padding))" ]; then + mount_size=$((((image_size + padding)/1024/1024)+1)) mount -o remount,size="${mount_size}G" -t tmpfs tmpfs-installer $tmp_dir || exit 1 fi fi From 3eca178443622ea907e7a87069439979a29a24ab Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 19 May 2021 18:19:12 +0530 Subject: [PATCH 11/15] Updating coment for padding --- installer/sharch_body.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index b1a2fa71d..faac492f0 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -34,7 +34,7 @@ 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) - # Extra space for tmp + # Adding extra 100K free space for tmp_dir padding=102400 if [ "$mount_size" -le "$((image_size + padding))" ]; then mount_size=$((((image_size + padding)/1024/1024)+1)) From 1d62e3f683d2104cd4152e520c74b1142d42ee15 Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 19 May 2021 20:52:44 +0530 Subject: [PATCH 12/15] update command --- installer/sharch_body.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index faac492f0..398553039 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -34,10 +34,10 @@ 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) - # Adding extra 100K free space for tmp_dir + #checking extra 100KB extra space in tmp_dir, after image extraction padding=102400 if [ "$mount_size" -le "$((image_size + padding))" ]; then - mount_size=$((((image_size + padding)/1024/1024)+1)) + mount_size=$(((image_size/1024/1024)+1)) mount -o remount,size="${mount_size}G" -t tmpfs tmpfs-installer $tmp_dir || exit 1 fi fi From d36f8aa4a2ea5528fbd1917c47887368abf6006b Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 19 May 2021 21:02:38 +0530 Subject: [PATCH 13/15] update command --- installer/sharch_body.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index 398553039..a24b21f1b 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -34,7 +34,7 @@ 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) - #checking extra 100KB extra space in tmp_dir, after image extraction + #checking extra 100KB space in tmp_dir, after image extraction padding=102400 if [ "$mount_size" -le "$((image_size + padding))" ]; then mount_size=$(((image_size/1024/1024)+1)) From 4f36d577a3ef8c5fc2113275d4b07ccbfac800c8 Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Tue, 15 Jun 2021 14:27:17 +0530 Subject: [PATCH 14/15] Updating mount size --- installer/sharch_body.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index a24b21f1b..815af7a57 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -24,8 +24,11 @@ if [ "$sha1" != "$payload_sha1" ] ; then fi echo " OK." +#Image size in KB +bytes=$((($(sed -e '1,/^exit_marker$/d' "$0" | tar --to-stdout -xf - | wc -c) + 1023 ) / 1024)) +#Image size in MB +image_size=$(((bytes + 1023) / 1024)) -image_size=$(( $(sed -e '1,/^exit_marker$/d' "$0" | tar --to-stdout -xf - | wc -c) / 1024)) # Untar and launch install script in a tmpfs cur_wd=$(pwd) export cur_wd @@ -37,8 +40,8 @@ if [ "$(id -u)" = "0" ] ; then #checking extra 100KB space in tmp_dir, after image extraction padding=102400 if [ "$mount_size" -le "$((image_size + padding))" ]; then - mount_size=$(((image_size/1024/1024)+1)) - mount -o remount,size="${mount_size}G" -t tmpfs tmpfs-installer $tmp_dir || exit 1 + mount_size=$((((image_size + 31) / 32) * 32)) + mount -o remount,size="${mount_size}M" -t tmpfs tmpfs-installer $tmp_dir || exit 1 fi fi cd $tmp_dir From 02227f06dcbe6bec0f0bbf11c3ba064259c7343b Mon Sep 17 00:00:00 2001 From: lkunjumon Date: Wed, 16 Jun 2021 12:32:53 +0530 Subject: [PATCH 15/15] update mountsize in MB and added 32MB extra free space for image extraction. --- installer/sharch_body.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index 815af7a57..19f46358a 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -24,10 +24,7 @@ if [ "$sha1" != "$payload_sha1" ] ; then fi echo " OK." -#Image size in KB -bytes=$((($(sed -e '1,/^exit_marker$/d' "$0" | tar --to-stdout -xf - | wc -c) + 1023 ) / 1024)) -#Image size in MB -image_size=$(((bytes + 1023) / 1024)) +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) @@ -36,12 +33,14 @@ 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) + 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 - if [ "$mount_size" -le "$((image_size + padding))" ]; then - mount_size=$((((image_size + 31) / 32) * 32)) - mount -o remount,size="${mount_size}M" -t tmpfs tmpfs-installer $tmp_dir || exit 1 + 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