mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
disks: delete existing test file, if necessary
This commit is contained in:
parent
8ae6fbbd4c
commit
62aa3ce26a
@ -53,6 +53,9 @@ class Disk():
|
|||||||
directory = os.path.dirname(os.path.realpath(__file__))
|
directory = os.path.dirname(os.path.realpath(__file__))
|
||||||
disk_file = os.path.join(directory, 'temp_disk.img')
|
disk_file = os.path.join(directory, 'temp_disk.img')
|
||||||
|
|
||||||
|
if os.path.isfile(disk_file):
|
||||||
|
os.remove(disk_file)
|
||||||
|
|
||||||
command = 'dd if=/dev/zero of={file} bs=1M count={size}' \
|
command = 'dd if=/dev/zero of={file} bs=1M count={size}' \
|
||||||
.format(size=self.size, file=disk_file)
|
.format(size=self.size, file=disk_file)
|
||||||
subprocess.run(command.split(), stderr=subprocess.DEVNULL, check=True)
|
subprocess.run(command.split(), stderr=subprocess.DEVNULL, check=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user