2022-05-20 17:34:21 +08:00
|
|
|
#!/bin/bash
|
2022-08-26 20:43:00 +08:00
|
|
|
set -e
|
2022-12-03 20:37:20 +08:00
|
|
|
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
|
|
|
source "$THIS_DIR/common.sh"
|
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"}
|
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
|
|
|
{
|
2022-12-03 20:37:20 +08:00
|
|
|
apt-get update -y
|
|
|
|
# lite
|
|
|
|
apt-get install -y git zsh bash tmux vim curl inetutils-ping less bsdmainutils
|
|
|
|
# full
|
|
|
|
if [[ -z "$DFS_LITE" ]]; then
|
|
|
|
apt-get install wget dialog net-tools dnsutils netcat traceroute sudo python3 python3-pip cron openssh-client openssh-server htop gcc g++ cmake make zip
|
|
|
|
for i in {fzf,ripgrep,man-db}; do apt-get install -y $i; done
|
|
|
|
fi
|
2022-05-20 17:34:21 +08:00
|
|
|
}
|
|
|
|
|
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 $@
|