2022-05-20 17:34:21 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-08-26 20:43:00 +08:00
|
|
|
set -e
|
2022-05-20 17:34:21 +08:00
|
|
|
|
2022-05-22 00:53:55 +08:00
|
|
|
set_mirror()
|
|
|
|
{
|
|
|
|
MIRROR=${1:-"mirrors.tuna.tsinghua.edu.cn"}
|
|
|
|
MIRROR=${MIRROR//\//\\\/}
|
2022-11-05 19:45:21 +08:00
|
|
|
sed -i "s@http://.*archive.ubuntu.com@https://${MIRROR}@g" /etc/apt/sources.list
|
|
|
|
sed -i "s@http://.*security.ubuntu.com@https://${MIRROR}@g" /etc/apt/sources.list
|
2022-05-22 00:53:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
apt_install()
|
2022-05-20 17:34:21 +08:00
|
|
|
{
|
|
|
|
# basic packages
|
|
|
|
apt update
|
|
|
|
for i in {man-db,vim,ca-certificates}; do apt install $i -y; done
|
|
|
|
|
|
|
|
# mass installation
|
2022-05-25 20:00:43 +08:00
|
|
|
apt install git tmux zsh curl wget dialog net-tools dnsutils netcat traceroute sudo python3 python3-pip cron inetutils-ping openssh-client openssh-server htop gcc g++ cmake make zip
|
2022-05-20 17:34:21 +08:00
|
|
|
for i in {fzf,ripgrep}; do apt install $i -y; done
|
|
|
|
}
|
|
|
|
|
2022-05-22 00:53:55 +08:00
|
|
|
set_timezone()
|
|
|
|
{
|
|
|
|
TIMEZONE=${1:-"Asia/Shanghai"}
|
|
|
|
timedatectl set-timezone "$TIMEZONE"
|
|
|
|
}
|
|
|
|
|
2022-05-20 17:34:21 +08:00
|
|
|
router()
|
|
|
|
{
|
|
|
|
case $1 in
|
2022-05-22 00:53:55 +08:00
|
|
|
apt-install ) apt_install ;;
|
|
|
|
set-mirror ) set_mirror $2 ;;
|
|
|
|
set-timezone\
|
|
|
|
| set-tz ) set_timezone $2 ;;
|
|
|
|
* ) echo unknown command "$1". available: apt-install, set-mirror, set-timezone;;
|
2022-05-20 17:34:21 +08:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
router $@
|