Skip to content

Commit

Permalink
Merge pull request #26 from ltratt/reorganise_install
Browse files Browse the repository at this point in the history
Reorganise file layout and install for multiple platforms.
  • Loading branch information
ltratt authored Jan 7, 2024
2 parents 3e5f58d + c79bed0 commit 1af7401
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 33 deletions.
39 changes: 30 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
PREFIX ?= /usr/local
MAN_PREFIX ?= ${PREFIX}/man
BINDIR ?= ${PREFIX}/bin
LIBDIR ?= ${PREFIX}/lib
SHAREDIR ?= ${PREFIX}/share
EXAMPLESDIR ?= ${SHAREDIR}/examples

MANDIR.${PREFIX} = ${PREFIX}/share/man
MANDIR./usr/local = /usr/local/man
MANDIR. = /usr/share/man
MANDIR ?= ${MANDIR.${PREFIX}}

.PHONY: all install test distrib

all: target/release/pizauth

target/release/pizauth:
cargo build --release

PLATFORM=$(shell uname)

install: target/release/pizauth
install -d ${PREFIX}/bin
install -c -m 555 target/release/pizauth ${PREFIX}/bin/pizauth
install -d ${MAN_PREFIX}/man1
install -d ${MAN_PREFIX}/man5
install -c -m 444 pizauth.1 ${MAN_PREFIX}/man1/pizauth.1
install -c -m 444 pizauth.conf.5 ${MAN_PREFIX}/man5/pizauth.conf.5
install -d ${PREFIX}/share/examples/pizauth
install -c -m 444 pizauth.conf.example ${PREFIX}/share/examples/pizauth
install -d ${DESTDIR}${BINDIR}
install -c -m 555 target/release/pizauth ${DESTDIR}${BINDIR}/pizauth
install -d ${DESTDIR}${MANDIR}/man1
install -d ${DESTDIR}${MANDIR}/man5
install -c -m 444 pizauth.1 ${DESTDIR}${MANDIR}/man1/pizauth.1
install -c -m 444 pizauth.conf.5 ${DESTDIR}${MANDIR}/man5/pizauth.conf.5
install -d ${DESTDIR}${EXAMPLESDIR}/pizauth
install -c -m 444 examples/pizauth.conf ${DESTDIR}${EXAMPLESDIR}/pizauth/pizauth.conf
install -d ${DESTDIR}${SHAREDIR}/pizauth/bash
install -c -m 444 share/bash/completion.bash ${DESTDIR}${SHAREDIR}/pizauth/bash/completion.bash
ifeq ($(PLATFORM), Linux)
install -d ${DESTDIR}${LIBDIR}/systemd/user
install -c -m 444 lib/systemd/user/pizauth.service ${DESTDIR}${LIBDIR}/systemd/user/pizauth.service
install -d ${DESTDIR}${EXAMPLESDIR}/pizauth/systemd-dropins
install -c -m 444 examples/systemd-dropins/age.conf ${DESTDIR}${EXAMPLESDIR}/pizauth/systemd-dropins/age.conf
install -c -m 444 examples/systemd-dropins/gpg-dump.conf ${DESTDIR}${EXAMPLESDIR}/pizauth/systemd-dropins/gpg-dump.conf
endif

test:
cargo test
Expand Down
24 changes: 24 additions & 0 deletions README.Linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# pizauth on Linux

Pizauth comes with a systemd unit and example configurations. To start pizauth:

```sh
$ systemctl --user start pizauth.service
```

If you want `pizauth` to start on login, run

```sh
$ systemctl --user enable pizauth.service
```

In `/usr/share/examples/pizauth/systemd-dropins` are templates for saving
pizauth dumps encrypted with `age` and `gpg`. To use them, run

```sh
$ systemctl --user edit pizauth.service
```

and paste whichever of the templates suits you in the file `systemctl` opens.
Make sure to modify the references to private/public keys/IDs in the temalpte
file to point to your keys/IDs.
24 changes: 0 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,30 +126,6 @@ Note that:
becoming invalid and pizauth realising that has happened and notifying you
to request a new token.

### Systemd unit

Pizauth ships with a systemd unit and example configurations.
To start `pizauth`, run

```sh
$ systemctl --user start pizauth.service
```

If you want `pizauth` to start on login, run

```sh
$ systemctl --user enable pizauth.service
```

Finally, in `systemd-dropins/` you'll find templates for saving pizauth dumps
encrypted with `age` and `gpg`. To use them, run

```sh
$ systemctl --user edit pizauth.service
```

and paste whichever of these templates suits you in the file `systemctl` opens.
(Modify the references to private/public keys to actually point to your keys!)

## Command-line interface

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1af7401

Please sign in to comment.