2022-05-22 00:53:55 +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-22 00:53:55 +08:00
|
|
|
|
|
|
|
set_mirror()
|
|
|
|
{
|
2022-11-05 19:45:21 +08:00
|
|
|
MIRROR=${1:-"mirrors.tuna.tsinghua.edu.cn"}
|
2022-12-03 20:37:20 +08:00
|
|
|
sed -i "s@dl-cdn.alpinelinux.org@${MIRROR}@g" /etc/apk/repositories
|
2022-05-22 00:53:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
apk_add()
|
|
|
|
{
|
|
|
|
apk update
|
2022-12-03 20:37:20 +08:00
|
|
|
# lite
|
|
|
|
apk add zsh bash git tmux vim curl fzf iputils coreutils util-linux
|
|
|
|
# full
|
2023-01-06 16:14:41 +08:00
|
|
|
if [[ -z "$DFS_LITE" || "$DFS_LITE" == "0" ]]; then
|
2022-12-03 20:37:20 +08:00
|
|
|
apk add wget python3 py3-pip htop gcc g++ cmake make perl linux-headers bind-tools man-db
|
|
|
|
fi
|
2022-05-22 00:53:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
set_timezone()
|
|
|
|
{
|
|
|
|
apk update
|
|
|
|
apk add tzdata
|
|
|
|
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
|
|
|
echo "Asia/Shanghai" > /etc/timezone
|
|
|
|
}
|
|
|
|
|
|
|
|
router()
|
|
|
|
{
|
|
|
|
case $1 in
|
|
|
|
apk-add ) apk_add ;;
|
|
|
|
set-timezone | set-tz ) set_timezone ;;
|
2022-11-05 19:45:21 +08:00
|
|
|
set-mirror ) set_mirror $2 ;;
|
2023-01-06 16:14:41 +08:00
|
|
|
* ) echo unknown command \"$1\". available: apk-add, set-timezone;;
|
2022-05-22 00:53:55 +08:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2023-01-06 16:14:41 +08:00
|
|
|
router "${GOT_OPTS[@]}"
|