From d841b64c7b2b7c3c2416406e17ca468063e08f59 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 12 Aug 2021 10:39:06 +0200 Subject: [PATCH 1/3] Add build/install logic for prun manpages --- .gitignore | 1 + Makefile | 16 +++++++++++----- install.sh | 4 ++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 2f683ef..41c83a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ setuid/setuid +prun/*.1 diff --git a/Makefile b/Makefile index 9810ebc..481b18e 100644 --- a/Makefile +++ b/Makefile @@ -64,13 +64,18 @@ INSTALL=install -v INSTALL_PROGRAM = $(INSTALL) INSTALL_DATA = $(INSTALL) -m 644 -all: - @echo 'Nothing to be done. Ready for "make install"' +manpages += prun/prun.1 prun/pman.1 prun/ptype.1 -install: +all: $(manpages) + +clean: + @rm $(manpages) + +install: all @prefix="$(prefix)" usr_prefix="$(usr_prefix)" usrlocal_prefix="$(usrlocal_prefix)" \ root_exec_prefix="$(root_exec_prefix)" root_bindir="$(root_bindir)" root_sbindir="$(root_sbindir)" \ usr_exec_prefix="$(usr_exec_prefix)" usr_bindir="$(usr_bindir)" usr_sbindir="$(usr_sbindir)" \ + usr_mandir="$(usr_mandir)" \ usrlocal_exec_prefix="$(usrlocal_exec_prefix)" usrlocal_bindir="$(usrlocal_bindir)" usrlocal_sbindir="$(usrlocal_sbindir)" \ sysconfdir="$(sysconfdir)" systemdunitdir="$(systemdunitdir)" \ udev_rulesdir="$(udev_rulesdir)" udev_helperdir="$(udev_helperdir)" \ @@ -79,6 +84,7 @@ install: DESTDIR="$(DESTDIR)" \ ./install.sh -.PHONY: all install - +.PHONY: all install clean +%.1: %.md + pandoc --standalone --to man $< -o $@ diff --git a/install.sh b/install.sh index 4668108..385614b 100755 --- a/install.sh +++ b/install.sh @@ -21,6 +21,7 @@ fi : ${usr_exec_prefix:=$usr_prefix} : ${usr_bindir:=$usr_exec_prefix/bin} : ${usr_sbindir:=$usr_exec_prefix/sbin} +: ${usr_mandir:=$usr_exec_prefix/man} : ${usrlocal_exec_prefix:=$usrlocal_prefix} : ${usrlocal_bindir:=$usrlocal_exec_prefix/bin} @@ -223,6 +224,9 @@ install_data mxshadow/mxshadow.conf "$DESTDIR$sysconfdir/m install_data mxshadow/mxshadow.service "$DESTDIR$systemdunitdir/mxshadow.service" install_data misc_etc_files/nsswitch.conf "$DESTDIR$sysconfdir/nsswitch.conf" install_exec vmcontrol/vmcontrol.pl "$DESTDIR$usr_bindir/vmcontrol.pl" +install_data prun/prun.1 "$DESTDIR$usr_mandir/man1/prun.1" +install_data prun/ptype.1 "$DESTDIR$usr_mandir/man1/ptype.1" +install_data prun/pman.1 "$DESTDIR$usr_mandir/man1/pman.1" postinstall exit From fad0b5454a6d4788d9133a348e7039197b22316b Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 12 Aug 2021 12:11:38 +0200 Subject: [PATCH 2/3] Makefile: Shut up "make clean" Use `-f` flag of `rm` to avoid error messages from `make clean` when the targets files don't exist. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 481b18e..164c794 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ manpages += prun/prun.1 prun/pman.1 prun/ptype.1 all: $(manpages) clean: - @rm $(manpages) + @rm -f $(manpages) install: all @prefix="$(prefix)" usr_prefix="$(usr_prefix)" usrlocal_prefix="$(usrlocal_prefix)" \ From d7d563834ade87882828968acde738307ef06f5a Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 12 Aug 2021 12:14:04 +0200 Subject: [PATCH 3/3] Makefile: Avoid running "pandoc" as root --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 164c794..e984744 100644 --- a/Makefile +++ b/Makefile @@ -87,4 +87,5 @@ install: all .PHONY: all install clean %.1: %.md + @if [ "$$UID" = 0 ]; then echo "Please build (\`make\`) as non-root before running \`make install\` as root" >&2;exit 1;fi pandoc --standalone --to man $< -o $@