diff --git a/.update.sh b/.update.sh index 2a207e0..80b84c8 100644 --- a/.update.sh +++ b/.update.sh @@ -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 diff --git a/.zshrc2 b/.zshrc2 index 85a690a..0b957b8 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -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' diff --git a/install.sh b/install.sh index 11a1e9a..b6c1233 100755 --- a/install.sh +++ b/install.sh @@ -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!" } diff --git a/tools/common.sh b/tools/common.sh index c192ab4..152ea16 100755 --- a/tools/common.sh +++ b/tools/common.sh @@ -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 diff --git a/tools/test.zsh b/tools/test.zsh index b6af5ec..c1eaa05 100644 --- a/tools/test.zsh +++ b/tools/test.zsh @@ -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