commit e65fcffa2b9ebf8ecec3da3c18d168ee5dcfc312
parent 29d95a2fadb3dbeb4955ebed3d0a2c8165beb770
Author: cowmonk <cowmonk@based.pt>
Date: Sat, 5 Sep 2026 13:08:46 -0700
Misc. changes and plans
Preparation for some changes, for now, the most significant change is
the Makefile since rats is going to go through a huge refactor to be
portable and not too linux-centric. Will take some time.
Diffstat:
4 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -11,3 +11,6 @@ util.o
tests/serva-test
tests/serva.log
tests/svc-test
+
+/tests/sandbox/
+/tests/slog-test
diff --git a/Makefile b/Makefile
@@ -10,38 +10,40 @@ BIN = origo serva svc slog
all: $(BIN)
origo: origo.o util.o
- $(CC) $(LDFLAGS) -o $@ origo.o util.o
+ $(CC) $(LDFLAGS) -o $@ origo.o util.o $(LDLIBS)
serva: serva.o util.o
- $(CC) $(LDFLAGS) -o $@ serva.o util.o
+ $(CC) $(LDFLAGS) -o $@ serva.o util.o $(LDLIBS)
svc: svc.o util.o
- $(CC) $(LDFLAGS) -o $@ svc.o util.o
+ $(CC) $(LDFLAGS) -o $@ svc.o util.o $(LDLIBS)
slog: slog.o util.o
- $(CC) $(LDFLAGS) -o $@ slog.o util.o
+ $(CC) $(LDFLAGS) -o $@ slog.o util.o $(LDLIBS)
-%.o: %.c util.h arg.h
- $(CC) $(CFLAGS) -c -o $@ $<
+$(OBJ): util.h arg.h
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CFLAGS) -std=c99 -c -o $@ $<
install: all
- install -Dm755 origo $(DESTDIR)$(PREFIX)$(SBIN_DIR)/origo
- install -Dm755 serva $(DESTDIR)$(PREFIX)$(SBIN_DIR)/serva
- install -Dm755 svc $(DESTDIR)$(PREFIX)$(BIN_DIR)/svc
- install -Dm755 slog $(DESTDIR)$(PREFIX)$(BIN_DIR)/slog
- install -d $(DESTDIR)/etc/ssv/boot
- install -d $(DESTDIR)/etc/ssv/default
+ mkdir -p "$(DESTDIR)$(PREFIX)$(SBIN_DIR)" "$(DESTDIR)$(PREFIX)$(BIN_DIR)"
+ cp -f origo serva "$(DESTDIR)$(PREFIX)$(SBIN_DIR)/"
+ cp -f svc slog "$(DESTDIR)$(PREFIX)$(BIN_DIR)/"
+ chmod 755 "$(DESTDIR)$(PREFIX)$(SBIN_DIR)/origo" "$(DESTDIR)$(PREFIX)$(SBIN_DIR)/serva"
+ chmod 755 "$(DESTDIR)$(PREFIX)$(BIN_DIR)/svc" "$(DESTDIR)$(PREFIX)$(BIN_DIR)/slog"
+ mkdir -p "$(DESTDIR)/etc/ssv/boot" "$(DESTDIR)/etc/ssv/default"
install-files:
- install -Dm755 files/rc.boot $(DESTDIR)/etc/rc.boot
- install -Dm755 files/rc.local $(DESTDIR)/etc/rc.local
- install -Dm755 files/rc.shutdown $(DESTDIR)/etc/rc.shutdown
- install -Dm755 files/rc.single $(DESTDIR)/etc/rc.single
- install -Dm755 files/bin/poweroff $(DESTDIR)$(PREFIX)/bin/poweroff
- install -Dm755 files/bin/reboot $(DESTDIR)$(PREFIX)/bin/reboot
+ mkdir -p "$(DESTDIR)/etc" "$(DESTDIR)$(PREFIX)$(BIN_DIR)"
+ cp -f files/rc.boot files/rc.local files/rc.shutdown files/rc.single "$(DESTDIR)/etc/"
+ chmod 755 "$(DESTDIR)/etc/rc.boot" "$(DESTDIR)/etc/rc.local" "$(DESTDIR)/etc/rc.shutdown" "$(DESTDIR)/etc/rc.single"
+ cp -f files/bin/poweroff files/bin/reboot "$(DESTDIR)$(PREFIX)$(BIN_DIR)/"
+ chmod 755 "$(DESTDIR)$(PREFIX)$(BIN_DIR)/poweroff" "$(DESTDIR)$(PREFIX)$(BIN_DIR)/reboot"
+
+check:
+ cd tests && $(MAKE) check
clean:
rm -f $(BIN) $(OBJ)
-
-.PHONY: all install install-files clean
-
+ cd tests && $(MAKE) clean
diff --git a/README b/README
@@ -113,7 +113,9 @@ usage: svc [-udrkts] [-a] [name...]
slog: simple logging daemon.
----------------------------
-Reads stdin, writes to <dir>/current, rotates on size.
+Reads stdin, writes to <dir>/current, rotates on size. Existing current
+file contents count toward the threshold. Rotation happens after a read
+chunk is written, so a file may exceed the threshold by up to 4095 bytes.
Rotated files: <dir>/0, <dir>/1, ..., <dir>/<n-1>
example:
@@ -147,7 +149,7 @@ Requirements
============
cc POSIX.1-2008-compliant C compiler (pcc, etc)
- make POSIX make (aruu make, pdpmake, gmake, bmake)
+ make POSIX make (aruu make, pdpmake, gmake, bmake)
Building
@@ -216,6 +218,7 @@ Source Layout
run.sh run this to test init suite (currently only serva/svc)
Makefile build serva/svc test binaries
ssv/* dummy ssv
+ sandbox/ temporary test state (not tracked)
files/
rc.* optional example configurations
bin/* optional scripts to use along with RATS
@@ -237,7 +240,6 @@ user - still thinking on this one, I think it would be interesting to
have something like dinit. It might be an overreach for this project
but it can be used for "bloated" setups where users need dbus-session,
pipewire, etc. to run when booted.
-Makefile - it looks garbage, improving it would be nice
Contribution
diff --git a/config.mk b/config.mk
@@ -1,7 +1,7 @@
-# config.mk: build configuration for RITS
+# config.mk: build configuration for RATS
CC = cc
-CFLAGS = -std=c99 -Wall -Wextra -Wpedantic -O2
+CFLAGS = -std=c99 -Wall -Wextra -Wpedantic -Werror -O2
LDFLAGS = -static
PREFIX = /usr/local
SBIN_DIR = /sbin