Compare commits

..

3 Commits

Author SHA1 Message Date
xiongdian.me
41f910e31d .zshrc: warn if not in main channel 2023-08-02 00:00:10 +08:00
xiongdian.me
dbba66ccd0 riot: shortcuts i,x,j 2023-08-01 23:51:29 +08:00
xiongdian.me
2ecdf945a9 riot: add domain box[0-9] 2023-08-01 23:38:49 +08:00
2 changed files with 20 additions and 0 deletions

View File

@ -176,6 +176,11 @@ dfs()
esac esac
} }
# motd
if [[ "$DFS_INITED" != "1" && -n "$DFS_UPDATE_CHANNEL" && "$DFS_UPDATE_CHANNEL" != "main" ]]; then
echo dotfiles not in the main channel. use with caution.
fi
# clean # clean
unset i unset i
export DFS_INITED=1 export DFS_INITED=1

View File

@ -29,6 +29,14 @@ get_server_meta() {
RET_JUMP_SERVER="" # optional RET_JUMP_SERVER="" # optional
# body # body
local remote="$1" local remote="$1"
# shortcuts
if [[ "$remote" == "i" ]]; then
remote="sir0.ibd"
elif [[ "$remote" == "x" ]]; then
remote="bj1.ibd"
elif [[ "$remote" == "j" ]]; then
remote="sir0.ibd:36122"
fi
# if in the form user@... # if in the form user@...
if [[ "$remote" == *@* ]]; then if [[ "$remote" == *@* ]]; then
RET_USERNAME=${remote%%@*} RET_USERNAME=${remote%%@*}
@ -70,6 +78,13 @@ get_server_meta() {
RET_USERNAME=root RET_USERNAME=root
RET_TRUST_SERVER=1 RET_TRUST_SERVER=1
;; ;;
box[0-9] )
RET_HOSTNAME=$host
RET_PORT=${RET_PORT:-12022}
RET_USERNAME=${RET_USERNAME:-root}
RET_JUMP_SERVER="root@$domain.ibd.ink:12022"
RET_TRUST_SERVER=1
;;
* ) * )
test -z "$domain" || fmt_warning "unknown domain: \"$domain\". will try as host name" test -z "$domain" || fmt_warning "unknown domain: \"$domain\". will try as host name"
RET_HOSTNAME="$remote" RET_HOSTNAME="$remote"