fix local dev building, minor improvements

pull/58/head
Simon Let 6 years ago
parent b3b9678277
commit 0a7971b2e5
  1. 96
      Makefile
  2. 4
      scripts/rawinstall.sh

@ -1,7 +1,8 @@
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")
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:
#
@ -41,6 +42,9 @@ sanitize:
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
install: build
scripts/install.sh
test_go:
# Running tests
@for dir in {cmd,pkg}/* ; do \
@ -58,98 +62,14 @@ rebuild:
clean:
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:
# Uninstalling ...
-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
$(HOME)/.resh $(HOME)/.resh/bin $(HOME)/.config $(HOME)/.resh/bash_completion.d $(HOME)/.resh/zsh_completion.d:
# 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
.PHONY: ser submodules build install rebuild uninstall clean
submodules: | submodules/bash-preexec/bash-preexec.sh submodules/bash-zsh-compat-widgets/bindfunc.sh

@ -36,7 +36,7 @@ fi
if [ "$(uname -m)" = "x86_64" ]; then
ARCH=amd64
elif [ "$(uname -m)" = "i386" ]; then
elif [ "$(uname -m)" = "x86" ] || [ "$(uname -m)" = "i386" ] || [ "$(uname -m)" = "i686" ]; then
ARCH=386
else
ARCH=unknown
@ -46,6 +46,8 @@ fi
if [ "$OS" = unknown ] || [ "$ARCH" = unknown ]; then
echo "Couldn't detect your OS and architecture - exiting!"
echo "Expected Linux or macOS on x86_64 or i386"
echo "Got OS: $(uname) (uname)"
echo "Got ARCH: $(uname -m) (uname -m)"
exit 1
fi

Loading…
Cancel
Save