Compare commits

..

5 Commits

Author SHA1 Message Date
xiongdian.me
7600d07d46 fix(riot): not mkdir if dry-run 2024-04-16 21:44:38 +08:00
xiongdian.me
5d6d13e623 fix(ci): riot control master 2024-04-16 21:36:47 +08:00
xiongdian.me
500c3bdfe5 fix(riot): secure control master 2024-04-16 21:31:08 +08:00
xiongdian.me
36fd85121b feat(test.zsh): test crontab 2024-04-16 19:36:10 +08:00
xiongdian.me
b31bcfe44b fix(install.sh): install crontab (exp) 2024-04-16 17:41:49 +08:00
3 changed files with 13 additions and 6 deletions

View File

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

View File

@ -85,7 +85,11 @@ parse_remote() {
USERNAME="" # optional
SSH_OPTIONS="" # optional
if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then
SSH_OPTIONS='-o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes'
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"
fi
fi
# handle input
local remote="$1"

View File

@ -21,6 +21,9 @@ test -f .zshrc2
diff -q ./.ssh/authorized_keys2 ~/.ssh/authorized_keys2
diff -q ./.eid/authorized_certificates ~/.eid/authorized_certificates
grep -q ".zshrc2" ~/.zshrc
if [[ -x $(command -v crontab) ]]; then
crontab -l | grep -qxF "0 * * * * ${DOTFILES}/update.sh"
fi
# check scripts and functions
dfs version
@ -38,8 +41,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 ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes -o ProxyJump=time@is.impt:2222,yes@you-r.right,you@are.really.recht.,root@ibd. -r try@it.ibd.ink:"/tmp/" "./tmp"
scp -P 12022 -o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes -o ForwardX11=yes -o ForwardAgent=yes -r another@host.ibd.ink:"/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 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.ibd.ink:"/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.ibd.ink:"/tmp/" "./tmp"'
# check alias
alias p114