#!/usr/bin/env python3
import sys
import subprocess


sys.path.insert(0, "/opt/oglive/rootfs/opt/opengnsys/lib/python3/")
sys.path.insert(0, "/opt/opengnsys/interfaceAdm/git/")
sys.path.insert(0, "/opt/opengnsys/ogrepository/oggit/lib/")

import NetLib
import ogGlobals
import SystemLib
from gitlib import OpengnsysGitLibrary, NTFSImplementation

if __name__ == "__main__":
    if len(sys.argv) < 4:
        print("Usage: python RestaurarImagenGit.py <disk> <partition> <repo> <boot_device>")
        sys.exit(1)

    disk = sys.argv[1]
    partition = sys.argv[2]
    repo = sys.argv[3]
    boot_device = sys.argv[4]

    ntfs_impl = NTFSImplementation.NTFS3G
    og_git = OpengnsysGitLibrary(ntfs_implementation = ntfs_impl)

    device = og_git._runBashFunction("ogDiskToDev", [str(disk), str(partition)])

    og_git.cloneRepo(repo, device, boot_device)


