|
|
|
@ -1,7 +1,8 @@ |
|
|
|
SHELL=/bin/bash
|
|
|
|
SHELL=/bin/bash
|
|
|
|
VERSION=$(shell cat VERSION)
|
|
|
|
LATEST_TAG=$(shell git describe --tags)
|
|
|
|
REVISION=$(shell [ -z "$(git status --untracked-files=no --porcelain)" ] && git rev-parse --short=12 HEAD || echo "no_revision")
|
|
|
|
REVISION=$(shell [ -z "$(git status --untracked-files=no --porcelain)" ] && git rev-parse --short=12 HEAD || echo "no_revision")
|
|
|
|
GOFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Revision=${REVISION}"
|
|
|
|
VERSION=${LATEST_TAG}-dev-${REVISION}
|
|
|
|
|
|
|
|
GOFLAGS=-ldflags "-X main.version=${VERSION} -X main.commit=${REVISION}"
|
|
|
|
|
|
|
|
|
|
|
|
sanitize: |
|
|
|
sanitize: |
|
|
|
#
|
|
|
|
#
|
|
|
|
@ -41,6 +42,9 @@ sanitize: |
|
|
|
build: submodules bin/resh-session-init bin/resh-collect bin/resh-postcollect bin/resh-daemon\
|
|
|
|
build: submodules bin/resh-session-init bin/resh-collect bin/resh-postcollect bin/resh-daemon\
|
|
|
|
bin/resh-evaluate bin/resh-sanitize bin/resh-control bin/resh-config bin/resh-inspect
|
|
|
|
bin/resh-evaluate bin/resh-sanitize bin/resh-control bin/resh-config bin/resh-inspect
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
install: build |
|
|
|
|
|
|
|
scripts/install.sh
|
|
|
|
|
|
|
|
|
|
|
|
test_go: |
|
|
|
test_go: |
|
|
|
# Running tests
|
|
|
|
# Running tests
|
|
|
|
@for dir in {cmd,pkg}/* ; do \
|
|
|
|
@for dir in {cmd,pkg}/* ; do \
|
|
|
|
@ -58,98 +62,14 @@ rebuild: |
|
|
|
clean: |
|
|
|
clean: |
|
|
|
rm bin/resh-*
|
|
|
|
rm bin/resh-*
|
|
|
|
|
|
|
|
|
|
|
|
install: build submodules/bash-preexec/bash-preexec.sh scripts/shellrc.sh conf/config.toml scripts/uuid.sh \
|
|
|
|
|
|
|
|
| $(HOME)/.resh $(HOME)/.resh/bin $(HOME)/.config $(HOME)/.resh/bash_completion.d $(HOME)/.resh/zsh_completion.d
|
|
|
|
|
|
|
|
# Copying files ...
|
|
|
|
|
|
|
|
@cp -f submodules/bash-preexec/bash-preexec.sh ~/.bash-preexec.sh
|
|
|
|
|
|
|
|
@cp -f submodules/bash-zsh-compat-widgets/bindfunc.sh ~/.resh/bindfunc.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cp -f conf/config.toml ~/.config/resh.toml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cp -f scripts/shellrc.sh ~/.resh/shellrc
|
|
|
|
|
|
|
|
@cp -f scripts/reshctl.sh scripts/widgets.sh scripts/hooks.sh scripts/util.sh ~/.resh/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Generating completions for reshctl ...
|
|
|
|
|
|
|
|
@bin/resh-control completion bash > ~/.resh/bash_completion.d/_reshctl
|
|
|
|
|
|
|
|
@bin/resh-control completion zsh > ~/.resh/zsh_completion.d/_reshctl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Copying more files ...
|
|
|
|
|
|
|
|
@cp -f scripts/uuid.sh ~/.resh/bin/resh-uuid
|
|
|
|
|
|
|
|
@cp -f bin/* ~/.resh/bin/
|
|
|
|
|
|
|
|
@cp -f scripts/resh-evaluate-plot.py ~/.resh/bin/
|
|
|
|
|
|
|
|
@cp -fr data/sanitizer ~/.resh/sanitizer_data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@# backward compatibility: We have a new location for resh history file
|
|
|
|
|
|
|
|
@[ ! -f ~/.resh/history.json ] || mv ~/.resh/history.json ~/.resh_history.json
|
|
|
|
|
|
|
|
# Adding resh shellrc to .bashrc ...
|
|
|
|
|
|
|
|
@grep -q '[[ -f ~/.resh/shellrc ]] && source ~/.resh/shellrc' ~/.bashrc ||\
|
|
|
|
|
|
|
|
echo -e '\n[[ -f ~/.resh/shellrc ]] && source ~/.resh/shellrc' >> ~/.bashrc
|
|
|
|
|
|
|
|
# Adding bash-preexec to .bashrc ...
|
|
|
|
|
|
|
|
@grep -q '[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' ~/.bashrc ||\
|
|
|
|
|
|
|
|
echo -e '\n[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' >> ~/.bashrc
|
|
|
|
|
|
|
|
# Adding resh shellrc to .zshrc ...
|
|
|
|
|
|
|
|
@grep -q '[ -f ~/.resh/shellrc ] && source ~/.resh/shellrc' ~/.zshrc ||\
|
|
|
|
|
|
|
|
echo -e '\n[ -f ~/.resh/shellrc ] && source ~/.resh/shellrc' >> ~/.zshrc
|
|
|
|
|
|
|
|
@# Deleting zsh completion cache - for future use
|
|
|
|
|
|
|
|
@# [ ! -e ~/.zcompdump ] || rm ~/.zcompdump
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@# Final touch
|
|
|
|
|
|
|
|
@touch ~/.resh_history.json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Restarting resh daemon ...
|
|
|
|
|
|
|
|
@-if [ -f ~/.resh/resh.pid ]; then\
|
|
|
|
|
|
|
|
kill -SIGTERM $$(cat ~/.resh/resh.pid);\
|
|
|
|
|
|
|
|
rm ~/.resh/resh.pid;\
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
@nohup resh-daemon &>/dev/null & disown
|
|
|
|
|
|
|
|
@# Generating resh-uuid ...
|
|
|
|
|
|
|
|
@[ -e "$(HOME)/.resh/resh-uuid" ] \
|
|
|
|
|
|
|
|
|| cat /proc/sys/kernel/random/uuid > "$(HOME)/.resh/resh-uuid" 2>/dev/null \
|
|
|
|
|
|
|
|
|| ./uuid.sh > "$(HOME)/.resh/resh-uuid" 2>/dev/null
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
##########################################################
|
|
|
|
|
|
|
|
# #
|
|
|
|
|
|
|
|
# SUCCESS - thank you for trying out this project! #
|
|
|
|
|
|
|
|
# #
|
|
|
|
|
|
|
|
##########################################################
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# WHAT'S NEXT
|
|
|
|
|
|
|
|
# It's recommended to RESTART ALL OPEN TERMINAL WINDOWS (or reload your rc files)
|
|
|
|
|
|
|
|
# Your resh history is located in `~/.resh_history.json`
|
|
|
|
|
|
|
|
# You can look at it using e.g. `tail -f ~/.resh_history.json | jq`
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# ISSUES
|
|
|
|
|
|
|
|
# If anything looks broken create an issue: https://github.com/curusarn/resh/issues
|
|
|
|
|
|
|
|
# You can uninstall this at any time by running `rm -rf ~/.resh/`
|
|
|
|
|
|
|
|
# You won't lose any collected history by removing `~/.resh/` directory
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# Please give me some contact info using this form: https://forms.gle/227SoyJ5c2iteKt98
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uninstall: |
|
|
|
uninstall: |
|
|
|
# Uninstalling ...
|
|
|
|
# Uninstalling ...
|
|
|
|
-rm -rf ~/.resh/
|
|
|
|
-rm -rf ~/.resh/
|
|
|
|
|
|
|
|
|
|
|
|
bin/resh-%: cmd/%/*.go pkg/*/*.go VERSION cmd/control/cmd/*.go cmd/control/status/status.go |
|
|
|
bin/resh-%: cmd/%/*.go pkg/*/*.go cmd/control/cmd/*.go cmd/control/status/status.go |
|
|
|
go build ${GOFLAGS} -o $@ cmd/$*/*.go
|
|
|
|
go build ${GOFLAGS} -o $@ cmd/$*/*.go
|
|
|
|
|
|
|
|
|
|
|
|
$(HOME)/.resh $(HOME)/.resh/bin $(HOME)/.config $(HOME)/.resh/bash_completion.d $(HOME)/.resh/zsh_completion.d: |
|
|
|
.PHONY: ser submodules build install rebuild uninstall clean |
|
|
|
# Creating dirs ...
|
|
|
|
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(HOME)/.resh/resh-uuid: |
|
|
|
|
|
|
|
# Generating random uuid for this device ...
|
|
|
|
|
|
|
|
cat /proc/sys/kernel/random/uuid > $@ 2>/dev/null || ./uuid.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: submodules build install rebuild uninstall clean autoinstall |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
submodules: | submodules/bash-preexec/bash-preexec.sh submodules/bash-zsh-compat-widgets/bindfunc.sh |
|
|
|
submodules: | submodules/bash-preexec/bash-preexec.sh submodules/bash-zsh-compat-widgets/bindfunc.sh |
|
|
|
|