Esempio n. 1
0
def update_sudo_passwd_template(pwd):
    sudo_passwd_template = "/tmp/pass.sh"
    os.system("rm -rf %s" % sudo_passwd_template)
    os.system("touch %s" % sudo_passwd_template)
    os.system("chmod +x %s" % sudo_passwd_template)
    file.set_to_file(sudo_passwd_template, "'#! /bin/bash'")
    file.set_to_file(sudo_passwd_template, "echo %s" % pwd)
Esempio n. 2
0
def set_open_extra_menu_alias_to_profile(user):
    user_home_path = os.path.expanduser("~" + user)
    profile = user_home_path + "/" + ".profile"
    file.set_to_file(
        profile,
        'alias open_extra_menu="thunar ~/.local/share/applications"',
        need_new_blank_line=False,
    )
Esempio n. 3
0
def do_zsh_config(user):
    os.system("pacman -S --noconfirm zsh")
    cmd = "chsh -s $(which zsh) %s" % user
    os.system(cmd)
    current_dir = os.path.dirname(os.path.abspath(__file__))
    cmd = "sh %s/zsh/config.sh" % (current_dir)
    proc.run_as_user(user, cmd)
    os.system("rm -rf /etc/zsh/zprofile; touch /etc/zsh/zshenv")
    file.set_to_file("/etc/zsh/zshenv", 'emulate sh -c "source /etc/profile"')
Esempio n. 4
0
def do_set_mirror_config(user):
    os.system("pacman-mirrors --geoip")
    user_home_path = os.path.expanduser("~" + user)
    profile = user_home_path + "/" + ".profile"
    file.set_to_file(
        profile,
        'alias pacman-mirror-select="sudo pacman-mirrors -i --geoip -m rank"',
        need_new_blank_line=False,
    )
Esempio n. 5
0
def do_zsh_config(user):
    os.system("apt install -y zsh")
    cmd = "chsh -s $(which zsh) %s" % user
    os.system(cmd)
    proc.run_as_user(user, cmd)
    current_dir = os.path.dirname(os.path.abspath(__file__))
    cmd = "sh %s/zsh/config.sh" % (current_dir)
    proc.run_as_user(user, cmd)
    file.set_to_file(
        "/etc/zsh/zshenv",
        'emulate sh -c "source /etc/profile"',
        need_new_blank_line=True,
    )
Esempio n. 6
0
def do_set_archlinuxcn_config():
    content = "[archlinuxcn]"
    file.set_to_file("/etc/pacman.conf", content, need_new_blank_line=True)
    content = "Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch"
    file.set_to_file("/etc/pacman.conf", content)
    content = "Server = https://mirrors.aliyun.com/archlinuxcn/$arch"
    file.set_to_file("/etc/pacman.conf", content)
    os.system("pacman -Sy --noconfirm")
    os.system("pacman -S --noconfirm archlinuxcn-keyring")
Esempio n. 7
0
def install_chinese_input(user):
    os.system(
        "pacman -S --noconfirm fcitx5 fcitx5-configtool fcitx5-qt fcitx5-gtk fcitx5-chinese-addons fcitx5-material-color"
    )
    current_dir = os.path.dirname(os.path.abspath(__file__))
    cmd = "mkdir -p ~/.config/fcitx5/"
    proc.run_as_user(user, cmd)
    cmd = "cp -rf %s/fcitx/config/* ~/.config/fcitx5/" % (current_dir)
    proc.run_as_user(user, cmd)
    cmd = "mkdir -p ~/.local/share/fcitx5/themes/"
    proc.run_as_user(user, cmd)
    cmd = "cp -rf %s/fcitx/themes/* ~/.local/share/fcitx5/themes/" % (
        current_dir)
    proc.run_as_user(user, cmd)
    user_home_path = os.path.expanduser("~" + user)
    profile = user_home_path + "/" + ".profile"
    file.set_to_file(profile,
                     "export INPUT_METHOD=fcitx5",
                     need_new_blank_line=True)
    file.set_to_file(profile, "export GTK_IM_MODULE=fcitx5")
    file.set_to_file(profile, "export QT_IM_MODULE=fcitx5")
    file.set_to_file(profile, 'export XMODIFIERS="@im=fcitx5"')
Esempio n. 8
0
def install_proxychains(user):
    os.system("apt install -y proxychains4")
    user_home_path = os.path.expanduser("~" + user)
    profile = user_home_path + "/" + ".profile"
    file.set_to_file(profile, 'alias proxy="proxychains"')
Esempio n. 9
0
def install_elixir(user):
    os.system("apt install -y elixir")
    user_home_path = os.path.expanduser("~" + user)
    profile = user_home_path + "/" + ".profile"
    file.set_to_file(profile, 'export HEX_MIRROR="https://hexpm.upyun.com"')
Esempio n. 10
0
def install_proxychains(user):
    os.system("pacman -S --noconfirm proxychains-ng")
    user_home_path = os.path.expanduser("~" + user)
    profile = user_home_path + "/" + ".profile"
    file.set_to_file(profile, 'alias proxy="proxychains"')
Esempio n. 11
0
    os.system(cmd)

    cmd = "pip install you-get --upgrade"
    os.system(cmd)

    cmd = "pip install youtube-dl --upgrade"
    os.system(cmd)

    cmd = "pip install prettytable --upgrade"
    os.system(cmd)

    # 编译为 c 的工具
    cmd = "pip install cython nuitka --upgrade"
    os.system(cmd)

    # github.com/rohanrhu/gdb-frontend
    cmd = "pip install gdbfrontend --upgrade"
    os.system(cmd)

    # pip search目前有问题,需要使用下面这个, 命令是 pip_search
    cmd = "pip install pip-search --upgrade"
    os.system(cmd)

    cmd = "pip install pyinotify --upgrade"
    os.system(cmd)
    path = os.path.expanduser("~")
    profile = path + "/" + ".profile"
    file.set_to_file(
        profile, 'alias pyfilemon="python -m pyinotify -v"', need_new_blank_line=True
    )