mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 01:06:27 +00:00
Fix swap.sh (#3897)
The script used to compare “10M” with “10” as if they were both integers. Signed-off-by: David Gageot <david.gageot@docker.com> Signed-off-by: David Gageot <david.gageot@docker.com>
This commit is contained in:
parent
e668b25a82
commit
f9f1ec7de4
@ -121,11 +121,13 @@ else
|
||||
SWAPDEV=$path
|
||||
fi
|
||||
|
||||
if [ ! -f $path ] || ! [ $(stat -c "%s" $path) == $(disksize_to_count 1 $size) ]; then
|
||||
count="$(disksize_to_count 1 $size)"
|
||||
|
||||
if [ ! -f $path ] || ! [ $(stat -c "%s" $path) == $count ]; then
|
||||
## Allocate the file
|
||||
## If possible use a large blocksize:
|
||||
bs=1048576 # 1 MiB
|
||||
if [ "$size" -lt "$bs" ]; then
|
||||
if [ "$count" -lt "$bs" ]; then
|
||||
bs=1024 # fall back to 1KiB
|
||||
fi
|
||||
dd if=/dev/zero of=$path bs=$bs count=$(disksize_to_count $bs $size)
|
||||
|
Loading…
Reference in New Issue
Block a user