Skip to content

Commit

Permalink
add make install-suid target
Browse files Browse the repository at this point in the history
  • Loading branch information
haampie committed Jun 21, 2022
1 parent 9c350b8 commit d8ecf01
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: install clean
.PHONY: install install-suid clean

prefix = /usr/local
exec_prefix = $(prefix)
Expand All @@ -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
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit d8ecf01

Please sign in to comment.