Skip to content
Snippets Groups Projects
0_setup.py 870 B
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import utils


def setup(interactive=True):
    dir_path = utils.get_dir(__file__)
    cmds = [
        'apt-get clean',
        'apt-get update',
        'apt-get install --yes make ipython ipython3 vim netcat git htop iotop bmon host lm-sensors pciutils nfs-client smartmontools pwgen dialog curl python3-requests',
        # 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',
        # Vim colors
        '[ -f ~/.vimrc ] || echo -e "syntax on\\ncolor ron" > ~/.vimrc',
        # Copy bashrc file
        'cp "%s/bashrc" "/root/.bashrc"' % 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)