48 lines
846 B
Python
Executable file
48 lines
846 B
Python
Executable file
#! /usr/bin/env python3
|
|
"""Mirror local Incus."""
|
|
|
|
from pathlib import Path
|
|
import os
|
|
|
|
from rwx.fs import make_directory, wipe
|
|
|
|
|
|
ROOT = "https://images.linuxcontainers.org"
|
|
|
|
IMAGES = f"{ROOT}/images"
|
|
META = f"{ROOT}/meta"
|
|
|
|
STREAMS = f"{META}/simplestreams/v1"
|
|
|
|
WANTED = {
|
|
"architectures": [
|
|
"amd64",
|
|
"arm64",
|
|
],
|
|
"images": {
|
|
"debian",
|
|
"arm64",
|
|
},
|
|
}
|
|
|
|
|
|
|
|
def main() -> None:
|
|
root = Path(__file__).resolve().parent / "root"
|
|
# root path
|
|
root = root / "incus"
|
|
wipe(root)
|
|
make_directory(root)
|
|
# symlink
|
|
(root / "streams").symlink_to(os.sep.join(["meta", "simplestreams"]))
|
|
# meta
|
|
meta = root / "meta"
|
|
# streams
|
|
streams = meta / "simplestreams" / "v1"
|
|
make_directory(streams)
|
|
# images
|
|
streams = root / "images"
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|