Skip to content

Commit bb7d357

Browse files
authored
Merge pull request #4 from haensl/bug/3
Fix directory and symlink issue on OSX. Add option to overwrite exist…
2 parents 2844561 + 41f9fac commit bb7d357

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.2
2+
* [#3: Fix directory and symlink issue on OSX.](https://github.com/haensl/openssl-certgen/issues/3)
3+
* Add option to overwrite existing version.
4+
15
## 1.1.1
26
* [#1: Only link manpage in makefile if directory exists.](https://github.com/haensl/openssl-certgen/issues/1)
37
* Change installation directories.

Makefile

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
src_dir := $(shell pwd)
2-
bin_dir := /usr/bin
3-
man_dir := /usr/share/man/man1
2+
platform := $(shell uname -o)
43
bin := openssl-generate-certificates
4+
man := $(bin).1.gz
5+
THIS_FILE := $(lastword $(MAKEFILE_LIST))
6+
ifeq ($(platform),Darwin)
7+
bin_dir := /usr/local/bin
8+
man_dir := /usr/local/share/man/man1
9+
else
10+
bin_dir := /usr/bin
11+
man_dir := /usr/share/man/man1
12+
endif
513

6-
install:
14+
check_installed:
15+
@if [ -f $(bin_dir)/$(bin) ]; then echo "Another version of $(bin) is already installed. Execute 'make overwrite' to overwrite existing version." && exit 1 ; fi
16+
17+
install: check_installed
718
@if ! [ -f $(bin_dir)/$(bin) ]; then ln -s $(src_dir)/$(bin) $(bin_dir)/$(bin) ; fi
8-
@if [ -d $(man_dir) ]; && ! [ -f $(man_dir)/$(bin).1.gz ]; then ln -s $(src_dir)/man/$(bin).1.gz $(man_dir)/$(bin).1.gz ; fi
19+
@if [ -d $(man_dir) ] && ! [ -f $(man_dir)/$(man) ]; then ln -s $(src_dir)/man/$(man) $(man_dir)/$(man) ; fi
20+
21+
remove:
22+
@if [ -f $(bin_dir)/$(bin) ]; then rm $(bin_dir)/$(bin) ; fi
23+
@if [ -f $(man_dir)/$(man) ]; then rm $(man_dir)/$(man) ; fi
24+
25+
overwrite: remove
26+
@$(MAKE) -f $(THIS_FILE) install

0 commit comments

Comments
 (0)