From fbf358979fca4270564f3fcbc6cc3676e35ba14e Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Tue, 17 May 2022 18:29:18 +0800 Subject: [PATCH] init tools tools/ubuntu.sh --- tools/ubuntu.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 tools/ubuntu.sh diff --git a/tools/ubuntu.sh b/tools/ubuntu.sh new file mode 100755 index 0000000..d440992 --- /dev/null +++ b/tools/ubuntu.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +if [[ $USER != "root" ]]; then + echo "must run as root!" + exit 1 +fi + +init() +{ + # basic packages + apt update + for i in {man-db,vim,ca-certificates}; do apt install $i -y; done + + # apt source + ${MIRROR:="mirrors.tuna.tsinghua.edu.cn"} + MIRROR=${MIRROR//\//\\\/} + sed -i 's/(archive|security).ubuntu.com/${MIRROR}/g' /etc/apt/sources.list + + # mass installation + apt update + apt install git tmux zsh curl wget dialog net-tools dnsutils netcat traceroute sudo python3 python3-pip cron inetutils-ping + for i in {fzf,ripgrep}; do apt install $i -y; done + + # custom dotfiles (usually not needed) + # mkdir -p ~/.ssh + # cd ~ && git clone https://gitee.com/dictxiong/dotfiles && ./dotfiles/install.sh + + # who am i + git config --global user.email "me@beardic.cn" + git config --global user.name "Dict Xiong" +} + +install() +{ + echo to-do: install apt-less packages: $1 + +} + +router() +{ + case $1 in + init ) init ;; + install ) install $2 ;; + * ) echo unknown command "$1". available: init, install ;; + esac +} + +router $@