mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
Merge fb4e67d502482b2d89bef00424640d9484d56b15 into 45385e1bf522101cddcc8a9be0ba436a717d8265
This commit is contained in:
commit
46a0334542
@ -143,6 +143,7 @@ def apt_mirror(
|
|||||||
arch: str,
|
arch: str,
|
||||||
dest_base_dir: Path,
|
dest_base_dir: Path,
|
||||||
deb_set: Dict[str, int],
|
deb_set: Dict[str, int],
|
||||||
|
skip_checksum: bool
|
||||||
) -> int:
|
) -> int:
|
||||||
if not dest_base_dir.is_dir():
|
if not dest_base_dir.is_dir():
|
||||||
print("Destination directory is empty, cannot continue")
|
print("Destination directory is empty, cannot continue")
|
||||||
@ -229,7 +230,7 @@ def apt_mirror(
|
|||||||
)
|
)
|
||||||
pkgidx_file.unlink()
|
pkgidx_file.unlink()
|
||||||
continue
|
continue
|
||||||
if hashlib.sha256(content).hexdigest() != checksum:
|
if not skip_checksum and hashlib.sha256(content).hexdigest() != checksum:
|
||||||
print(
|
print(
|
||||||
f"Invalid checksum of {pkgidx_file}, expected {checksum}, skipped"
|
f"Invalid checksum of {pkgidx_file}, expected {checksum}, skipped"
|
||||||
)
|
)
|
||||||
@ -331,7 +332,7 @@ def apt_mirror(
|
|||||||
with dest_tmp_filename.open("rb") as f:
|
with dest_tmp_filename.open("rb") as f:
|
||||||
for block in iter(lambda: f.read(1024**2), b""):
|
for block in iter(lambda: f.read(1024**2), b""):
|
||||||
sha.update(block)
|
sha.update(block)
|
||||||
if sha.hexdigest() != pkg_checksum:
|
if not skip_checksum and sha.hexdigest() != pkg_checksum:
|
||||||
print(f"Invalid checksum of {dest_filename}, expected {pkg_checksum}")
|
print(f"Invalid checksum of {dest_filename}, expected {pkg_checksum}")
|
||||||
dest_tmp_filename.unlink()
|
dest_tmp_filename.unlink()
|
||||||
continue
|
continue
|
||||||
@ -383,6 +384,8 @@ def main():
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="print package files to be deleted only",
|
help="print package files to be deleted only",
|
||||||
)
|
)
|
||||||
|
parser.add_argument("--skip-checksum", action='store_true',
|
||||||
|
help='skip checksum validation')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# generate lists of os codenames
|
# generate lists of os codenames
|
||||||
@ -420,7 +423,7 @@ def main():
|
|||||||
for arch in arch_list:
|
for arch in arch_list:
|
||||||
if (
|
if (
|
||||||
apt_mirror(
|
apt_mirror(
|
||||||
args.base_url, os, comp, arch, args.working_dir, deb_set=deb_set
|
args.base_url, os, comp, arch, args.working_dir, deb_set=deb_set, skip_checksum=args.skip_checksum
|
||||||
)
|
)
|
||||||
!= 0
|
!= 0
|
||||||
):
|
):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user