diff --git a/.github/workflows/gitee_sync_dependencies.yml b/.github/workflows/gitee_sync_dependencies.yml index ff1616c..f2a31cb 100644 --- a/.github/workflows/gitee_sync_dependencies.yml +++ b/.github/workflows/gitee_sync_dependencies.yml @@ -38,6 +38,23 @@ jobs: force_update: true # 启用后,强制同步,即强制覆盖目的端仓库 static_list: "antigen,zsh-syntax-highlighting,zsh-autosuggestions,zsh-completions" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个 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: runs-on: ubuntu-20.04 steps: diff --git a/.zshrc2 b/.zshrc2 index 6a8759f..74bba80 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -22,7 +22,7 @@ if [[ "$DFS_NO_WALL" == "1" ]]; then ANTIGEN_URL="https://raw.githubusercontent.com/zsh-users/antigen/develop/bin/antigen.zsh" ANTIGEN_OMZ_REPO_URL="https://github.com/ohmyzsh/ohmyzsh.git" 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-autosuggestions" ) @@ -30,7 +30,7 @@ else ANTIGEN_URL="https://gitee.com/dictxiong/antigen/raw/develop/bin/antigen.zsh" ANTIGEN_OMZ_REPO_URL="https://gitee.com/dictxiong/ohmyzsh.git" 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-autosuggestions" ) diff --git a/install.sh b/install.sh index c155690..130f87f 100755 --- a/install.sh +++ b/install.sh @@ -197,6 +197,9 @@ install_crontab() { if [[ -x $(command -v crontab) ]]; then 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 - else fmt_warning "crontab does not exist. skipping ..." diff --git a/scripts/riot b/scripts/riot index a742801..8b8c1b6 100755 --- a/scripts/riot +++ b/scripts/riot @@ -5,6 +5,19 @@ source "$THIS_DIR/../tools/common.sh" RIOT_TRUST_CLIENT=${RIOT_TRUST_CLIENT:-${DFS_TRUST:-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 # may be called more than once get_server_meta() { @@ -20,22 +33,24 @@ get_server_meta() { if [[ "$remote" == *@* ]]; then RET_USERNAME=${remote%%@*} remote=${remote#*@} + check_username $RET_USERNAME || fmt_fatal invalid username \"$RET_USERNAME\" fi # if in the form ...:22 - if [[ "$remote" == *:* ]]; then + if [[ "$remote" == "["*"]":* || ( "$remote" != "["*"]" && "$remote" == *:* ) ]]; then RET_PORT=${remote##*:} remote=${remote%:*} + check_port $RET_PORT || fmt_fatal invalid port number \"$RET_PORT\" fi # presets -- match domain local domain=${remote##*.} local host=${remote%.*} # if there's no dot - if [[ "$host" == "$domain" ]]; then + if [[ "$host" == "$domain" && "$host" != "["*"]" ]]; then domain="ibd" fi case $domain in - ibd|ebd ) - RET_HOSTNAME=$host.$domain.ink + i|ibd ) + RET_HOSTNAME=$host.ibd.ink RET_PORT=${RET_PORT:-12022} RET_USERNAME=${RET_USERNAME:-root} RET_TRUST_SERVER=1 @@ -76,7 +91,7 @@ parse_remote() { local remote="$1" local jump_servers="" # loop for jump servers - while [[ -n $remote ]]; do + while [[ -n $remote ]]; do local server=${remote%%,*} remote=${remote#*,} get_server_meta "$server"