Skip to content

Commit 3433754

Browse files
authored
Makefile: Make sure make is invoked with appropriate permissions (#146)
1 parent db753a9 commit 3433754

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ LIB_DIR = $(DESTDIR)$(PREFIX)/lib
99
.PHONY: install uninstall help
1010

1111
install:
12+
@if test "$(shell id -u)" != 0; then \
13+
echo "You are not root, run this target as root please."; \
14+
exit 1; \
15+
fi
1216
@install -Dm755 -t "$(DESTDIR)/etc/grub.d/" 41_snapshots-btrfs
1317
@install -Dm644 -t "$(DESTDIR)/etc/default/grub-btrfs/" config
1418
@install -Dm644 -t "$(LIB_DIR)/systemd/system/" grub-btrfs.service
@@ -23,6 +27,10 @@ install:
2327
@install -Dm644 "initramfs/readme.md" "$(SHARE_DIR)/doc/$(PKGNAME)/initramfs-overlayfs.md"
2428

2529
uninstall:
30+
@if test "$(shell id -u)" != 0; then \
31+
echo "You are not root, run this target as root please."; \
32+
exit 1; \
33+
fi
2634
@grub_dirname="$$(grep -oP '^[[:space:]]*GRUB_BTRFS_GRUB_DIRNAME=\K.*' "$(DESTDIR)/etc/default/grub-btrfs/config" | sed "s|\s*#.*||;s|(\s*\(.\+\)\s*)|\1|;s|['\"]||g")"; \
2735
rm -f "$${grub_dirname:-/boot/grub}/grub-btrfs.cfg"
2836
@rm -f "$(DESTDIR)/etc/default/grub-btrfs/config"

0 commit comments

Comments
 (0)