mirror of
https://github.com/DictXiong/dotfiles.git
synced 2026-11-06 03:58:16 +08:00
Compare commits
21 Commits
v1.4
...
70090242be
| Author | SHA1 | Date | |
|---|---|---|---|
| 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: ~
|
workflow_dispatch: ~
|
||||||
jobs:
|
jobs:
|
||||||
dotfiles:
|
dotfiles:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: DictXiong/dotfiles
|
- name: DictXiong/dotfiles
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
uses: Yikun/hub-mirror-action@v1.5
|
||||||
with:
|
with:
|
||||||
src: github/DictXiong
|
src: github/DictXiong
|
||||||
dst: gitee/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: ~
|
workflow_dispatch: ~
|
||||||
jobs:
|
jobs:
|
||||||
ohmyzsh:
|
ohmyzsh:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: ohmyzsh repo
|
- name: ohmyzsh repo
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
uses: Yikun/hub-mirror-action@v1.5
|
||||||
with:
|
with:
|
||||||
src: github/ohmyzsh
|
src: github/ohmyzsh
|
||||||
dst: gitee/dictxiong
|
dst: gitee/dictxiong
|
||||||
@@ -22,10 +22,10 @@ jobs:
|
|||||||
static_list: "ohmyzsh"
|
static_list: "ohmyzsh"
|
||||||
timeout: '600s'
|
timeout: '600s'
|
||||||
zsh-users:
|
zsh-users:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: zsh-users repos
|
- name: zsh-users repos
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
uses: Yikun/hub-mirror-action@v1.5
|
||||||
with:
|
with:
|
||||||
src: github/zsh-users
|
src: github/zsh-users
|
||||||
dst: gitee/dictxiong
|
dst: gitee/dictxiong
|
||||||
@@ -39,10 +39,10 @@ jobs:
|
|||||||
static_list: "antigen,zsh-syntax-highlighting,zsh-autosuggestions,zsh-completions"
|
static_list: "antigen,zsh-syntax-highlighting,zsh-autosuggestions,zsh-completions"
|
||||||
timeout: '600s'
|
timeout: '600s'
|
||||||
zdharma-continuum:
|
zdharma-continuum:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: zdharma-continuum repos
|
- name: zdharma-continuum repos
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
uses: Yikun/hub-mirror-action@v1.5
|
||||||
with:
|
with:
|
||||||
src: github/zdharma-continuum
|
src: github/zdharma-continuum
|
||||||
dst: gitee/dictxiong
|
dst: gitee/dictxiong
|
||||||
@@ -56,10 +56,10 @@ jobs:
|
|||||||
static_list: "fast-syntax-highlighting"
|
static_list: "fast-syntax-highlighting"
|
||||||
timeout: '600s'
|
timeout: '600s'
|
||||||
tmux-mem-cpu-load:
|
tmux-mem-cpu-load:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: thewtex/tmux-mem-cpu-load
|
- name: thewtex/tmux-mem-cpu-load
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
uses: Yikun/hub-mirror-action@v1.5
|
||||||
with:
|
with:
|
||||||
src: github/thewtex
|
src: github/thewtex
|
||||||
dst: gitee/dictxiong
|
dst: gitee/dictxiong
|
||||||
@@ -73,10 +73,10 @@ jobs:
|
|||||||
static_list: "tmux-mem-cpu-load"
|
static_list: "tmux-mem-cpu-load"
|
||||||
timeout: '600s'
|
timeout: '600s'
|
||||||
tmux-plugins:
|
tmux-plugins:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: tmux-plugins
|
- name: tmux-plugins
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
uses: Yikun/hub-mirror-action@v1.5
|
||||||
with:
|
with:
|
||||||
src: github/tmux-plugins
|
src: github/tmux-plugins
|
||||||
dst: gitee/dictxiong
|
dst: gitee/dictxiong
|
||||||
@@ -90,10 +90,10 @@ jobs:
|
|||||||
static_list: "tpm,tmux-resurrect,tmux-yank"
|
static_list: "tpm,tmux-resurrect,tmux-yank"
|
||||||
timeout: '600s'
|
timeout: '600s'
|
||||||
vundle-vim:
|
vundle-vim:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: VundleVim/Vundle-vim
|
- name: VundleVim/Vundle-vim
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
uses: Yikun/hub-mirror-action@v1.5
|
||||||
with:
|
with:
|
||||||
src: github/VundleVim
|
src: github/VundleVim
|
||||||
dst: gitee/dictxiong
|
dst: gitee/dictxiong
|
||||||
@@ -107,10 +107,10 @@ jobs:
|
|||||||
static_list: "Vundle.vim"
|
static_list: "Vundle.vim"
|
||||||
timeout: '600s'
|
timeout: '600s'
|
||||||
onedark-vim:
|
onedark-vim:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: joshdick/onedark-vim
|
- name: joshdick/onedark-vim
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
uses: Yikun/hub-mirror-action@v1.5
|
||||||
with:
|
with:
|
||||||
src: github/joshdick
|
src: github/joshdick
|
||||||
dst: gitee/dictxiong
|
dst: gitee/dictxiong
|
||||||
@@ -124,10 +124,10 @@ jobs:
|
|||||||
static_list: "onedark.vim"
|
static_list: "onedark.vim"
|
||||||
timeout: '600s'
|
timeout: '600s'
|
||||||
fzf:
|
fzf:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: junegunn/fzf
|
- name: junegunn/fzf
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
uses: Yikun/hub-mirror-action@v1.5
|
||||||
with:
|
with:
|
||||||
src: github/junegunn
|
src: github/junegunn
|
||||||
dst: gitee/dictxiong
|
dst: gitee/dictxiong
|
||||||
|
|||||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
|||||||
|
|
||||||
test-macos:
|
test-macos:
|
||||||
name: test on macos
|
name: test on macos
|
||||||
runs-on: macos-12
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout repo
|
- name: checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -91,7 +91,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: remove dependencies
|
- name: remove dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y remove curl vim python3
|
sudo apt-get -y remove curl vim
|
||||||
|
|
||||||
- name: checkout repo
|
- name: checkout repo
|
||||||
uses: actions/checkout@v4
|
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-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCUN7IXF4nlFcVfgHesgik3LIAiXlVMYJPm3yD13EVarQx5jqdBgk8Dwgkgf4rPO6MFpvIpinOyEO8zOS6HHQrCLZUv5yTFaDkUuB7eQ0EmpicGbmk9bHqj1HkOZxaobkpEfQUmFKYvkp4EexVw66sO0qfXvjHZ4H6yCAJLK5aUnKfgrE8tODzP82sU/mpJjW+Pq3uanNq754gaHwhxCIXG143/zp8qzBAeKe38xVqqDq9fTkG4hvzFvkRdS88i6l1z++0P3n0HGdOjtSg7P7fO7+7ZyPYr0gO5vB720Om/zxqPrGd9cicWi4P+aVKa+0ujWH/pqufWG6uCjKWHnBs7 sk0/piv/9a
|
||||||
|
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGV/6cLUGA5YWVI6uPhIBOBZvlNBlZLkehHQN0Gxnc+B ltp0/ubuntu
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMyZILj+GxTUhdCgz2w1TxQ+aTcggnOJIb84qA4u271S ltp0
|
||||||
|
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILqRfdez8IAOf6m9Ysi3uSNKEG0Xi6GPuhA6R2fci2yB ltp0/windows
|
|
||||||
|
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFO4k0tJ+Bfu95Uavg/5P3EXMKNcq+bMqaTqzkvRZ7ji ltp1/ubuntu
|
|
||||||
|
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN8g34WHLEix6Qt0J/ClYbZeb9wh+p1IOcZkz/vNbZrv ltp1/windows
|
|
||||||
|
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBN24pvN1RMN+iSZyHPdyExA1Rvt8pdr3e6ih6iX+KrQ ltp2
|
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 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNvHya5i3GNniGww9Yx5ikos4Z5jevu8zz8hCQi05++SgejFPnbw9UjbHFjODK2M+ZHuhRF5mdf996r4/BxWyP8= pad0/sep
|
||||||
|
|
||||||
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC5gu+U4picxVvCNYjLlmxGLpJl7svj3LklO7jSpwqdrNxlE+/xkx07PJx76AbA77dDM1Dxmm/VOvVQCKTRLTgk= ip14/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
|
esac
|
||||||
if [[ ${#DFS_COMMIT} != 40 ]]; then
|
if [[ ${#DFS_COMMIT} != 40 ]]; then
|
||||||
fmt_error "invalid commit id"
|
fmt_error "invalid commit id"
|
||||||
apost_beacon "dfs.invalid-commit"
|
apost_beacon "dfs.invalid-commit" "invalid commit id: ${DFS_COMMIT}"
|
||||||
apost_log "ERROR" "$THIS_FILE" "invalid commit id: ${DFS_COMMIT}"
|
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
2
.zshrc2
2
.zshrc2
@@ -131,6 +131,7 @@ alias "jcf"='jc -f'
|
|||||||
alias "jcfu"='jc -fu'
|
alias "jcfu"='jc -fu'
|
||||||
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 }
|
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 $@)" }
|
sagt() { eval "$($DOTFILES/tools/sagent.sh $@)" }
|
||||||
|
use() { nix --experimental-features nix-command --extra-experimental-features flakes shell "${(*)@/#%(#b)([^#]#)/nixpkgs#$match}" }
|
||||||
|
|
||||||
# key bindings
|
# key bindings
|
||||||
bindkey "^b" beginning-of-line # ctrl+b
|
bindkey "^b" beginning-of-line # ctrl+b
|
||||||
@@ -186,7 +187,6 @@ dfs()
|
|||||||
"$DOTFILES/install.sh" -i
|
"$DOTFILES/install.sh" -i
|
||||||
echo 'Done. Please open a new shell to see the changes.'
|
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" ;;
|
beacon ) "$DOTFILES/tools/common.sh" "post_beacon" "$2" "$3" ;;
|
||||||
* ) echo "unknown command \"$1\". available: update, force-update, version, reset, cd, log" ;;
|
* ) echo "unknown command \"$1\". available: update, force-update, version, reset, cd, log" ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -1,13 +1,29 @@
|
|||||||
#!/bin/false
|
#!/bin/false
|
||||||
|
|
||||||
# remotes
|
# batches
|
||||||
j.remote() {
|
nasps.batch() {
|
||||||
remote=ssh.beardic.cn
|
remotes+=(
|
||||||
RET_PORT=${RET_PORT:-24022}
|
g1.nasp
|
||||||
RET_USERNAME=${RET_USERNAME:-root}
|
g2.nasp
|
||||||
RET_TRUST_SERVER=1
|
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() {
|
nasp.remote() {
|
||||||
remote=nasp.fit
|
remote=nasp.fit
|
||||||
RET_PORT=${RET_PORT:-36022}
|
RET_PORT=${RET_PORT:-36022}
|
||||||
@@ -18,6 +34,8 @@ nasp.remote() {
|
|||||||
# domains
|
# domains
|
||||||
.domain() {
|
.domain() {
|
||||||
RET_USERNAME=${RET_USERNAME:-root}
|
RET_USERNAME=${RET_USERNAME:-root}
|
||||||
|
RET_PORT=${RET_PORT:-12022}
|
||||||
|
RET_HOSTNAME=${remote%.}
|
||||||
}
|
}
|
||||||
|
|
||||||
dxng.domain() {
|
dxng.domain() {
|
||||||
@@ -41,15 +59,6 @@ i.domain() {
|
|||||||
RET_TRUST_SERVER=1
|
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() {
|
nasp.domain() {
|
||||||
RET_HOSTNAME=$host
|
RET_HOSTNAME=$host
|
||||||
RET_PORT=${RET_PORT:-12022}
|
RET_PORT=${RET_PORT:-12022}
|
||||||
|
|||||||
76
scripts/riot
76
scripts/riot
@@ -83,9 +83,9 @@ parse_remote() {
|
|||||||
TRUST_SERVER=1
|
TRUST_SERVER=1
|
||||||
PORT="" # optional
|
PORT="" # optional
|
||||||
USERNAME="" # optional
|
USERNAME="" # optional
|
||||||
SSH_OPTIONS="" # optional
|
SSH_OPTIONS="-o RequestTTY=yes" # optional
|
||||||
if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then
|
if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then
|
||||||
SSH_OPTIONS='-o PermitLocalCommand=yes'
|
SSH_OPTIONS="$SSH_OPTIONS -o PermitLocalCommand=yes"
|
||||||
if [[ "$(get_os_type)" != "msys" ]]; then
|
if [[ "$(get_os_type)" != "msys" ]]; then
|
||||||
test "$DFS_DRY_RUN" = "1" || mkdir -p ~/.ssh/master-socket
|
test "$DFS_DRY_RUN" = "1" || mkdir -p ~/.ssh/master-socket
|
||||||
SSH_OPTIONS="$SSH_OPTIONS -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C"
|
SSH_OPTIONS="$SSH_OPTIONS -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C"
|
||||||
@@ -123,10 +123,23 @@ parse_remote() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eval_or_echo() {
|
eval_or_echo() {
|
||||||
|
local cmd="$@"
|
||||||
|
local DO=""
|
||||||
if [[ "$DFS_DRY_RUN" == "1" ]]; then
|
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
|
else
|
||||||
eval $@
|
$DO $cmd
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,11 +202,11 @@ run_scp() {
|
|||||||
dst_is_remote=0
|
dst_is_remote=0
|
||||||
fi
|
fi
|
||||||
if [[ "$dst_is_remote" == "1" ]]; then
|
if [[ "$dst_is_remote" == "1" ]]; then
|
||||||
SCP_SRC=\""$src"\"
|
SCP_SRC="$src"
|
||||||
SERVER="$SERVER":\""$dst"\"
|
SERVER="$SERVER":"$dst"
|
||||||
else
|
else
|
||||||
SERVER="$SERVER":\""$src"\"
|
SERVER="$SERVER":"$src"
|
||||||
SCP_DST=\""$dst"\"
|
SCP_DST="$dst"
|
||||||
fi
|
fi
|
||||||
SSH_OPTIONS="$SSH_OPTIONS -r"
|
SSH_OPTIONS="$SSH_OPTIONS -r"
|
||||||
local cmd="$(prepare_ssh_cmd scp)"
|
local cmd="$(prepare_ssh_cmd scp)"
|
||||||
@@ -201,11 +214,33 @@ run_scp() {
|
|||||||
eval_or_echo $cmd
|
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
|
# main
|
||||||
print_help()
|
print_help()
|
||||||
{
|
{
|
||||||
fmt_info "usage: $0 <service> [command] [options]"
|
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() {
|
router() {
|
||||||
@@ -215,6 +250,11 @@ router() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while [[ "$1" == -* ]]; do
|
while [[ "$1" == -* ]]; do
|
||||||
|
if [[ "$1" == "--tmux" ]]; then
|
||||||
|
RIOT_USE_TMUX=1
|
||||||
|
shift
|
||||||
|
continue
|
||||||
|
fi
|
||||||
RIOT_EXTRA_OPTIONS="$RIOT_EXTRA_OPTIONS $1"
|
RIOT_EXTRA_OPTIONS="$RIOT_EXTRA_OPTIONS $1"
|
||||||
if [[ "$1" == "-o" ]]; then
|
if [[ "$1" == "-o" ]]; then
|
||||||
RIOT_EXTRA_OPTIONS="$RIOT_EXTRA_OPTIONS $2"
|
RIOT_EXTRA_OPTIONS="$RIOT_EXTRA_OPTIONS $2"
|
||||||
@@ -224,13 +264,20 @@ router() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
IFS=',' read -ra remotes <<< "$1"
|
IFS=',' read -ra remotes <<< "$1"
|
||||||
for remote in "${remotes[@]}"; do
|
for ((i=0; i<${#remotes[@]}; i++)); do
|
||||||
|
remote="${remotes[i]}"
|
||||||
if [[ -z "$remote" ]]; then
|
if [[ -z "$remote" ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
local batch_func="${remote}.batch"
|
||||||
|
if is_function "$batch_func"; then
|
||||||
|
"$batch_func"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
parse_remote "$remote"
|
parse_remote "$remote"
|
||||||
case $2 in
|
case $2 in
|
||||||
ssh|"" )
|
ssh|tmux|"" )
|
||||||
|
[[ "$2" == tmux ]] && RIOT_USE_TMUX=1
|
||||||
run_ssh ssh "${@:3}"
|
run_ssh ssh "${@:3}"
|
||||||
;;
|
;;
|
||||||
ping|ping6 )
|
ping|ping6 )
|
||||||
@@ -254,12 +301,19 @@ router() {
|
|||||||
test -n "$4" || fmt_fatal "no destination path specified"
|
test -n "$4" || fmt_fatal "no destination path specified"
|
||||||
run_scp "$3" "$4"
|
run_scp "$3" "$4"
|
||||||
;;
|
;;
|
||||||
|
rm )
|
||||||
|
remove_hostkey
|
||||||
|
;;
|
||||||
* )
|
* )
|
||||||
print_help
|
print_help
|
||||||
fmt_fatal "unknown command: $2"
|
fmt_fatal "unknown command: $2"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ -n "$RIOT_TMUX_SESS" ]]; then
|
||||||
|
tmux attach-session -t $RIOT_TMUX_SESS
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
router "${GOT_OPTS[@]}"
|
router "${GOT_OPTS[@]}"
|
||||||
|
|||||||
@@ -162,19 +162,6 @@ ask_for_Yn()
|
|||||||
fi
|
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()
|
post_beacon()
|
||||||
{
|
{
|
||||||
if [[ $# < 1 || -z "$1" ]]; then
|
if [[ $# < 1 || -z "$1" ]]; then
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ handle_resp()
|
|||||||
|
|
||||||
post_beacon()
|
post_beacon()
|
||||||
{
|
{
|
||||||
local beacon_type=$1
|
local beacon_type="$1"
|
||||||
local meta=$2
|
local meta="$2"
|
||||||
if [[ -n "$CI" && "$beacon_type" != "gh.ci" && "$beacon_type" != "dfs.invalid-commit" && "$beacon_type" != "dfs.dirty" ]]; then
|
if [[ -n "$CI" && "$beacon_type" != "gh.ci" && "$beacon_type" != "dfs.invalid-commit" && "$beacon_type" != "dfs.dirty" ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -75,17 +75,6 @@ post_beacon()
|
|||||||
handle_resp "$resp"
|
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()
|
update_dns()
|
||||||
{
|
{
|
||||||
if [[ -z "$DFS_DDNS_IP4$DFS_DDNS_IP6" ]]; then
|
if [[ -z "$DFS_DDNS_IP4$DFS_DDNS_IP6" ]]; then
|
||||||
@@ -138,7 +127,7 @@ update_dns()
|
|||||||
|
|
||||||
print_help()
|
print_help()
|
||||||
{
|
{
|
||||||
fmt_info "usage: $0 <beacon|log|ddns> [beacon_type|log_content]"
|
fmt_info "usage: $0 <beacon|ddns> [beacon_type] [beacon_meta]"
|
||||||
}
|
}
|
||||||
|
|
||||||
router()
|
router()
|
||||||
@@ -150,9 +139,6 @@ router()
|
|||||||
beacon)
|
beacon)
|
||||||
post_beacon "$2" "$3"
|
post_beacon "$2" "$3"
|
||||||
;;
|
;;
|
||||||
log)
|
|
||||||
post_log "$2"
|
|
||||||
;;
|
|
||||||
ddns)
|
ddns)
|
||||||
update_dns
|
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
|
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()
|
list()
|
||||||
{
|
{
|
||||||
echo echo "available keys:"
|
echo echo "available keys:"
|
||||||
@@ -96,6 +102,9 @@ route()
|
|||||||
piv)
|
piv)
|
||||||
add_piv
|
add_piv
|
||||||
;;
|
;;
|
||||||
|
op)
|
||||||
|
add_id25519_with_op
|
||||||
|
;;
|
||||||
reset)
|
reset)
|
||||||
reset
|
reset
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ fi
|
|||||||
|
|
||||||
# check scripts and functions
|
# check scripts and functions
|
||||||
dfs version
|
dfs version
|
||||||
dfs log 1
|
|
||||||
dfs beacon gh.ci $GITHUB_SHA
|
dfs beacon gh.ci $GITHUB_SHA
|
||||||
z ~
|
z ~
|
||||||
test ~ -ef "$(pwd)"
|
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") = "0"
|
||||||
test $(echo | tools/common.sh ask_for_Yn "test") = "1"
|
test $(echo | tools/common.sh ask_for_Yn "test") = "1"
|
||||||
test $(DFS_QUIET=1 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"
|
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 PermitLocalCommand=yes -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C -o ForwardX11=yes -o ForwardAgent=yes -r another@host.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
|
# check alias
|
||||||
alias p114
|
alias p114
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ declare -A INSTALL_COMMANDS
|
|||||||
INSTALL_COMMANDS=(\
|
INSTALL_COMMANDS=(\
|
||||||
[git]="apt update && apt install git" \
|
[git]="apt update && apt install git" \
|
||||||
[fzf]="git clone --depth 1 https://gitee.com/dictxiong/fzf.git ~/.fzf && ~/.fzf/install" \
|
[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-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' \
|
[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" \
|
[v2fly]="bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) #--remove" \
|
||||||
|
|||||||
Reference in New Issue
Block a user