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

View File

@ -82,6 +82,13 @@ antigen theme ${ZSH_THEME:-$TMP_THEME}
antigen apply antigen apply
# end of antigen config # 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
alias "pls"='sudo $(fc -ln -1)' alias "pls"='sudo $(fc -ln -1)'
alias "se"='sudo -sE' alias "se"='sudo -sE'

View File

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

View File

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

View File

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