Skip to content

Commit

Permalink
Merge pull request pimterry#44 from tardypad/install_config
Browse files Browse the repository at this point in the history
Fix Makefile and don't overwrite config file if already present
  • Loading branch information
pimterry authored Sep 17, 2017
2 parents e44434d + e98fb4c commit 3f4cb64
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
PREFIX ?= /usr/local
BASH_COMPLETION_DIR := $(shell pkg-config --silence-errors --variable=completionsdir bash-completion)
# pkg-config adds a space for some reason, we have to strip it off.
BASH_COMPLETION_DIR := $(strip $(BASH_COMPLETION_DIR))
BASH_COMPLETION_DIR := $(shell pkg-config --silence-errors --variable=completionsdir bash-completion)
USERDIR ?= $(HOME)

# The @ symbols make the output silent.
Expand All @@ -16,21 +14,27 @@ If you have bash completion installed, follow the README \
(https://github.com/pimterry/notes#installing-bash-completion) \
to manually install it.\n\n"; \
fi # Small test for bash completion support

@install -m755 -d $(PREFIX)/bin/
@install -m755 notes $(PREFIX)/bin/
@install -m777 -d $(USERDIR)/.config/notes/
@install -m777 config $(USERDIR)/.config/notes/
@install -d $(PREFIX)/share/man/man1/
@install notes.1 $(PREFIX)/share/man/man1/

@mandb 1>/dev/null 2>&1 || true # Fail silently if we don't have a mandb

@printf "Notes has been installed to $(PREFIX)/bin/notes.\n"

@if [ ! -f $(USERDIR)/.config/notes/config ]; then \
install -m777 -d $(USERDIR)/.config/notes/; \
install -m777 config $(USERDIR)/.config/notes/; \
printf \
"A configuration file has also been created at $(USERDIR)/.config/notes/config, \
which you can edit if you'd like to change the default settings.\n"; \
fi # install default config file if non present

@printf \
"Notes has been installed to $(PREFIX)/bin/notes. \
A configuration file has also been created at $(USERDIR)/.config/notes/config, \
which you can edit if you'd like to change the default settings.\n\n\
Get started now by running 'notes new my-note' \
or you can run 'notes help' for more info.\n"
"\nGet started now by running 'notes new my-note' \
or you can run 'notes help' for more info.\n"; \

uninstall:
rm -f $(PREFIX)/bin/notes
Expand Down

0 comments on commit 3f4cb64

Please sign in to comment.