Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganise file layout and install for multiple platforms. #26

Merged
merged 3 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Til this is a BSDism -- both the separation of -d away from the installation of files, and the use of -c make little sense under linux, where -D (combining install -d $dir and install $file $dir) exists and -c is ignored.
https://man.archlinux.org/man/install.1
https://man.freebsd.org/cgi/man.cgi?query=install&sektion=1

Nothing to change, just a TIL

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.