"""Step 1: Disk Partitioning
Step 2: Mounting {gentooimgr.config.GENTOO_MOUNT}
Step 3: Stage3 Tarball
Step 4: Binding Filesystems
Step 5: Portage
Step 6: Licenses
Step 7: Repo Configuration
Step 8: Resolv
Step 9: sync
Step 10: emerge pkgs
Step 11: kernel
Step 12: kernel
Step 13: Serial
Step 14: Services
Step 15: Eth Naming
Step 16: Sysconfig
Step 17: fstab
"""
import os
import sys
import json

# from gentooimgr import LOG
import gentooimgr.config
import gentooimgr.configs
from gentooimgr import install

def print_template(args, configjson, prefix='/tmp'):
    print(__doc__)
    sys.stderr.write(f"the last step to succeed is {install.getlaststep(prefix)}\n")
    print(f"the last step to succeed is {install.getlaststep(prefix)}\n")
    print(f"""------------------------ STATUS ------------------------

CPU_THREADS = {args.threads or 1}
TEMPORARY_DIRECTORY = {args.temporary_dir}
PROFILE = {args.profile}
""")
    print(f"CONFIG {args.config}")
    print(json.dumps(configjson, sort_keys=True, indent=4))

    # inherit = configjson.get("inherit")
    # if inherit:
    #     print(f"CONFIG {inherit}")
    #     j = gentooimgr.config.load_default_config(inherit)
    #     if not j:
    #         j = gentooimgr.config.load_config(inherit)
    #
    #     print(json.dumps(j, sort_keys=True, indent=4))

    # print(f"""------------------------ PACKAGES ------------------------""")
    # for k, v in configjson.get("packages").items():
    #     print(k.upper())
    #     print("\t" + '\n\t'.join(v))
    #     print()
