Commit 60273fc3 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

delete file system tables

parent 46096a84
...@@ -61,7 +61,27 @@ def print_help(): ...@@ -61,7 +61,27 @@ def print_help():
print(" ~$ python make_sdcard.py /dev/sdz someimage.img") print(" ~$ python make_sdcard.py /dev/sdz someimage.img")
print(" * To write *.iso use a standard os tool that burns bootable USB drives") print(" * To write *.iso use a standard os tool that burns bootable USB drives")
print("") print("")
def check_program_installed(program):
try:
result = subprocess.check_output("which "+program,shell=True)
except subprocess.CalledProcessError:
print("Program missing: "+program)
return False
return True
required_programs = (
"parted",
"kpartx"
)
something_is_missing = False
for i in required_programs:
tmpres = check_program_installed(i)
something_is_missing = something_is_missing or (not tmpres)
if something_is_missing:
sys.exit()
if len(sys.argv) > 1: if len(sys.argv) > 1:
DEVICE = sys.argv[1] DEVICE = sys.argv[1]
else: else:
...@@ -77,6 +97,7 @@ if len(sys.argv) > 2: ...@@ -77,6 +97,7 @@ if len(sys.argv) > 2:
else: else:
IMAGE_FILE = "" IMAGE_FILE = ""
print("NOTE: if plasma crash do not worry")
#params #params
SDCARD_SIZE = 4000 SDCARD_SIZE = 4000
...@@ -118,18 +139,20 @@ if not os.path.exists(DEVICE): ...@@ -118,18 +139,20 @@ if not os.path.exists(DEVICE):
if something_is_missing: if something_is_missing:
sys.exit() sys.exit()
print("= Erase partition table on "+DEVICE) print("= Erase partition table on "+DEVICE+" and everything else")
shout("dd if=/dev/zero of="+DEVICE+" bs=512 count=2048") shout("dd if=/dev/zero of="+DEVICE+" bs=1M count="+str(BOOT_SIZE+2))
print("= Create partition table") print("= Create partition table")
shout("parted -s "+DEVICE+" mktable "+PT_TYPE) shout("parted -s "+DEVICE+" mktable "+PT_TYPE)
print("= Create FAT32 parttion") print("= Create FAT parttion")
shout("parted -s "+DEVICE+" mkpart primary "+BOOT_FS+" 1 "+str(BOOT_SIZE)) shout("parted -s "+DEVICE+" mkpart primary "+BOOT_FS+" 1 "+str(BOOT_SIZE))
shout("parted -s "+DEVICE+" mkpart primary "+ROOT_FS+" "+str(BOOT_SIZE+1)+" 100%") shout("parted -s "+DEVICE+" mkpart primary "+ROOT_FS+" "+str(BOOT_SIZE+1)+" 100%")
# no need? # no need?
shout("parted -s "+DEVICE+" align-check optimal 1") #shout("parted -s "+DEVICE+" align-check optimal 1")
shout("parted -s "+DEVICE+" align-check optimal 2") #shout("parted -s "+DEVICE+" align-check optimal 2")
#sys.exit()
devs_created = False devs_created = False
while not devs_created: while not devs_created:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment