install-gsos.py: Remove versioned patches

This commit is contained in:
T. Joseph Carter
2015-11-15 14:18:22 -08:00
parent 9de61e504a
commit c8d2deb205

View File

@@ -29,15 +29,11 @@ a2boot_files = [
"hfsutils" : "Apple_--e_Boot_Blocks.bin",
"netatalk" : "Apple :2f:2fe Boot Blocks",
"digest" : "cada362ac2eca3ffa506e9b4e76650ba031e0035",
"patch" : {
"6.0.1" : {
"patches" : [
"Cleartext password login bug",
(0x4d43, b"\xA8\xA2\x01\xBD\x80\x38\x99\xA0\x38\xC8\xE8\xE0\x09\x90\xF4")
],
"digest" : "6b7fc12fd118e1cb9e39c7a2b8cc870c844a3bac"
}
}
"patch-digest" : "6b7fc12fd118e1cb9e39c7a2b8cc870c844a3bac",
"patches" : [
"Cleartext password login bug",
(0x4d43, b"\xA8\xA2\x01\xBD\x80\x38\x99\xA0\x38\xC8\xE8\xE0\x09\x90\xF4")
],
},
{
"unix" : "Basic.System",
@@ -56,38 +52,30 @@ a2boot_files = [
"hfsutils" : "ProDOS16_Image.bin",
"netatalk" : "ProDOS16 Image",
"digest" : "db4608067b9e7877f45eb557971c4d8c45b46be5",
"patch" : {
"6.0.1" : {
"patches" : [
"Cleartext password login bug",
(0x5837, b"\xA8\xA2\x01\xBD\x80\x10\x99\xA0\x10\xC8\xE8\xE0\x09\x90\xF4"),
"patch-digest" : "5c35d5533901b292ab7c2f5a3c76cb3113f66085",
"patches" : [
"Cleartext password login bug",
(0x5837, b"\xA8\xA2\x01\xBD\x80\x10\x99\xA0\x10\xC8\xE8\xE0\x09\x90\xF4"),
"Enable pressing \"8\" during GS/OS netboot to load ProDOS 8",
(0x0100, b"\x92"),
(0x0360, b"\x20\x7d\x14"),
(0x067d, b"\xad\x00\xc0\x29\xff\x00\xc9\xb8\x00\xd0\x06\xa9\x02\x00\x8d\x53\x14\xa9\x10\x0f\x60")
],
"digest" : "5c35d5533901b292ab7c2f5a3c76cb3113f66085"
}
}
"Enable pressing \"8\" during GS/OS netboot to load ProDOS 8",
(0x0100, b"\x92"),
(0x0360, b"\x20\x7d\x14"),
(0x067d, b"\xad\x00\xc0\x29\xff\x00\xc9\xb8\x00\xd0\x06\xa9\x02\x00\x8d\x53\x14\xa9\x10\x0f\x60")
],
},
{
"unix" : "p8",
"hfsutils" : "p8.bin",
"netatalk" : "p8",
"digest" : "36c288a5272cf01e0a64eed16786258959118e0e",
"patch" : {
# p8 in A2SETUP.img has a different date on the splash than
# the version in 6.0.1--no we're not patching that, but it's
# useful to note the other version exists. :)
#"6.0.1": {
# "patches" : [
# "Patch date splash to match 6.0.1's P8",
# (0x0026, b"\xb0\xb6\xad\xcd\xe1\xf9\xad\xb9\xb3")
# ],
# "digest" : "c99f69c8dbfe79f02c715162fb409aedf52d378a"
#},
}
#"patch-digest" : "c99f69c8dbfe79f02c715162fb409aedf52d378a",
#"patches" : [
# # p8 in A2SETUP.img has a different date on the splash than
# # the version in 6.0.1--no we're not patching that, but it's
# # useful to note the other version exists. :)
# "Patch date splash to match 6.0.1's P8",
# (0x0026, b"\xb0\xb6\xad\xcd\xe1\xf9\xad\xb9\xb3")
#],
}
]
@@ -347,10 +335,10 @@ def a2setup_umount(mountpoint):
os.rmdir(mountpoint)
def a2setup_check_digest(bootfile, file_digest, gsos_version, pristine=True, patched=True):
def a2setup_check_digest(bootfile, file_digest, pristine=True, patched=True):
if patched:
if "patch" in bootfile and gsos_version in bootfile["patch"]:
if bootfile["patch"][gsos_version]["digest"] == file_digest:
if "patch-digest" in bootfile:
if bootfile["patch-digest"] == file_digest:
return True
else:
# This file doesn't have a patch for this GS/OS version
@@ -362,11 +350,11 @@ def a2setup_check_digest(bootfile, file_digest, gsos_version, pristine=True, pat
return False
def apply_patches(bootfile, gsos_version, dest_dir, dest_fmt):
if "patch" in bootfile and gsos_version in bootfile["patch"]:
def apply_patches(bootfile, dest_dir, dest_fmt):
if "patches" in bootfile:
patch_path = os.path.join(dest_dir, bootfile[dest_fmt])
dest_digest = sha1sum_file(patch_path)
if a2setup_check_digest(bootfile, dest_digest, gsos_version, pristine=False):
if a2setup_check_digest(bootfile, dest_digest, pristine=False):
if not quiet:
print(" \"%s\" is already patched." % (bootfile[dest_fmt]))
return True
@@ -376,7 +364,7 @@ def apply_patches(bootfile, gsos_version, dest_dir, dest_fmt):
elif not quiet:
print(" Patching %s..." % (bootfile[dest_fmt]), end="")
f = open(patch_path, "r+b")
for patch in bootfile["patch"][gsos_version]["patches"]:
for patch in bootfile["patches"]:
if isinstance(patch, str):
if verbose:
print(" %s" % (patch))
@@ -388,22 +376,22 @@ def apply_patches(bootfile, gsos_version, dest_dir, dest_fmt):
# Verify...
dest_digest = sha1sum_file(patch_path)
if a2setup_check_digest(bootfile, dest_digest, gsos_version, pristine=False):
if a2setup_check_digest(bootfile, dest_digest, pristine=False):
print(" patched.")
else:
print(" patch failed.\n Expected: %s\n Received: %s"
% (bootfile["patch"][gsos_version]["digest"], dest_digest))
% (bootfile["patch-digest"], dest_digest))
return False
return True
def install_bootblocks(dest_dir, dest_fmt, gsos_version):
def install_bootblocks(dest_dir, dest_fmt):
if dest_fmt not in ["unix", "netatalk"]:
raise ValueError("Only basic UNIX and netatalk formats are supported for now")
if not quiet:
print("Installing Apple // boot blocks (GS/OS version %s)..." % (gsos_version))
print("Installing Apple // boot blocks...")
if not os.path.isdir(dest_dir):
os.makedirs(dest_dir, mode=0o0755)
@@ -424,7 +412,7 @@ def install_bootblocks(dest_dir, dest_fmt, gsos_version):
dest_path = os.path.join(dest_dir, bootfile[dest_fmt])
if os.path.isfile(dest_path):
dest_digest = sha1sum_file(dest_path)
if not a2setup_check_digest(bootfile, dest_digest, gsos_version):
if not a2setup_check_digest(bootfile, dest_digest):
a2boot_needed = True
break
else:
@@ -472,7 +460,7 @@ def install_bootblocks(dest_dir, dest_fmt, gsos_version):
return False
for bootfile in a2boot_files:
apply_patches(bootfile, gsos_version, dest_dir, dest_fmt)
apply_patches(bootfile, dest_dir, dest_fmt)
return True
@@ -544,7 +532,7 @@ if __name__ == '__main__':
sys.exit(ret)
"""
install_bootblocks(os.path.join(os.getcwd(), "a2boot"), "netatalk", "6.0.1")
install_bootblocks(os.path.join(os.getcwd(), "a2boot"), "netatalk")
#reply = stdin_input("""\nDo you want to set up A2SERVER to be able to boot Apple II\ncomputers over the network? [y] """)
#if reply.startswith("y") or reply.startswith("Y") or reply == "":
# do_install()