diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ddd418..5e55b19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ +- Most stuff (most of `/etc` being a notable exception) now installs to `/usr/local` by default, check [`docs/PACKAGERS.md`](./docs/PACKAGERS.md). - Added a changelog. - Finally add proper (experimental) xorg support. - Systemd service install path changed to `/usr/local/lib/systemd`, there could be a leftover file at `/etc/systemd/system/lidm.service`. diff --git a/Makefile b/Makefile index 0f6460d..57e5d28 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ LDIR=lib IDIR=include ODIR=dist -PREFIX=/usr +PREFIX=/usr/local CC?=gcc CFLAGS?=-O3 -Wall -Wextra -fdata-sections -ffunction-sections @@ -47,7 +47,6 @@ lidm: $(OBJ) clean: rm -f $(ODIR)/*.o lidm -# Copy lidm to ${DESTDIR}${PREFIX}/bin (/usr/bin) install: lidm mkdir -p ${DESTDIR}${PREFIX}/bin ${DESTDIR}${PREFIX}/share/man/man{1,5} install -Dm755 ./lidm ${DESTDIR}${PREFIX}/bin/ @@ -57,8 +56,14 @@ install: lidm uninstall: rm -rf ${DESTDIR}${PREFIX}/bin/lidm ${DESTDIR}/etc/lidm.ini - rm -rf ${DESTDIR}/usr/share/man/man{1/lidm.1,5/lidm-config.5}.gz - rm -rf ${DESTDIR}/usr/local/lib/systemd/system/lidm.service ${DESTDIR}/etc/dinit.d/lidm ${DESTDIR}/etc/runit/sv/lidm + rm -rf ${DESTDIR}${PREFIX}/share/man/man{1/lidm.1,5/lidm-config.5}.gz + rm -rf \ + ${DESTDIR}${PREFIX}/lib/systemd/system/lidm.service \ + ${DESTDIR}/etc/dinit.d/lidm \ + ${DESTDIR}/etc/sv/lidm \ + ${DESTDIR}/etc/runit/sv/lidm \ + ${DESTDIR}/etc/init.d/lidm \ + ${DESTDIR}/etc/s6/sv/lidm install-service: @if command -v systemctl &> /dev/null; then \ @@ -88,13 +93,13 @@ install-service: fi install-service-systemd: - install -Dm644 ./assets/services/systemd.service ${DESTDIR}/usr/local/lib/systemd/system/lidm.service + install -Dm644 ./assets/services/systemd.service ${DESTDIR}${PREFIX}/lib/systemd/system/lidm.service @printf '\033[1m%s\033[0m\n\n' " don't forget to run 'systemctl enable lidm'" install-service-dinit: install -m644 ./assets/services/dinit ${DESTDIR}/etc/dinit.d/lidm @printf '\033[1m%s\033[0m\n\n' " don't forget to run 'dinitctl enable lidm'" install-service-runit: - @if [ ! -e /etc/sv ] && [ -d /etc/runit/sv ] && [ -z "$FORCE" ]; then \ + @if [ ! -e /etc/sv ] && [ -d /etc/runit/sv ] && [ -z "$$FORCE" ]; then \ printf '\033[31m%s\033[0m\n' "/etc/sv doesn't exist but /etc/runit/sv does" >&2; \ printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-runit-etc'" >&2; \ exit 1; \ @@ -103,7 +108,7 @@ install-service-runit: cp -r --update=all ./assets/services/runit/* ${DESTDIR}/etc/sv/lidm/ @printf '\033[1m%s\033[0m\n\n' " don't forget to run 'ln -s ${DESTDIR}/etc/sv/lidm /var/service' or your distro equivalent" install-service-runit-etc: - @if [ ! -e /etc/runit/sv ] && [ -d /etc/sv ] && [ -z "$FORCE" ]; then \ + @if [ ! -e /etc/runit/sv ] && [ -d /etc/sv ] && [ -z "$$FORCE" ]; then \ printf '\033[31m%s\033[0m\n' "/etc/runit/sv doesn't exist but /etc/sv does" >&2; \ printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-runit'" >&2; \ exit 1; \ @@ -115,7 +120,7 @@ install-service-openrc: install -m755 ./assets/services/openrc ${DESTDIR}/etc/init.d/lidm @printf '\033[1m%s\033[0m\n\n' " don't forget to run 'rc-update add lidm'" install-service-s6: - @if [ ! -e /etc/sv ] && [ -d /etc/s6/sv ] && [ -z "$FORCE" ]; then \ + @if [ ! -e /etc/sv ] && [ -d /etc/s6/sv ] && [ -z "$$FORCE" ]; then \ printf '\033[31m%s\033[0m\n' "/etc/sv doesn't exist but /etc/s6/sv does" >&2; \ printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-s6-etc'" >&2; \ exit 1; \ @@ -124,7 +129,7 @@ install-service-s6: cp -r --update=all ./assets/services/s6/* ${DESTDIR}/etc/sv/lidm/ @printf '\033[1m%s\033[0m\n\n' " don't forget to run 's6-service add default lidm' and 's6-db-reload'" install-service-s6-etc: - @if [ ! -e /etc/s6/sv ] && [ -d /etc/sv ] && [ -z "$FORCE" ]; then \ + @if [ ! -e /etc/s6/sv ] && [ -d /etc/sv ] && [ -z "$$FORCE" ]; then \ printf '\033[31m%s\033[0m\n' "/etc/s6/sv doesn't exist but /etc/sv does" >&2; \ printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-s6'" >&2; \ exit 1; \ diff --git a/assets/services/README.md b/assets/services/README.md index 561eb0d..c1fc78d 100644 --- a/assets/services/README.md +++ b/assets/services/README.md @@ -13,7 +13,7 @@ The manual steps for installation are: ## Systemd -- Copy `systemd.service` to `/usr/local/lib/systemd/system/lidm.service` (if the directory doesn't exist, create it first) +- Copy `systemd.service` to `/usr/local/lib/systemd/system/lidm.service` (if the directory doesn't exist, create it first) or `/usr/lib/systemd/system/lidm.service` (if you wish to install along your system files). - To enable it you can run `systemctl enable lidm` ## Dinit @@ -23,8 +23,10 @@ The manual steps for installation are: ## Runit -- Copy `runit/` to `/etc/runit/sv/lidm/` -- Add the service with `ln -s /etc/runit/sv/lidm /run/runit/service` +Your runit service path can be either `/etc/runit/sv` or `/etc/sv`. + +- Copy `runit/` to `runit-path/lidm/` +- Add the service with `ln -s runit-path/lidm /run/runit/service` - And to enable it `sv enable lidm` ## OpenRC @@ -34,7 +36,9 @@ The manual steps for installation are: ## S6 -- Copy `s6/` to `/etc/s6/sv/lidm/` +Your S6 service path can be either `/etc/s6/sv` or `/etc/sv`. + +- Copy `s6/` to `s6-path/lidm/` - Add the service with `s6-service add default lidm` - Reload the database with `s6-db-reload` (you might have to run this every time the service file changes) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index c88ab7b..f3c1665 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -131,6 +131,8 @@ Then you can install the files onto your filesystem with: make install ``` +This will install mostly into `/usr/local` by default, this path is mostly unused nowadays and could feel like lidm didn't install at all. You can add `PREFIX=/usr` to install along the rest of your system packages if you wish. + And additionally, to install service files (start-up behavior). [more docs](../assets/services/README.md) ```sh diff --git a/docs/PACKAGERS.md b/docs/PACKAGERS.md index 758d3f6..0269458 100644 --- a/docs/PACKAGERS.md +++ b/docs/PACKAGERS.md @@ -53,7 +53,9 @@ But this can be changed by just passing those env variables, for example, in the ## Target Directory -`DESTDIR` can be used to for installation recipes to install on alternative root directories. Along with `PREFIX` (defaults to `/usr`) for systems which don't use the common `/usr` structure. e.g. `make install DESTDIR=$out PREFIX=` +`DESTDIR` can be used to for installation recipes to install on alternative root directories. Along with `PREFIX` (defaults to `/usr/local`, packaging this you'll probably want to make it `/usr`) for systems which don't use the common `/usr` structure. e.g. `make install DESTDIR=$out PREFIX=` + +`/etc` is sometimes in that `PREFIX` and sometimes not, be careful. ```txt $ fd -t f . --base-directory $out @@ -69,7 +71,7 @@ To ease most of the installation process there's several `make` recipes to insta - `make` / `make lidm`: Builds the app binary. - `make install`: Attempts to install the binary, place a default config file in `/etc/lidm.ini` and install the man pages. -- `make install-service-(systemd|dinit|runit|openrc|s6)(|-etc)`: Just check the source, service files for different init systems and `-etc` variants for alternative paths. +- `make install-service-(systemd|dinit|runit|openrc|s6)(|-etc)`: Just check the source, service files for different init systems and `-etc` variants for alternative paths. You might need `FORCE=1` in the environment if you are packaging for other init system or scripting. - `make print-version`: Outputs the current version in the `Makefile` for scripts that might want to extract that info. You can choose to use these packages or create your own service files / etc. There's are merely suggestions on what to use.