From c2c0d5cbf7b8c8d74c7b78e0bb20ebcc0603ea91 Mon Sep 17 00:00:00 2001 From: Eric Helgeson Date: Thu, 13 May 2021 12:20:36 -0500 Subject: [PATCH] Use truncate instead of dd --- easyinstall.sh | 2 +- src/web/file_cmds.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/easyinstall.sh b/easyinstall.sh index e5ee7499..d2688e23 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -221,7 +221,7 @@ function createDrive() { if [ ! -f $drivePath ]; then echo "Creating a ${driveSize}MB Drive" - dd if=/dev/zero of=$drivePath bs=1M count=$driveSize + truncate --size ${driveSize}m $drivePath echo "Formatting drive with HFS" formatDrive "$drivePath" "$driveName" diff --git a/src/web/file_cmds.py b/src/web/file_cmds.py index c424f82f..7ca5d19e 100644 --- a/src/web/file_cmds.py +++ b/src/web/file_cmds.py @@ -17,7 +17,7 @@ def create_new_image(file_name, type, size): file_name = file_name + "." + type return subprocess.run( - ["dd", "if=/dev/zero", "of=" + base_dir + file_name, "bs=1M", "count=" + size], + ["truncate", "--size", f"{size}m", f"{base_dir}{file_name}"], capture_output=True, )