mirror of
https://github.com/DictXiong/dotfiles.git
synced 2026-11-06 03:58:16 +08:00
Compare commits
23 Commits
v1.4
...
4be9eb87f3
| Author | SHA1 | Date | |
|---|---|---|---|
| 4be9eb87f3 | |||
| bd5f14f11b | |||
| 70090242be | |||
| 86088ecfb1 | |||
| b02f249f68 | |||
| b005624be2 | |||
| f276f0719f | |||
| 270da9ca42 | |||
| 4af1aa4a4d | |||
| 38468291fc | |||
| 0c02851c7b | |||
| ed745c4ea2 | |||
| 21e9b7854c | |||
| 5318740ed4 | |||
| fb5804faef | |||
| 4c9cb23fb6 | |||
| 12d77a1e01 | |||
| 9d51db1c5b | |||
| 1215d4c352 | |||
| 7946656a7e | |||
| 1b32deeea1 | |||
| ba82ac68db | |||
| f1a77adb0c |
4
.github/workflows/gitee_sync.yml
vendored
4
.github/workflows/gitee_sync.yml
vendored
@@ -4,10 +4,10 @@ on:
|
||||
workflow_dispatch: ~
|
||||
jobs:
|
||||
dotfiles:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: DictXiong/dotfiles
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
uses: Yikun/hub-mirror-action@v1.5
|
||||
with:
|
||||
src: github/DictXiong
|
||||
dst: gitee/dictxiong
|
||||
|
||||
32
.github/workflows/gitee_sync_dependencies.yml
vendored
32
.github/workflows/gitee_sync_dependencies.yml
vendored
@@ -5,10 +5,10 @@ on:
|
||||
workflow_dispatch: ~
|
||||
jobs:
|
||||
ohmyzsh:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: ohmyzsh repo
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
uses: Yikun/hub-mirror-action@v1.5
|
||||
with:
|
||||
src: github/ohmyzsh
|
||||
dst: gitee/dictxiong
|
||||
@@ -22,10 +22,10 @@ jobs:
|
||||
static_list: "ohmyzsh"
|
||||
timeout: '600s'
|
||||
zsh-users:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: zsh-users repos
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
uses: Yikun/hub-mirror-action@v1.5
|
||||
with:
|
||||
src: github/zsh-users
|
||||
dst: gitee/dictxiong
|
||||
@@ -39,10 +39,10 @@ jobs:
|
||||
static_list: "antigen,zsh-syntax-highlighting,zsh-autosuggestions,zsh-completions"
|
||||
timeout: '600s'
|
||||
zdharma-continuum:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: zdharma-continuum repos
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
uses: Yikun/hub-mirror-action@v1.5
|
||||
with:
|
||||
src: github/zdharma-continuum
|
||||
dst: gitee/dictxiong
|
||||
@@ -56,10 +56,10 @@ jobs:
|
||||
static_list: "fast-syntax-highlighting"
|
||||
timeout: '600s'
|
||||
tmux-mem-cpu-load:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: thewtex/tmux-mem-cpu-load
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
uses: Yikun/hub-mirror-action@v1.5
|
||||
with:
|
||||
src: github/thewtex
|
||||
dst: gitee/dictxiong
|
||||
@@ -73,10 +73,10 @@ jobs:
|
||||
static_list: "tmux-mem-cpu-load"
|
||||
timeout: '600s'
|
||||
tmux-plugins:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: tmux-plugins
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
uses: Yikun/hub-mirror-action@v1.5
|
||||
with:
|
||||
src: github/tmux-plugins
|
||||
dst: gitee/dictxiong
|
||||
@@ -90,10 +90,10 @@ jobs:
|
||||
static_list: "tpm,tmux-resurrect,tmux-yank"
|
||||
timeout: '600s'
|
||||
vundle-vim:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: VundleVim/Vundle-vim
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
uses: Yikun/hub-mirror-action@v1.5
|
||||
with:
|
||||
src: github/VundleVim
|
||||
dst: gitee/dictxiong
|
||||
@@ -107,10 +107,10 @@ jobs:
|
||||
static_list: "Vundle.vim"
|
||||
timeout: '600s'
|
||||
onedark-vim:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: joshdick/onedark-vim
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
uses: Yikun/hub-mirror-action@v1.5
|
||||
with:
|
||||
src: github/joshdick
|
||||
dst: gitee/dictxiong
|
||||
@@ -124,10 +124,10 @@ jobs:
|
||||
static_list: "onedark.vim"
|
||||
timeout: '600s'
|
||||
fzf:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: junegunn/fzf
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
uses: Yikun/hub-mirror-action@v1.5
|
||||
with:
|
||||
src: github/junegunn
|
||||
dst: gitee/dictxiong
|
||||
|
||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
||||
|
||||
test-macos:
|
||||
name: test on macos
|
||||
runs-on: macos-12
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v4
|
||||
@@ -91,7 +91,7 @@ jobs:
|
||||
steps:
|
||||
- name: remove dependencies
|
||||
run: |
|
||||
sudo apt-get -y remove curl vim python3
|
||||
sudo apt-get -y remove curl vim
|
||||
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -4,25 +4,17 @@ ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGakUcSuNhuH7tk+Nj9gDfRtxYfGPL9yb8toQ/EpSJAM
|
||||
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCUN7IXF4nlFcVfgHesgik3LIAiXlVMYJPm3yD13EVarQx5jqdBgk8Dwgkgf4rPO6MFpvIpinOyEO8zOS6HHQrCLZUv5yTFaDkUuB7eQ0EmpicGbmk9bHqj1HkOZxaobkpEfQUmFKYvkp4EexVw66sO0qfXvjHZ4H6yCAJLK5aUnKfgrE8tODzP82sU/mpJjW+Pq3uanNq754gaHwhxCIXG143/zp8qzBAeKe38xVqqDq9fTkG4hvzFvkRdS88i6l1z++0P3n0HGdOjtSg7P7fO7+7ZyPYr0gO5vB720Om/zxqPrGd9cicWi4P+aVKa+0ujWH/pqufWG6uCjKWHnBs7 sk0/piv/9a
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGV/6cLUGA5YWVI6uPhIBOBZvlNBlZLkehHQN0Gxnc+B ltp0/ubuntu
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILqRfdez8IAOf6m9Ysi3uSNKEG0Xi6GPuhA6R2fci2yB ltp0/windows
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFO4k0tJ+Bfu95Uavg/5P3EXMKNcq+bMqaTqzkvRZ7ji ltp1/ubuntu
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN8g34WHLEix6Qt0J/ClYbZeb9wh+p1IOcZkz/vNbZrv ltp1/windows
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMyZILj+GxTUhdCgz2w1TxQ+aTcggnOJIb84qA4u271S ltp0
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBN24pvN1RMN+iSZyHPdyExA1Rvt8pdr3e6ih6iX+KrQ ltp2
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGZFTyR+R86fUpZBDkDR9yYzJpmeNsIv2CMHTh6EuEeq pc0/windows
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGZFTyR+R86fUpZBDkDR9yYzJpmeNsIv2CMHTh6EuEeq pc0
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHLYgVj+NPino6sOmahULN7SbAMaVAgzqPfDjz2S8zDv pc1/windows
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHLYgVj+NPino6sOmahULN7SbAMaVAgzqPfDjz2S8zDv pc1
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF52mPmbLEriZ+DfmrMHFtvg2kiO2JpRpitvs7PbJowh home0
|
||||
|
||||
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNvHya5i3GNniGww9Yx5ikos4Z5jevu8zz8hCQi05++SgejFPnbw9UjbHFjODK2M+ZHuhRF5mdf996r4/BxWyP8= pad0/sep
|
||||
|
||||
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC5gu+U4picxVvCNYjLlmxGLpJl7svj3LklO7jSpwqdrNxlE+/xkx07PJx76AbA77dDM1Dxmm/VOvVQCKTRLTgk= ip14/sep
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF52mPmbLEriZ+DfmrMHFtvg2kiO2JpRpitvs7PbJowh home0
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKhS4voo3K/Dvzqckr0bouO1WkCI5XxswstHWnuuyKBz ltp1-bd
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ case $DFS_UPDATE_CHANNEL in
|
||||
esac
|
||||
if [[ ${#DFS_COMMIT} != 40 ]]; then
|
||||
fmt_error "invalid commit id"
|
||||
apost_beacon "dfs.invalid-commit"
|
||||
apost_log "ERROR" "$THIS_FILE" "invalid commit id: ${DFS_COMMIT}"
|
||||
apost_beacon "dfs.invalid-commit" "invalid commit id: ${DFS_COMMIT}"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
11
.zshrc2
11
.zshrc2
@@ -69,6 +69,7 @@ ANTIGEN_PLUGINS+=(
|
||||
"fzf"
|
||||
"git"
|
||||
"magic-enter"
|
||||
"man"
|
||||
"per-directory-history"
|
||||
"pip"
|
||||
"podman"
|
||||
@@ -78,7 +79,7 @@ ANTIGEN_PLUGINS+=(
|
||||
"systemd"
|
||||
"timer"
|
||||
"tmux"
|
||||
"ufw"
|
||||
"web-search"
|
||||
"z"
|
||||
)
|
||||
for i in ${ANTIGEN_PLUGINS[*]}; do
|
||||
@@ -112,13 +113,11 @@ fi
|
||||
alias "pls"='sudo $(fc -ln -1)'
|
||||
alias "se"='sudo -sE'
|
||||
alias "sl"='sudo zsh -l'
|
||||
alias "cps"='rsync -avh --info=progress2'
|
||||
alias "mvs"='rsync -avh --info=progress2 --remove-source-files'
|
||||
if [[ "$DFS_OS_TYPE" == "linux" ]]; then alias "ping"='ping -n'; alias "ping6"='ping6 -n'; fi
|
||||
if [[ "$DFS_OS_TYPE" == "msys" ]]; then alias "tmux"='script -qO /dev/null -c "tmux -u"'; fi
|
||||
alias "pbd"='ping baidu.com'
|
||||
alias "p114"='ping 114.114.114.114'
|
||||
alias "p666"='ping6 2001:da8::666'
|
||||
alias "p666"='ping6 240c::6666'
|
||||
alias "cbd"='curl http://www.baidu.com'
|
||||
alias "cbds"='curl https://www.baidu.com'
|
||||
alias "gdebug"='git add -A; git commit --allow-empty -m "bug fix ($(date))"'
|
||||
@@ -129,8 +128,11 @@ alias "jce"='jc -e'
|
||||
alias "jceu"='jc -eu'
|
||||
alias "jcf"='jc -f'
|
||||
alias "jcfu"='jc -fu'
|
||||
alias "sc"='systemctl'
|
||||
alias "t"='tmux'
|
||||
gbes() { git for-each-ref --sort=-committerdate refs/heads refs/remotes --format="%(authordate:format:%y-%m-%d.%a %H:%M %z)|%(color:red)%(objectname:short)|%(color:yellow)%(refname:short)%(color:reset)|%(color:reset)%(authorname): %(color:green)%(subject)" --color=always | column -ts"|" | less -FX }
|
||||
sagt() { eval "$($DOTFILES/tools/sagent.sh $@)" }
|
||||
use() { nix --experimental-features nix-command --extra-experimental-features flakes shell "${(*)@/#%(#b)([^#]#)/nixpkgs#$match}" }
|
||||
|
||||
# key bindings
|
||||
bindkey "^b" beginning-of-line # ctrl+b
|
||||
@@ -186,7 +188,6 @@ dfs()
|
||||
"$DOTFILES/install.sh" -i
|
||||
echo 'Done. Please open a new shell to see the changes.'
|
||||
;;
|
||||
log ) "$DOTFILES/tools/common.sh" "post_log" "INFO" "dfs" "$2" ;;
|
||||
beacon ) "$DOTFILES/tools/common.sh" "post_beacon" "$2" "$3" ;;
|
||||
* ) echo "unknown command \"$1\". available: update, force-update, version, reset, cd, log" ;;
|
||||
esac
|
||||
|
||||
@@ -1,13 +1,29 @@
|
||||
#!/bin/false
|
||||
|
||||
# remotes
|
||||
j.remote() {
|
||||
remote=ssh.beardic.cn
|
||||
RET_PORT=${RET_PORT:-24022}
|
||||
RET_USERNAME=${RET_USERNAME:-root}
|
||||
RET_TRUST_SERVER=1
|
||||
# batches
|
||||
nasps.batch() {
|
||||
remotes+=(
|
||||
g1.nasp
|
||||
g2.nasp
|
||||
g3.nasp
|
||||
g4.nasp
|
||||
g5.nasp
|
||||
g6.nasp
|
||||
g7.nasp
|
||||
g8.nasp
|
||||
g9.nasp
|
||||
g10.nasp
|
||||
g11.nasp
|
||||
g12.nasp
|
||||
g13.nasp
|
||||
g14.nasp
|
||||
dictxiong@g15.nasp
|
||||
dictxiong@g16.nasp
|
||||
g17.nasp
|
||||
)
|
||||
}
|
||||
|
||||
# remotes
|
||||
nasp.remote() {
|
||||
remote=nasp.fit
|
||||
RET_PORT=${RET_PORT:-36022}
|
||||
@@ -18,6 +34,8 @@ nasp.remote() {
|
||||
# domains
|
||||
.domain() {
|
||||
RET_USERNAME=${RET_USERNAME:-root}
|
||||
RET_PORT=${RET_PORT:-12022}
|
||||
RET_HOSTNAME=${remote%.}
|
||||
}
|
||||
|
||||
dxng.domain() {
|
||||
@@ -41,15 +59,6 @@ i.domain() {
|
||||
RET_TRUST_SERVER=1
|
||||
}
|
||||
|
||||
x.domain() {
|
||||
RET_HOSTNAME=ssh.beardic.cn
|
||||
local tmp=$(sha256sum <<< "$host" | tr -cd "[:digit:]")
|
||||
tmp=${tmp:0:4}
|
||||
RET_PORT=$((10#$tmp+36000))
|
||||
RET_USERNAME=root
|
||||
RET_TRUST_SERVER=1
|
||||
}
|
||||
|
||||
nasp.domain() {
|
||||
RET_HOSTNAME=$host
|
||||
RET_PORT=${RET_PORT:-12022}
|
||||
|
||||
80
scripts/riot
80
scripts/riot
@@ -83,9 +83,9 @@ parse_remote() {
|
||||
TRUST_SERVER=1
|
||||
PORT="" # optional
|
||||
USERNAME="" # optional
|
||||
SSH_OPTIONS="" # optional
|
||||
SSH_OPTIONS="-o RequestTTY=yes" # optional
|
||||
if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then
|
||||
SSH_OPTIONS='-o PermitLocalCommand=yes'
|
||||
SSH_OPTIONS="$SSH_OPTIONS -o PermitLocalCommand=yes"
|
||||
if [[ "$(get_os_type)" != "msys" ]]; then
|
||||
test "$DFS_DRY_RUN" = "1" || mkdir -p ~/.ssh/master-socket
|
||||
SSH_OPTIONS="$SSH_OPTIONS -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C"
|
||||
@@ -123,10 +123,23 @@ parse_remote() {
|
||||
}
|
||||
|
||||
eval_or_echo() {
|
||||
local cmd="$@"
|
||||
local DO=""
|
||||
if [[ "$DFS_DRY_RUN" == "1" ]]; then
|
||||
echo $@
|
||||
DO=echo
|
||||
fi
|
||||
if [[ "$RIOT_USE_TMUX" == "1" ]]; then
|
||||
if [[ -z "$RIOT_TMUX_SESS" ]]; then
|
||||
RIOT_TMUX_SESS=riot-$(date +%s)
|
||||
RIOT_TMUX_WIN=0
|
||||
$DO tmux new-session -d -s $RIOT_TMUX_SESS bash -l
|
||||
else
|
||||
RIOT_TMUX_WIN=$((RIOT_TMUX_WIN+1))
|
||||
$DO tmux new-window -t $RIOT_TMUX_SESS:$RIOT_TMUX_WIN -d bash -l
|
||||
fi
|
||||
$DO tmux send-keys -t $RIOT_TMUX_SESS:$RIOT_TMUX_WIN "$cmd" Enter
|
||||
else
|
||||
eval $@
|
||||
$DO $cmd
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -189,11 +202,11 @@ run_scp() {
|
||||
dst_is_remote=0
|
||||
fi
|
||||
if [[ "$dst_is_remote" == "1" ]]; then
|
||||
SCP_SRC=\""$src"\"
|
||||
SERVER="$SERVER":\""$dst"\"
|
||||
SCP_SRC="$src"
|
||||
SERVER="$SERVER":"$dst"
|
||||
else
|
||||
SERVER="$SERVER":\""$src"\"
|
||||
SCP_DST=\""$dst"\"
|
||||
SERVER="$SERVER":"$src"
|
||||
SCP_DST="$dst"
|
||||
fi
|
||||
SSH_OPTIONS="$SSH_OPTIONS -r"
|
||||
local cmd="$(prepare_ssh_cmd scp)"
|
||||
@@ -201,11 +214,33 @@ run_scp() {
|
||||
eval_or_echo $cmd
|
||||
}
|
||||
|
||||
# remove host keys
|
||||
remove_hostkey()
|
||||
{
|
||||
local key
|
||||
if [[ -z "$PORT" || "$PORT" == "22" ]]; then
|
||||
key=$SERVER
|
||||
else
|
||||
key="[$SERVER]:$PORT"
|
||||
fi
|
||||
ssh-keygen -R "$key"
|
||||
}
|
||||
|
||||
# main
|
||||
print_help()
|
||||
{
|
||||
fmt_info "usage: $0 <service> [command] [options]"
|
||||
echo "available commands: ssh (default), sshl (ssh -L), zssh, sftp"
|
||||
cat <<EOF
|
||||
available commands:
|
||||
- ssh (default)
|
||||
- tmux (run ssh in multiple tmux windows)
|
||||
- sshl (ssh -L)
|
||||
- sshd (ssh -D)
|
||||
- zssh
|
||||
- sftp
|
||||
- rm (remove host keys)
|
||||
- ping/ping6 (let the remote to ping the given target)
|
||||
EOF
|
||||
}
|
||||
|
||||
router() {
|
||||
@@ -215,6 +250,15 @@ router() {
|
||||
fi
|
||||
|
||||
while [[ "$1" == -* ]]; do
|
||||
if [[ "$1" == "--tmux" ]]; then
|
||||
RIOT_USE_TMUX=1
|
||||
shift
|
||||
continue
|
||||
elif [[ "$1" == "-t" || "$1" == "--trust" ]]; then
|
||||
RIOT_TRUST_SERVER=1
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
RIOT_EXTRA_OPTIONS="$RIOT_EXTRA_OPTIONS $1"
|
||||
if [[ "$1" == "-o" ]]; then
|
||||
RIOT_EXTRA_OPTIONS="$RIOT_EXTRA_OPTIONS $2"
|
||||
@@ -224,13 +268,20 @@ router() {
|
||||
done
|
||||
|
||||
IFS=',' read -ra remotes <<< "$1"
|
||||
for remote in "${remotes[@]}"; do
|
||||
for ((i=0; i<${#remotes[@]}; i++)); do
|
||||
remote="${remotes[i]}"
|
||||
if [[ -z "$remote" ]]; then
|
||||
continue
|
||||
fi
|
||||
local batch_func="${remote}.batch"
|
||||
if is_function "$batch_func"; then
|
||||
"$batch_func"
|
||||
continue
|
||||
fi
|
||||
parse_remote "$remote"
|
||||
case $2 in
|
||||
ssh|"" )
|
||||
ssh|tmux|"" )
|
||||
[[ "$2" == tmux ]] && RIOT_USE_TMUX=1
|
||||
run_ssh ssh "${@:3}"
|
||||
;;
|
||||
ping|ping6 )
|
||||
@@ -254,12 +305,19 @@ router() {
|
||||
test -n "$4" || fmt_fatal "no destination path specified"
|
||||
run_scp "$3" "$4"
|
||||
;;
|
||||
rm )
|
||||
remove_hostkey
|
||||
;;
|
||||
* )
|
||||
print_help
|
||||
fmt_fatal "unknown command: $2"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n "$RIOT_TMUX_SESS" ]]; then
|
||||
tmux attach-session -t $RIOT_TMUX_SESS
|
||||
fi
|
||||
}
|
||||
|
||||
router "${GOT_OPTS[@]}"
|
||||
|
||||
@@ -162,19 +162,6 @@ ask_for_Yn()
|
||||
fi
|
||||
}
|
||||
|
||||
post_log()
|
||||
{
|
||||
if [[ $# != 3 || -z "$1" || -z "$2" || -z "$3" ]]; then
|
||||
fmt_fatal "usage: post_log <level> <section> <content>"
|
||||
fi
|
||||
"${DOTFILES}/tools/frigg-client.sh" "log" "[$1][$2] $3"
|
||||
}
|
||||
|
||||
apost_log()
|
||||
{
|
||||
post_log "$@" 1>/dev/null &
|
||||
}
|
||||
|
||||
post_beacon()
|
||||
{
|
||||
if [[ $# < 1 || -z "$1" ]]; then
|
||||
|
||||
@@ -63,8 +63,8 @@ handle_resp()
|
||||
|
||||
post_beacon()
|
||||
{
|
||||
local beacon_type=$1
|
||||
local meta=$2
|
||||
local beacon_type="$1"
|
||||
local meta="$2"
|
||||
if [[ -n "$CI" && "$beacon_type" != "gh.ci" && "$beacon_type" != "dfs.invalid-commit" && "$beacon_type" != "dfs.dirty" ]]; then
|
||||
return
|
||||
fi
|
||||
@@ -75,17 +75,6 @@ post_beacon()
|
||||
handle_resp "$resp"
|
||||
}
|
||||
|
||||
post_log()
|
||||
{
|
||||
local log_content=$1
|
||||
if [[ -z "$log_content" ]]; then
|
||||
fmt_fatal "log content is required"
|
||||
fi
|
||||
init_uuid
|
||||
resp=$(curl $DFS_CURL_OPTIONS -sSL -X POST -H "Content-Type: text/plain" -d "$log_content" "https://api.beardic.cn/post-log?hostname=$hostname&uuid=$uuid")
|
||||
handle_resp "$resp"
|
||||
}
|
||||
|
||||
update_dns()
|
||||
{
|
||||
if [[ -z "$DFS_DDNS_IP4$DFS_DDNS_IP6" ]]; then
|
||||
@@ -138,7 +127,7 @@ update_dns()
|
||||
|
||||
print_help()
|
||||
{
|
||||
fmt_info "usage: $0 <beacon|log|ddns> [beacon_type|log_content]"
|
||||
fmt_info "usage: $0 <beacon|ddns> [beacon_type] [beacon_meta]"
|
||||
}
|
||||
|
||||
router()
|
||||
@@ -150,9 +139,6 @@ router()
|
||||
beacon)
|
||||
post_beacon "$2" "$3"
|
||||
;;
|
||||
log)
|
||||
post_log "$2"
|
||||
;;
|
||||
ddns)
|
||||
update_dns
|
||||
;;
|
||||
|
||||
9
tools/sagent-op.sh
Executable file
9
tools/sagent-op.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
op=$(command -v op || command -v op.exe || true)
|
||||
if [[ ! -x $op ]]; then
|
||||
echo "1password cli not found" > /dev/stderr
|
||||
exit -1
|
||||
fi
|
||||
"$op" read "op://Personal/id25519-passphrase/$(hostname)"
|
||||
@@ -47,6 +47,12 @@ add_piv()
|
||||
list
|
||||
}
|
||||
|
||||
add_id25519_with_op()
|
||||
{
|
||||
SSH_ASKPASS_REQUIRE=force SSH_ASKPASS="$THIS_DIR/sagent-op.sh" timeout 60s ssh-add ~/.ssh/id_ed25519 || fmt_fatal "timed out when adding the key. probably the passphrase is wrong or 1password-cli is not working"
|
||||
list
|
||||
}
|
||||
|
||||
list()
|
||||
{
|
||||
echo echo "available keys:"
|
||||
@@ -96,6 +102,9 @@ route()
|
||||
piv)
|
||||
add_piv
|
||||
;;
|
||||
op)
|
||||
add_id25519_with_op
|
||||
;;
|
||||
reset)
|
||||
reset
|
||||
;;
|
||||
|
||||
@@ -27,7 +27,6 @@ fi
|
||||
|
||||
# check scripts and functions
|
||||
dfs version
|
||||
dfs log 1
|
||||
dfs beacon gh.ci $GITHUB_SHA
|
||||
z ~
|
||||
test ~ -ef "$(pwd)"
|
||||
@@ -41,8 +40,8 @@ test $(echo n | tools/common.sh ask_for_yN "test") = "0"
|
||||
test $(echo | tools/common.sh ask_for_yN "test") = "0"
|
||||
test $(echo | tools/common.sh ask_for_Yn "test") = "1"
|
||||
test $(DFS_QUIET=1 tools/common.sh ask_for_Yn "test") = "1"
|
||||
test "$(DFS_TRUST=1 riot time@is.impt:2222/yes@you-r.right/you@are.really.recht./ibd./try@it,another@host scp /tmp/ ./tmp -D 2>/dev/null)" = 'scp -P 12022 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C -o ProxyJump=time@is.impt:2222,yes@you-r.right,you@are.really.recht.,root@ibd. -r try@it.dxng.net:"/tmp/" "./tmp"
|
||||
scp -P 12022 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C -o ForwardX11=yes -o ForwardAgent=yes -r another@host.dxng.net:"/tmp/" "./tmp"'
|
||||
test "$(DFS_TRUST=1 riot time@is.impt:2222/yes@you-r.right/you@are.really.recht./ibd./try@it,another@host scp /tmp/ ./tmp -D 2>/dev/null)" = 'scp -P 12022 -o RequestTTY=yes -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C -o ProxyJump=time@is.impt:2222,yes@you-r.right:12022,you@are.really.recht:12022,root@ibd:12022 -r try@it.dxng.net:/tmp/ ./tmp
|
||||
scp -P 12022 -o RequestTTY=yes -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C -o ForwardX11=yes -o ForwardAgent=yes -r another@host.dxng.net:/tmp/ ./tmp'
|
||||
|
||||
# check alias
|
||||
alias p114
|
||||
|
||||
@@ -4,7 +4,7 @@ declare -A INSTALL_COMMANDS
|
||||
INSTALL_COMMANDS=(\
|
||||
[git]="apt update && apt install git" \
|
||||
[fzf]="git clone --depth 1 https://gitee.com/dictxiong/fzf.git ~/.fzf && ~/.fzf/install" \
|
||||
[acme.sh]="curl https://get.acme.sh | sh -s email=${EMAIL:-me@beardic.cn}" \
|
||||
[acme.sh]="curl https://get.acme.sh | sh -s email=${EMAIL:-acme@dxng.net}" \
|
||||
[oh-my-zsh]='sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"' \
|
||||
[oh-my-tuna]='wget https://tuna.moe/oh-my-tuna/oh-my-tuna.py && sudo python oh-my-tuna.py --global' \
|
||||
[v2fly]="bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) #--remove" \
|
||||
|
||||
Reference in New Issue
Block a user