Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add (un)install functionality to Makefile #253

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
# check if the command manpath exists. Use the first path found as the path
# to copy z.1 to.
$(eval MAN_PATH=$(shell command -v manpath >/dev/null 2>&1 && manpath | \
cut -d ':' -f1))

# first we copy the man file to a directory in the manpath
# then we copy the z.sh file to the home directory
# then we add '. ~/z.sh' to the .bashrc file to source z.sh
# we then reload the bashrc file
install:
@cp z.1 $(MAN_PATH)/man1/z.1
@cp z.sh $(HOME)/z.sh
@[ -f $(HOME)/.bashrc ] && echo ". ${HOME}/z.sh" >> $(HOME)/.bashrc
@. $(HOME)/.bashrc
@echo "Installation completed! cd around for a while to build up the db. \
PROFIT!!"

# we only need to remove 2 files. We can't remove lines from the .basrc file
# of people because this could do some really bad stuff
uninstall:
@rm $(MAN_PATH)/man1/z.1
@rm $(HOME)/z.sh
@echo "Don't forgot to remove the '. ~/z.sh' line in your .bashrc file"

readme:
@groff -man -Tascii z.1 | col -bx

.PHONY: readme
.PHONY: readme install uninstall MAN_PATH
7 changes: 7 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
This fork of rupa/z aims to better maintain the project. Please file bug reports etc
here! That way we can make this tool even better then it already is.

CHANGELOG / TODO
- [x] Makefile for installing the files
- [ ] Use the XDG standard ($XDG_CONFIG_HOME)

Z(1) User Commands Z(1)


Expand Down