[debug+dev] riot checks and fix ipv6 support, fix crontab installation; antigen use F-Sy-H (#39)

* format: remove space

* sry but..., riot: 'i' for 'ibd', and remove support for ebd

* fix ipv6 support

* validate port and username

* install.sh: failed to add to crontab when there's no crontab

* sync zdharma-continuum/fast-syntax-highlighting

* use fast-syntax-highlighting instead

---------

Co-authored-by: xiongdian.me <xiongdian.me@bytedance.com>
This commit is contained in:
Dict Xiong 2023-06-20 15:10:59 +08:00 committed by GitHub
parent 2cc2ab48b8
commit 1a62ffe74b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 7 deletions

View File

@ -38,6 +38,23 @@ jobs:
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库 force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
static_list: "antigen,zsh-syntax-highlighting,zsh-autosuggestions,zsh-completions" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个 static_list: "antigen,zsh-syntax-highlighting,zsh-autosuggestions,zsh-completions" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
timeout: '600s' # git超时设置超时后会自动重试git操作 timeout: '600s' # git超时设置超时后会自动重试git操作
zdharma-continuum:
runs-on: ubuntu-20.04
steps:
- name: zdharma-continuum repos # 名字随便起
uses: Yikun/hub-mirror-action@v1.2 # 使用Yikun/hub-mirror-action
with:
src: github/zdharma-continuum # 源端账户名(github)
dst: gitee/dictxiong # 目的端账户名(gitee)
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # SSH密钥对中的私钥
dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
src_account_type: org
dst_account_type: user # 账户类型
clone_style: "https" # 使用https方式进行clone也可以使用ssh
debug: true # 启用后会显示所有执行命令
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
static_list: "fast-syntax-highlighting" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
timeout: '600s' # git超时设置超时后会自动重试git操作
tmux-mem-cpu-load: tmux-mem-cpu-load:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:

View File

@ -22,7 +22,7 @@ if [[ "$DFS_NO_WALL" == "1" ]]; then
ANTIGEN_URL="https://raw.githubusercontent.com/zsh-users/antigen/develop/bin/antigen.zsh" ANTIGEN_URL="https://raw.githubusercontent.com/zsh-users/antigen/develop/bin/antigen.zsh"
ANTIGEN_OMZ_REPO_URL="https://github.com/ohmyzsh/ohmyzsh.git" ANTIGEN_OMZ_REPO_URL="https://github.com/ohmyzsh/ohmyzsh.git"
ANTIGEN_PLUGINS=( ANTIGEN_PLUGINS=(
"https://github.com/zsh-users/zsh-syntax-highlighting" "https://github.com/zdharma-continuum/fast-syntax-highlighting"
"https://github.com/zsh-users/zsh-completions" "https://github.com/zsh-users/zsh-completions"
"https://github.com/zsh-users/zsh-autosuggestions" "https://github.com/zsh-users/zsh-autosuggestions"
) )
@ -30,7 +30,7 @@ else
ANTIGEN_URL="https://gitee.com/dictxiong/antigen/raw/develop/bin/antigen.zsh" ANTIGEN_URL="https://gitee.com/dictxiong/antigen/raw/develop/bin/antigen.zsh"
ANTIGEN_OMZ_REPO_URL="https://gitee.com/dictxiong/ohmyzsh.git" ANTIGEN_OMZ_REPO_URL="https://gitee.com/dictxiong/ohmyzsh.git"
ANTIGEN_PLUGINS=( ANTIGEN_PLUGINS=(
"https://gitee.com/dictxiong/zsh-syntax-highlighting" "https://gitee.com/dictxiong/fast-syntax-highlighting"
"https://gitee.com/dictxiong/zsh-completions" "https://gitee.com/dictxiong/zsh-completions"
"https://gitee.com/dictxiong/zsh-autosuggestions" "https://gitee.com/dictxiong/zsh-autosuggestions"
) )

View File

@ -197,6 +197,9 @@ install_crontab()
{ {
if [[ -x $(command -v crontab) ]]; then if [[ -x $(command -v crontab) ]]; then
fmt_note "installing \"$CRON_JOB\" to crontab ..." fmt_note "installing \"$CRON_JOB\" to crontab ..."
if ! crontab -l 1>/dev/null 2>&1; then
echo -n | crontab -
fi
( crontab -l | grep -vxF "${CRON_JOB}" | grep -v "no crontab for"; echo "$CRON_JOB" ) | crontab - ( crontab -l | grep -vxF "${CRON_JOB}" | grep -v "no crontab for"; echo "$CRON_JOB" ) | crontab -
else else
fmt_warning "crontab does not exist. skipping ..." fmt_warning "crontab does not exist. skipping ..."

View File

@ -5,6 +5,19 @@ source "$THIS_DIR/../tools/common.sh"
RIOT_TRUST_CLIENT=${RIOT_TRUST_CLIENT:-${DFS_TRUST:-0}} RIOT_TRUST_CLIENT=${RIOT_TRUST_CLIENT:-${DFS_TRUST:-0}}
RIOT_TRUST_SERVER=${RIOT_TRUST_SERVER:-0} RIOT_TRUST_SERVER=${RIOT_TRUST_SERVER:-0}
# check if port number valid
check_port() {
( echo $1 | grep -qxE "[1-9][0-9]{0,4}" ) || return 1
test $1 -lt 65536 -a $1 -gt 0 || return 1
return 0
}
# check if username valid
check_username() {
( echo $1 | grep -qxE "^[a-z][-a-z0-9_]*\$" ) || return 1
return 0
}
# get single server setting # get single server setting
# may be called more than once # may be called more than once
get_server_meta() { get_server_meta() {
@ -20,22 +33,24 @@ get_server_meta() {
if [[ "$remote" == *@* ]]; then if [[ "$remote" == *@* ]]; then
RET_USERNAME=${remote%%@*} RET_USERNAME=${remote%%@*}
remote=${remote#*@} remote=${remote#*@}
check_username $RET_USERNAME || fmt_fatal invalid username \"$RET_USERNAME\"
fi fi
# if in the form ...:22 # if in the form ...:22
if [[ "$remote" == *:* ]]; then if [[ "$remote" == "["*"]":* || ( "$remote" != "["*"]" && "$remote" == *:* ) ]]; then
RET_PORT=${remote##*:} RET_PORT=${remote##*:}
remote=${remote%:*} remote=${remote%:*}
check_port $RET_PORT || fmt_fatal invalid port number \"$RET_PORT\"
fi fi
# presets -- match domain # presets -- match domain
local domain=${remote##*.} local domain=${remote##*.}
local host=${remote%.*} local host=${remote%.*}
# if there's no dot # if there's no dot
if [[ "$host" == "$domain" ]]; then if [[ "$host" == "$domain" && "$host" != "["*"]" ]]; then
domain="ibd" domain="ibd"
fi fi
case $domain in case $domain in
ibd|ebd ) i|ibd )
RET_HOSTNAME=$host.$domain.ink RET_HOSTNAME=$host.ibd.ink
RET_PORT=${RET_PORT:-12022} RET_PORT=${RET_PORT:-12022}
RET_USERNAME=${RET_USERNAME:-root} RET_USERNAME=${RET_USERNAME:-root}
RET_TRUST_SERVER=1 RET_TRUST_SERVER=1
@ -76,7 +91,7 @@ parse_remote() {
local remote="$1" local remote="$1"
local jump_servers="" local jump_servers=""
# loop for jump servers # loop for jump servers
while [[ -n $remote ]]; do while [[ -n $remote ]]; do
local server=${remote%%,*} local server=${remote%%,*}
remote=${remote#*,} remote=${remote#*,}
get_server_meta "$server" get_server_meta "$server"