2022-01-04 22:08:53 +07:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
2022-01-16 22:12:58 +07:00
|
|
|
# WIP
|
|
|
|
# clean this up
|
|
|
|
|
2022-01-04 22:08:53 +07:00
|
|
|
"""
|
|
|
|
Basic configure script for new users
|
|
|
|
"""
|
|
|
|
|
2022-01-04 22:27:46 +07:00
|
|
|
import os
|
2022-01-04 22:08:53 +07:00
|
|
|
import platform
|
|
|
|
import sys
|
|
|
|
|
|
|
|
if sys.version_info < (3, 10, 0):
|
|
|
|
raise Exception("Must be using Python >= 3.10.0")
|
|
|
|
|
|
|
|
if platform.system() != 'Linux':
|
|
|
|
raise Exception("Only Linux is supported, please us a Linux VM or switch operating system")
|
|
|
|
|
2022-01-16 22:12:58 +07:00
|
|
|
# confirm text editor
|
|
|
|
editor = os.getenv('EDITOR')
|
|
|
|
editor = str(input(f"Text editor ({editor}): ") or editor)
|
|
|
|
|
|
|
|
# Replace seed repo
|
|
|
|
seed_repo = "github.com/khuedoan/homelab"
|
|
|
|
seed_repo = str(input(f"Enter seed repo ({seed_repo}): ") or seed_repo)
|
|
|
|
os.system(f"./scripts/replace-gitops-repo {seed_repo}")
|
|
|
|
|
|
|
|
# Replace domain
|
|
|
|
domain = "khuedoan.com"
|
|
|
|
domain = str(input(f"Enter your domain ({domain}): ") or domain)
|
|
|
|
os.system(f"./scripts/replace-domain {domain}")
|
|
|
|
|
|
|
|
# change hardware info
|
|
|
|
os.system(f"{editor} 'metal/inventories/prod.yml'")
|
|
|
|
|
|
|
|
# TODO change Terraform workspace
|
|
|
|
|
|
|
|
# TODO switch to git lib
|
|
|
|
os.system("git diff")
|