mirror of
https://github.com/DictXiong/dotfiles.git
synced 2024-11-24 17:57:01 +08:00
Dict Xiong
9a4c9556f6
* common.sh: export vars in env; zshrc: gdebug * fix error when locale not exists * DFS_COLOR * common.sh: parse args automatically * ci: test common.sh getopts * common.sh: argparser supports spaces * ciot: init * ciot -> diot; remove sibd, sob and snasp * rename diot -> riot * update home0 ssh pubkey; fix ci temperarily * gdebug will record time * gdebug supports empty; --dry-run wip * get.dotfiles.cn * bug fix (Thu Jan 5 20:53:58 CST 2023) * fix ci * fix ci * install.sh: -d will set -x * ci: -asl * getdfs: install for another user using -u <uname> * try fix when su doesnot exist * bug fix (Thu Jan 5 22:58:40 CST 2023) * bug fix (Thu Jan 5 22:59:33 CST 2023) * introduce SUDOE and so debug * ask_for_yn now use stdout to return * getdfs: support multiple users * install.sh: -x to set dfs config; ci * fix ci * bug fix (Fri Jan 6 15:11:24 CST 2023) * auto-detect DFS_NO_WALL * bug fix (Fri Jan 6 15:43:25 CST 2023) * getdfs: ${repo} * bug fix (Fri Jan 6 16:08:41 CST 2023) * getdfs: prompt user Co-authored-by: xiongdian.me <xiongdian.me@bytedance.com>
43 lines
1.2 KiB
Bash
Executable File
43 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
|
source "$THIS_DIR/common.sh"
|
|
|
|
set_mirror()
|
|
{
|
|
MIRROR=${1:-"mirrors.tuna.tsinghua.edu.cn"}
|
|
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
|
|
}
|
|
|
|
apt_install()
|
|
{
|
|
apt-get update -y
|
|
# lite
|
|
apt-get install -y git zsh bash tmux vim curl inetutils-ping less bsdmainutils
|
|
# full
|
|
if [[ -z "$DFS_LITE" || "$DFS_LITE" == "0" ]]; 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
|
|
}
|
|
|
|
set_timezone()
|
|
{
|
|
TIMEZONE=${1:-"Asia/Shanghai"}
|
|
timedatectl set-timezone "$TIMEZONE"
|
|
}
|
|
|
|
router()
|
|
{
|
|
case $1 in
|
|
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;;
|
|
esac
|
|
}
|
|
|
|
router "${GOT_OPTS[@]}"
|