From 89c8383ed59b9e6a07ac24c6f5a1b839228cddb7 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Tue, 29 Nov 2022 19:42:20 +0800 Subject: [PATCH] logger.sh: not need to use uuid5 --- .github/workflows/test.yml | 2 +- install.sh | 2 +- tools/logger.sh | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1017e2..cd88741 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,7 +58,7 @@ jobs: - name: install dependencies run: | brew update - brew install git python3 zsh curl e2fsprogs + brew install git python3 zsh curl sudo pip3 install requests - name: checkout repo diff --git a/install.sh b/install.sh index 147ceef..b6c1233 100755 --- a/install.sh +++ b/install.sh @@ -45,7 +45,7 @@ install_dependencies() ;; "macos" ) $SUDO brew update - $SUDO brew install git zsh curl tmux vim util-linux e2fsprogs + $SUDO brew install git zsh curl tmux vim util-linux ;; "msys" ) pacman -Syu diff --git a/tools/logger.sh b/tools/logger.sh index f7bb8b5..a822b04 100755 --- a/tools/logger.sh +++ b/tools/logger.sh @@ -22,19 +22,20 @@ fi init_uuid() { - local raw_uuid - if [[ -f /var/lib/dbus/machine-id ]]; then - raw_uuid=$(cat /var/lib/dbus/machine-id) - elif [[ -f /etc/machine-id ]]; then - raw_uuid=$(cat /etc/machine-id) - elif [[ -f ~/.config/dotfiles/uuid ]]; then - raw_uuid=$(cat ~/.config/dotfiles/uuid) + local uuid + if [[ -f ~/.config/dotfiles/uuid ]]; then + uuid=$(cat ~/.config/dotfiles/uuid) else + if [[ -x $(command -v uuidgen) ]]; then + uuid=$(uuidgen) + elif [[ -f /proc/sys/kernel/random/uuid ]]; then + uuid=$(cat /proc/sys/kernel/random/uuid) + else + fmt_fatal "unable to generate uuid" + fi mkdir -p ~/.config/dotfiles - raw_uuid=$(uuidgen) - echo "$raw_uuid" > ~/.config/dotfiles/uuid + echo "$uuid" > ~/.config/dotfiles/uuid fi - uuid=$(uuidgen -n "cc23b903-1993-44eb-9c90-48bd841eeac3" -s -N "$raw_uuid") } post_beacon()