X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Fsteps%2FInstallBootstrapFS.py;h=06f9807d4ab0af1648b85c7ad4aa4a53a4eb6ef0;hb=1e11592251ab599965bb7dc88b631d14e9be1a60;hp=db502acd50e2a0646e39e3a1e7898fc33640ff42;hpb=fbb0f48516a3d3fb8b2e67e700a0b7fa6dea0869;p=bootmanager.git diff --git a/source/steps/InstallBootstrapFS.py b/source/steps/InstallBootstrapFS.py index db502ac..06f9807 100644 --- a/source/steps/InstallBootstrapFS.py +++ b/source/steps/InstallBootstrapFS.py @@ -65,7 +65,7 @@ def Run(vars, log): val = PARTITIONS["root"] val = PARTITIONS["swap"] val = PARTITIONS["vservers"] - except KeyError, part: + except KeyError as part: log.write("Missing partition in PARTITIONS: {}\n".format(part)) return 0 @@ -142,8 +142,8 @@ def Run(vars, log): # Download SHA1 checksum file log.write("downloading sha1sum for {}\n".format(source_file)) result = bs_request.DownloadFile(source_hash_file, None, None, - 1, 1, dest_hash_file, - 30, 14400) + 1, 1, dest_hash_file, + 30, 14400) log.write("verifying sha1sum for {}\n".format(source_file)) if not utils.check_file_hash(dest_file, dest_hash_file): @@ -179,20 +179,26 @@ def Run(vars, log): log.write("Copying boot server certificates and public key\n") if os.path.exists("/usr/boot"): - utils.makedirs(SYSIMG_PATH + "/usr") - shutil.copytree("/usr/boot", SYSIMG_PATH + "/usr/boot") + # do nothing in case of upgrade + if not os.path.exists(SYSIMG_PATH + "/usr/boot"): + utils.makedirs(SYSIMG_PATH + "/usr") + shutil.copytree("/usr/boot", SYSIMG_PATH + "/usr/boot") elif os.path.exists("/usr/bootme"): - utils.makedirs(SYSIMG_PATH + "/usr/boot") - boot_server = file("/usr/bootme/BOOTSERVER").readline().strip() - shutil.copy("/usr/bootme/cacert/" + boot_server + "/cacert.pem", - SYSIMG_PATH + "/usr/boot/cacert.pem") - file(SYSIMG_PATH + "/usr/boot/boot_server", "w").write(boot_server) - shutil.copy("/usr/bootme/pubring.gpg", SYSIMG_PATH + "/usr/boot/pubring.gpg") + # do nothing in case of upgrade + if not os.path.exists(SYSIMG_PATH + "/usr/bootme"): + utils.makedirs(SYSIMG_PATH + "/usr/boot") + boot_server = file("/usr/bootme/BOOTSERVER").readline().strip() + shutil.copy("/usr/bootme/cacert/" + boot_server + "/cacert.pem", + SYSIMG_PATH + "/usr/boot/cacert.pem") + file(SYSIMG_PATH + "/usr/boot/boot_server", "w").write(boot_server) + shutil.copy("/usr/bootme/pubring.gpg", SYSIMG_PATH + "/usr/boot/pubring.gpg") # For backward compatibility if os.path.exists("/usr/bootme"): - utils.makedirs(SYSIMG_PATH + "/mnt/cdrom") - shutil.copytree("/usr/bootme", SYSIMG_PATH + "/mnt/cdrom/bootme") + # do nothing in case of upgrade + if not os.path.exists(SYSIMG_PATH + "/mnt/cdrom/bootme"): + utils.makedirs(SYSIMG_PATH + "/mnt/cdrom") + shutil.copytree("/usr/bootme", SYSIMG_PATH + "/mnt/cdrom/bootme") # ONE_PARTITION => new distribution type if (vars['ONE_PARTITION'] != '1'):