async log; beacon add sys.login

This commit is contained in:
Dict Xiong 2022-11-28 22:02:10 +08:00
parent e6441e018c
commit 99d63c085c
5 changed files with 23 additions and 6 deletions

View File

@ -12,7 +12,7 @@ cd $DOTFILES
git fetch --all --prune
if [[ -n "$(git status -s)" ]]; then
fmt_error "directory not clean"
post_beacon "dfs.dirty" 1>/dev/null &
apost_beacon "dfs.dirty"
exit
fi
@ -25,7 +25,7 @@ case $DFS_UPDATE_CHANNEL in
esac
if [[ ${#DFS_COMMIT} != 40 ]]; then
fmt_error "invalid commit id"
post_beacon "dfs.invalid-commit" 1>/dev/null &
apost_beacon "dfs.invalid-commit"
post_log "ERROR" "$THIS_FILE" "invalid commit id: ${DFS_COMMIT}"
exit
fi
@ -36,7 +36,7 @@ if [[ "$(git rev-parse HEAD)" == "$DFS_COMMIT" ]]; then
else
fmt_info "checking out to commit $DFS_COMMIT ..."
if [[ -z "$DFS_DEV" ]]; then
post_beacon "dfs.updated" 1>/dev/null &
apost_beacon "dfs.updated"
git -c advice.detachedHead=false checkout $DFS_COMMIT
cp ./.update.sh ./update.sh && chmod +x ./update.sh && exit $DFS_UPDATED_RET
else

View File

@ -82,6 +82,13 @@ antigen theme ${ZSH_THEME:-$TMP_THEME}
antigen apply
# end of antigen config
# beacon
if [[ "$EUID" == "0" ]]; then
"$DOTFILES/tools/common.sh" apost_beacon "sys.login.root"
else
"$DOTFILES/tools/common.sh" apost_beacon "sys.login.user"
fi
# alias
alias "pls"='sudo $(fc -ln -1)'
alias "se"='sudo -sE'

View File

@ -230,7 +230,7 @@ install(){
install_crontab
install_file_content
install_symlink
post_beacon "dfs.installed" 1>/dev/null &
apost_beacon "dfs.installed"
# those that won't be uninstalled in the future
install_tmux_tpm
install_vim_vundle
@ -247,7 +247,7 @@ uninstall(){
uninstall_crontab
uninstall_file_content
uninstall_symlink
post_beacon "dfs.uninstalled" 1>/dev/null &
apost_beacon "dfs.uninstalled"
fmt_note "done uninstalling!"
}

View File

@ -151,11 +151,21 @@ post_log()
"${DOTFILES}/tools/logger.sh" "log" "[$1][$2] $3"
}
apost_log()
{
post_log "$@" 1>/dev/null &
}
post_beacon()
{
"${DOTFILES}/tools/logger.sh" "beacon" "$1"
}
apost_beacon()
{
post_beacon "$@" 1>/dev/null &
}
get_os_type() {
local ans="unknown"
case "$(uname -s)" in

View File

@ -17,7 +17,7 @@ grep -q ".zshrc2" ~/.zshrc
# check scripts and functions
dfs version
dfs log 1
dfs beacon github-ci
dfs beacon gh.ci
z ~
test ~ -ef "$(pwd)"
dogo