From d8ecf0178d4e3e48a8fd2bfade6a550b3be63959 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 21 Jun 2022 21:52:27 +0200 Subject: [PATCH] add make install-suid target --- Makefile | 7 +++++-- README.md | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 47174b3..2db8be6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: install clean +.PHONY: install install-suid clean prefix = /usr/local exec_prefix = $(prefix) @@ -17,10 +17,13 @@ all: squashfs-mount squashfs-mount: squashfs-mount.o $(CC) $< $(LDFLAGS) $(SQUASHFS_MOUNT_LDFLAGS) -o $@ - install: squashfs-mount mkdir -p $(DESTDIR)$(bindir) cp -p squashfs-mount $(DESTDIR)$(bindir) +install-suid: install + chown root:root $(DESTDIR)$(bindir)/squashfs-mount + chmod u+s $(DESTDIR)$(bindir)/squashfs-mount + clean: rm -f squashfs-mount squashfs-mount.o diff --git a/README.md b/README.md index f568fe9..9a480d4 100644 --- a/README.md +++ b/README.md @@ -97,9 +97,18 @@ issues: ## Install instructions +Build and install without privileges and make it a root-owned setuid binary by hand: + ```console make -sudo chown root:root squashfs-mount -sudo chmod +s squashfs-mount -make install +make install prefix=./install +sudo chown root:root ./install/bin/squashfs-mount +sudo chmod u+s ./install/bin/squashfs-mount +``` + +Or use the `install-suid` target: + +``` +make install prefix=./install +sudo make install-suid prefix=./install ```