minor fix in install scripts

pull/58/head
Simon Let 6 years ago
parent 87bb509dfb
commit cd703c185a
  1. 16
      scripts/install.sh
  2. 10
      scripts/util.sh

@ -128,6 +128,15 @@ fi
# Final touch
touch ~/.resh_history.json
# Generating resh-uuid ...
[ -e ~/.resh/resh-uuid ] \
|| cat /proc/sys/kernel/random/uuid > ~/.resh/resh-uuid 2>/dev/null \
|| scripts/uuid.sh > ~/.resh/resh-uuid 2>/dev/null
# Source utils to get __resh_run_daemon function
# shellcheck source=util.sh
. ~/.resh/util.sh
# Restarting resh daemon ...
if [ -f ~/.resh/resh.pid ]; then
kill -SIGTERM "$(cat ~/.resh/resh.pid)" || true
@ -135,12 +144,9 @@ if [ -f ~/.resh/resh.pid ]; then
else
pkill -SIGTERM "resh-daemon" || true
fi
nohup resh-daemon >/dev/null 2>&1 & disown
__resh_run_daemon
# Generating resh-uuid ...
[ -e ~/.resh/resh-uuid ] \
|| cat /proc/sys/kernel/random/uuid > ~/.resh/resh-uuid 2>/dev/null \
|| scripts/uuid.sh > ~/.resh/resh-uuid 2>/dev/null
echo "
##########################################################

@ -4,10 +4,10 @@ __resh_get_uuid() {
}
__resh_get_pid() {
if [ -n "$ZSH_VERSION" ]; then
if [ -n "${ZSH_VERSION-}" ]; then
# assume Zsh
local __RESH_PID="$$" # current pid
elif [ -n "$BASH_VERSION" ]; then
elif [ -n "${BASH_VERSION-}" ]; then
# assume Bash
local __RESH_PID="$BASHPID" # current pid
fi
@ -21,7 +21,7 @@ __resh_get_epochrealtime() {
elif gdate --version >/dev/null && gdate +%s.%N | grep -vq 'N'; then
# GNU date take 2
gdate +%s.%N
elif [ -n "$ZSH_VERSION" ]; then
elif [ -n "${ZSH_VERSION-}" ]; then
# zsh fallback using $EPOCHREALTIME
if [ -z "${__RESH_ZSH_LOADED_DATETIME+x}" ]; then
zmodload zsh/datetime
@ -40,10 +40,10 @@ __resh_get_epochrealtime() {
}
__resh_run_daemon() {
if [ -n "$ZSH_VERSION" ]; then
if [ -n "${ZSH_VERSION-}" ]; then
setopt LOCAL_OPTIONS NO_NOTIFY NO_MONITOR
fi
if [ "$__RESH_MACOS" = 1 ]; then
if [ "$(uname)" = Darwin ]; then
# needs testing
nohup script -q -c 'resh-daemon' ~/.resh/daemon_last_run_out.txt &
else

Loading…
Cancel
Save