#!/usr/bin/env bash set -ex add_user=${1:-jimyag} change_source=${2:-false} if [ "$change_source" = "true" ]; then sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list fi if ! id $add_user > /dev/null 2>&1; then sudo useradd -m -s /bin/bash $add_user echo "$add_user ALL=(ALL) NOPASSWD: NOPASSWD: ALL" |sudo tee /etc/sudoers.d/$add_user fi sudo apt-get update && sudo apt-get upgrade -y sudo apt-get install -y vim git curl zsh jq hstr htop \ dnsutils bash-completion net-tools tmux neovim \ zsh-syntax-highlighting zsh-autosuggestions iperf3 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" sudo curl -fsSL https://jimyag.com/scripts/get-docker.sh | sh sudo usermod -a -G docker $add_user sudo update-alternatives --config editor echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.conf echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.conf sudo sysctl -p /etc/sysctl.conf sudo timedatectl set-timezone Asia/Shanghai git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git \ ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting # TODO 判断链接是否可以有效不报错 curl -fsSL https://jimyag.com/config/tmux.conf > ~/.tmux.conf tmux source-file ~/.tmux.conf curl -fsSL https://jimyag.com/config/vimrc.conf > ~/.vimrc curl -fsSL https://jimyag.com/config/zshrc.conf > ~/.zshrc mkdir -p ~/.profile.d curl -fsSL https://jimyag.com/config/profile.d/common.conf > ~/.profile.d/common curl -fsSL https://jimyag.com/config/profile.d/memdiff.conf > ~/.profile.d/memdiff