Skip to content
Snippets Groups Projects
0_setup.py 1.05 KiB
#!/usr/bin/env python3

import utils

packages = [
    "bmon",
    "curl",
    "git",
    "host",
    "htop",
    "iotop",
    "ipython3",
    "lm-sensors",
    "make",
    "net-tools",
    "netcat",
    "nfs-client",
    "pciutils",
    "pwgen",
    "python3-openssl",
    "python3-psutil",
    "python3-requests",
    "python3-spf",
    "smartmontools",
    "sudo",
    "vim",
]


def setup(interactive=True):
    dir_path = utils.get_dir(__file__)
    cmds = [
        "apt-get clean",
        "apt-get update",
        "apt-get install --yes {}".format(" ".join(packages)),
        # Locale
        "locale-gen en_GB.UTF-8",
        "update-locale LANG=en_GB.UTF-8 LANGUAGE=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8",
        # Copy vimrc file
        "cp '{}/vimrc' /root/.vimrc".format(dir_path),
        # Copy bashrc file
        "cp '{}/bashrc' /root/.bashrc".format(dir_path),
        # Generate SSH key if not already done
        "[ -f /root/.ssh/id_rsa ] || ssh-keygen -b 4096 -t rsa -f /root/.ssh/id_rsa -P ''",
    ]
    utils.run_commands(cmds)