Skip to content

Commit 17a3cee

Browse files
committed
illumos: Let's CTF!
1 parent fe5dd67 commit 17a3cee

File tree

2 files changed

+46
-19
lines changed

2 files changed

+46
-19
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/.ccls-cache
2020
/.openssh.*
2121
/.libressl.*
22+
/.ctfconvert*
2223
illumos/*.xml
2324
illumos/fs-pivy
2425
illumos/svc-pivy-agent

Makefile

+45-19
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ bingroup ?= wheel
3232

3333
VERSION = 0.10.0
3434

35+
INSTALL ?= install
36+
INSTALLBIN ?= $(INSTALL) -o $(binowner) -g $(bingroup) -m 0755
37+
3538
SECURITY_CFLAGS = \
3639
-fstack-protector-all -fwrapv -fPIC \
3740
-D_FORTIFY_SOURCE=2 -Wall -g -O2 -gdwarf-2
@@ -186,6 +189,7 @@ ifeq ($(SYSTEM), SunOS)
186189
endif
187190

188191
CTFCONVERT ?= ctfconvert
192+
CTFOPTS ?= -k
189193
CTFCONV_HELP = $(shell $(CTFCONVERT) -h 2>&1 | fgrep -- -o | fgrep "add CTF")
190194
ifneq (,$(CTFCONV_HELP))
191195
HAVE_CTF := yes
@@ -392,10 +396,14 @@ pivy-ca: $(PIVYCA_OBJS) $(LIBSSH) $(LIBCRYPTO)
392396
all: pivy-ca
393397

394398
install_pivyca: pivy-ca install_common
395-
install -o $(binowner) -g $(bingroup) -m 0755 pivy-ca $(DESTDIR)$(bindir)
399+
$(INSTALLBIN) pivy-ca $(DESTDIR)$(bindir)
396400
install: install_pivyca
397401
.PHONY: install_pivyca
398402

403+
.ctfconvert.ca: pivy-ca
404+
$(CTFCONVERT) $(CTFOPTS) pivy-ca && touch $@
405+
.ctfconvert: .ctfconvert.ca
406+
399407
endif
400408

401409
PIVYBOX_SOURCES= \
@@ -476,10 +484,14 @@ pivy-zfs: $(PIVZFS_OBJS) $(LIBSSH) $(LIBCRYPTO)
476484
all: pivy-zfs
477485

478486
install_pivyzfs: pivy-zfs install_common
479-
install -o $(binowner) -g $(bingroup) -m 0755 pivy-zfs $(DESTDIR)$(bindir)
487+
$(INSTALLBIN) pivy-zfs $(DESTDIR)$(bindir)
480488
install: install_pivyzfs
481489
.PHONY: install_pivyzfs
482490

491+
.ctfconvert.zfs: pivy-zfs
492+
$(CTFCONVERT) $(CTFOPTS) pivy-zfs && touch $@
493+
.ctfconvert: .ctfconvert.zfs
494+
483495
endif
484496

485497
PIVYLUKS_SOURCES= \
@@ -526,7 +538,7 @@ pivy-luks: $(PIVYLUKS_OBJS) $(LIBSSH) $(LIBCRYPTO)
526538
all: pivy-luks
527539

528540
install_pivyluks: pivy-luks install_common
529-
install -o $(binowner) -g $(bingroup) -m 0755 pivy-luks $(DESTDIR)$(bindir)
541+
$(INSTALLBIN) pivy-luks $(DESTDIR)$(bindir)
530542
install: install_pivyluks
531543
.PHONY: install_pivyluks
532544

@@ -571,8 +583,8 @@ pam_pivy.so: $(PAMPIVY_OBJS) $(LIBSSH) $(LIBCRYPTO)
571583
all: pam_pivy.so
572584

573585
install_pampivy: pam_pivy.so install_common
574-
install -o $(binowner) -g $(bingroup) -m 0755 -d $(DESTDIR)$(PAM_PLUGINDIR)
575-
install -o $(binowner) -g $(bingroup) -m 0755 pam_pivy.so $(DESTDIR)$(PAM_PLUGINDIR)
586+
$(INSTALLBIN) -d $(DESTDIR)$(PAM_PLUGINDIR)
587+
$(INSTALLBIN) pam_pivy.so $(DESTDIR)$(PAM_PLUGINDIR)
576588
install: install_pampivy
577589
.PHONY: install_pampivy
578590

@@ -704,17 +716,17 @@ endif
704716

705717

706718
install_common: pivy-tool pivy-agent pivy-box
707-
install -o $(binowner) -g $(bingroup) -m 0755 -d $(DESTDIR)$(bindir)
708-
install -o $(binowner) -g $(bingroup) -m 0755 pivy-agent $(DESTDIR)$(bindir)
709-
install -o $(binowner) -g $(bingroup) -m 0755 pivy-tool $(DESTDIR)$(bindir)
710-
install -o $(binowner) -g $(bingroup) -m 0755 pivy-box $(DESTDIR)$(bindir)
719+
$(INSTALLBIN) -d $(DESTDIR)$(bindir)
720+
$(INSTALLBIN) pivy-agent $(DESTDIR)$(bindir)
721+
$(INSTALLBIN) pivy-tool $(DESTDIR)$(bindir)
722+
$(INSTALLBIN) pivy-box $(DESTDIR)$(bindir)
711723

712724
ifeq ($(SYSTEM), Darwin)
713725
install: install_common
714-
install -o $(binowner) -g $(bingroup) -m 0755 -d $(DESTDIR)/etc/paths.d
726+
$(INSTALLBIN) -d $(DESTDIR)/etc/paths.d
715727
echo "$(bindir)" > $(DESTDIR)/etc/paths.d/pivy
716-
install -o $(binowner) -g $(bingroup) -m 0755 -d $(DESTDIR)$(prefix)/share
717-
install -o $(binowner) -g $(bingroup) -m 0644 macosx/net.cooperi.pivy-agent.plist \
728+
$(INSTALLBIN) -d $(DESTDIR)$(prefix)/share
729+
$(INSTALL) -o $(binowner) -g $(bingroup) -m 0644 macosx/net.cooperi.pivy-agent.plist \
718730
$(DESTDIR)$(prefix)/share
719731

720732
.PHONY: package
@@ -789,6 +801,20 @@ ifeq ($(SYSTEM), OpenBSD)
789801
install: install_common
790802
endif
791803

804+
ifeq ($(HAVE_CTF), yes)
805+
install: .ctfconvert
806+
807+
.ctfconvert: .ctfconvert.base
808+
touch $@
809+
810+
.ctfconvert.base: pivy-tool pivy-agent pivy-box
811+
$(CTFCONVERT) $(CTFOPTS) pivy-tool && \
812+
$(CTFCONVERT) $(CTFOPTS) pivy-agent && \
813+
$(CTFCONVERT) $(CTFOPTS) pivy-box && \
814+
touch $@
815+
816+
endif
817+
792818
ifeq ($(SYSTEM), SunOS)
793819
_SMF_BITS= fs-pivy \
794820
svc-pivy-agent \
@@ -801,11 +827,11 @@ illumos/%: illumos/%.in
801827
all: $(SMF_BITS)
802828

803829
install: install_common $(SMF_BITS)
804-
install -o $(binowner) -g $(bingroup) -m 0755 -d $(DESTDIR)$(SMF_METHODS)
805-
install -o $(binowner) -g $(bingroup) -m 0755 -d $(DESTDIR)$(SMF_MANIFESTS)
806-
install -o $(binowner) -g $(bingroup) -m 0755 -d $(DESTDIR)$(SMF_MANIFESTS)/system
807-
install -o $(binowner) -g $(bingroup) -m 0444 illumos/pivy-agent.xml $(DESTDIR)$(SMF_MANIFESTS)/system
808-
install -o $(binowner) -g $(bingroup) -m 0444 illumos/pivy-fs.xml $(DESTDIR)$(SMF_MANIFESTS)/system
809-
install -o $(binowner) -g $(bingroup) -m 0444 illumos/fs-pivy $(DESTDIR)$(SMF_METHODS)
810-
install -o $(binowner) -g $(bingroup) -m 0444 illumos/svc-pivy-agent $(DESTDIR)$(SMF_METHODS)
830+
$(INSTALLBIN) -d $(DESTDIR)$(SMF_METHODS)
831+
$(INSTALLBIN) -d $(DESTDIR)$(SMF_MANIFESTS)
832+
$(INSTALLBIN) -d $(DESTDIR)$(SMF_MANIFESTS)/system
833+
$(INSTALLBIN) -m 0444 illumos/pivy-agent.xml $(DESTDIR)$(SMF_MANIFESTS)/system
834+
$(INSTALLBIN) -m 0444 illumos/pivy-fs.xml $(DESTDIR)$(SMF_MANIFESTS)/system
835+
$(INSTALLBIN) illumos/fs-pivy $(DESTDIR)$(SMF_METHODS)
836+
$(INSTALLBIN) illumos/svc-pivy-agent $(DESTDIR)$(SMF_METHODS)
811837
endif

0 commit comments

Comments
 (0)