Skip to content

Commit 4ec4ebf

Browse files
committed
Added Makefile to make compatible with bpkg.io
1 parent 2073ed4 commit 4ec4ebf

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
PREFIX ?= /usr/local
2+
BASH_COMPLETION_DIR := $(shell pkg-config --variable=completionsdir bash-completion)
3+
# pkg-config adds a space for some reason, we have to strip it off.
4+
BASH_COMPLETION_DIR := $(strip BASH_COMPLETION_DIR)
5+
USERDIR ?= $(HOME)
6+
7+
install:
8+
@if [ -d $(BASH_COMPLETION_DIR) ]; then \
9+
echo $(BASH_COMPLETION_DIR);\
10+
cp notes.bash_completion "$(BASH_COMPLETION_DIR)/notes";\
11+
fi # Small test for bash completion support
12+
install -m755 -D notes $(PREFIX)/bin/notes
13+
install -m777 -D config.example $(USERDIR)/.config/notes/config.example
14+
install -D notes.1 $(PREFIX)/share/man/man1/notes.1
15+
mandb 1>/dev/null
16+
unintstall:
17+
rm -f $(PREFIX)/bin/notes
18+
rm -f $(PREFIX)/share/man/man1/notes.1
19+
rm -f $(BASH_COMPLETION_DIR)/notes
20+
rm -f $(USERDIR)/.config/notes/config.example

install.sh

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ echo "Checking for root..."
1717

1818
# Make sure we have everything actually installed that we need to install this.
1919
echo "Checking for Dependencies..."
20-
assertInstalled bash curl tar mktemp
20+
assertInstalled bash curl tar mktemp install make
2121

2222
# Variable Definitions go here.
2323
user_home=`eval echo ~$SUDO_USER`
@@ -26,22 +26,8 @@ extract_dir=$(mktemp -d /tmp/notes.XXXXX)
2626

2727
echo "Downloading and Extracting Notes from Repository..."
2828
curl -L https://api.github.com/repos/pimterry/notes/tarball | tar -xzp -C $extract_dir --strip-components=1
29-
30-
echo "Moving Files into Place..."
31-
mv $extract_dir/notes /usr/local/bin/notes
32-
# Make it runnable
33-
# Do we have bash completion abilities?
34-
if [ -d $bash_completion_dir ]; then
35-
mv $extract_dir/notes.bash_completion $bash_completion_dir/notes
36-
fi
37-
mkdir -p $user_home/.config/notes/
38-
mv $extract_dir/config.example $user_home/.config/notes/config.example
39-
mv $extract_dir/notes.1 /usr/local/share/man/man1/notes.1
40-
echo "Fixing Permissions..."
41-
chown -R $SUDO_USER $user_home/.config/notes
42-
chmod a+x /usr/local/bin/notes
43-
echo "Installing Man page..."
44-
mandb
29+
echo "Installing notes..."
30+
cd $extract_dir && make USER_DIR=$user_home
4531
echo "Cleaning Up..."
4632
rm -rf $extract_dir
4733
echo "All done."

0 commit comments

Comments
 (0)