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 # Final touch
touch ~/.resh_history.json 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 ... # Restarting resh daemon ...
if [ -f ~/.resh/resh.pid ]; then if [ -f ~/.resh/resh.pid ]; then
kill -SIGTERM "$(cat ~/.resh/resh.pid)" || true kill -SIGTERM "$(cat ~/.resh/resh.pid)" || true
@ -135,12 +144,9 @@ if [ -f ~/.resh/resh.pid ]; then
else else
pkill -SIGTERM "resh-daemon" || true pkill -SIGTERM "resh-daemon" || true
fi 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 " echo "
########################################################## ##########################################################

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

Loading…
Cancel
Save