opendoas

A portable version of the OpenBSD `doas` command
git clone https://pi.duncano.de/git/opendoas.git
Log | Files | Refs | README | LICENSE

commit 09843fcf8876df1ab1728e9c2c49de4836b25626
parent c387f2c31718d4f34c77203dae6bb8c4bc0abc94
Author: Duncaen <mail@duncano.de>
Date:   Sun,  8 May 2016 20:01:25 +0200

Simply install and move version to configure script

Diffstat:
Makefile | 2--
bsd.prog.mk | 36+++++++++++-------------------------
configure | 3+++
doas.c | 1-
4 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile @@ -14,5 +14,3 @@ COPTS+= -Wall -Wextra -Werror -pedantic -std=c11 LDFLAGS+= -lpam include bsd.prog.mk - -doas.o: version.h diff --git a/bsd.prog.mk b/bsd.prog.mk @@ -16,31 +16,17 @@ OBJS:=${OBJS:.c=.o} ${PROG}: ${OBJS} libopenbsd.a ${CC} ${CFLAGS} ${LDFLAGS} $^ -o $@ -.%.chmod: % - cp $< $@ - chown ${BINOWN}:${BINGRP} $@ - chmod ${BINMODE} $@ - -${DESTDIR}${BINDIR} ${DESTDIR}${PAMDIR}: - mkdir -pm 0755 $@ - -${DESTDIR}${BINDIR}/${PROG}: .${PROG}.chmod ${BINDIR} - mv $< $@ - -${DESTDIR}${PAMDIR}/doas: ${PAM_DOAS} - cp $< $@ - -VERSION:=\#define VERSION "$(shell git describe --dirty --tags --long --always)" -OLDVERSION:=$(shell [ -f version.h ] && cat version.h) -version.h: ; @echo '$(VERSION)' > $@ -ifneq ($(VERSION),$(OLDVERSION)) -.PHONY: version.h -endif - -MAN:=$(join $(addprefix ${DESTDIR}${MANDIR}/man,$(patsubst .%,%/,$(suffix ${MAN}))),${MAN}) -$(foreach M,${MAN},$(eval $M: $(notdir $M); cp $$< $$@)) - -install: ${DESTDIR}${BINDIR}/${PROG} ${DESTDIR}${PAMDIR}/doas ${MAN} +install: ${PROG} ${PAM_DOAS} + mkdir -p -m 0755 ${DESTDIR}${BINDIR} + mkdir -p -m 0755 ${DESTDIR}${PAMDIR} + mkdir -p -m 0755 ${DESTDIR}${MANDIR}/man{1,5} + cp -f ${PROG} ${DESTDIR}${BINDIR} + chown ${BINOWN}:${BINGRP} ${DESTDIR}${BINDIR}/${PROG} + chmod ${BINMODE} ${DESTDIR}${BINDIR}/${PROG} + cp ${PAM_DOAS} ${DESTDIR}${PAMDIR}/doas + chmod 0644 ${DESTDIR}${PAMDIR}/doas + cp -f doas.1 ${DESTDIR}${MANDIR}/man1 + cp -f doas.conf.5 ${DESTDIR}${MANDIR}/man5 clean: rm -f version.h diff --git a/configure b/configure @@ -55,6 +55,8 @@ done CONFIG_MK=config.mk rm -f "$CONFIG_MK" +: ${VERSION:="$(git describe --dirty --tags --long --always)"} + cat <<EOF >>$CONFIG_MK DESTDIR ?= / PREFIX ?= ${PREFIX:="/usr"} @@ -64,6 +66,7 @@ SHAREDIR ?= ${SHAREDIR:="${PREFIX}/share"} MANDIR ?= ${MANDIR:="${SHAREDIR}/man"} SYSCONFDIR?= ${SYSCONFDIR:="/etc"} PAMDIR ?= ${PAMDIR:="${SYSCONFDIR}/pam.d"} +CFLAGS += -DVERSION="\"${VERSION}\"" EOF if [ -z "$BUILD" ]; then diff --git a/doas.c b/doas.c @@ -32,7 +32,6 @@ #include "includes.h" #include "doas.h" -#include "version.h" static void __dead version(void)