fixes: improve login environment handling (#114)

* chore(organization): allow nested header and c files

* feat: add shell login "middleware" & etc:
  * lidm now calls `bash` (or other shells, depends on PACKAGE cfg) in
  login mode as a session wrapper to source most env (can be disabled)
  * this fixes a lot of env problems with all `/etc/profile` and more

Extra:
* implemented a musl compatible version of `execvpe` and now lidm should
  search for PATH everywhere it needs to
* `search_path` now also checks if the found binary is properly
  executable
* lidm now uses `confstr` for a decent PATH default if none is found
* logs are unbuffered for cases where debug logs appear empty (exit
  without handlers moment)

* chore: one-time evaluate certain makefile vars

---------

Co-authored-by: grialion <48643945+grialion@users.noreply.github.com>
This commit is contained in:
2026-02-07 17:12:03 +01:00
committed by GitHub
parent c009c6c31c
commit 0b2d0bdf03
34 changed files with 555 additions and 424 deletions

View File

@@ -1,4 +1,4 @@
VERSION = 2.0.0
VERSION := 2.0.0
.DEFAULT_GOAL := lidm
CDIR = src
@@ -9,7 +9,9 @@ ODIR = dist
PREFIX = /usr/local
INFO_GIT_REV ?= $(shell git describe --long --tags --always || echo '?')
INFO_GIT_REV := $(INFO_GIT_REV)
INFO_BUILD_TS ?= $(shell date +%s)
INFO_BUILD_TS := $(INFO_BUILD_TS)
CFLAGS ?= -O3 -Wall -Wextra -fdata-sections -ffunction-sections
# C PreProcessor flags, not C Plus Plus
@@ -24,21 +26,19 @@ LDFLAGS ?= -Wl,--gc-sections
LIBS = -lpam
# includes all headers in `$(IDIR)` and compiles everything in `$(CDIR)`
DEPS = $(wildcard $(IDIR)/*.h)
_SOURCES = $(notdir $(wildcard $(CDIR)/*.c))
OBJ = $(patsubst %.c,$(ODIR)/%.o,$(_SOURCES))
DEPS = $(wildcard $(IDIR)/*.h $(IDIR)/**/*.h)
_SOURCES = $(wildcard $(CDIR)/*.c) $(wildcard $(CDIR)/**/*.c)
OBJ = $(patsubst $(CDIR)/%.c,$(ODIR)/%.o,$(_SOURCES))
$(ODIR)/%.o: $(CDIR)/%.c $(DEPS)
@mkdir -p $(ODIR)
@mkdir -p $(dir $@)
$(CC) -c -o $@ $< $(ALLFLAGS)
lidm: $(OBJ)
$(CC) -o $@ $^ $(ALLFLAGS) $(LIBS) $(LDFLAGS)
clean:
rm -f \
$(ODIR)/* \
lidm
rm -rf $(ODIR) lidm
install: lidm
mkdir -p ${DESTDIR}${PREFIX}/bin ${DESTDIR}${PREFIX}/share/man/man{1,5}