]> arthur.barton.de Git - ax-linux.git/commitdiff
Make USER configurable on make command line
authorAlexander Barton <alex@barton.de>
Tue, 31 Dec 2013 16:30:36 +0000 (17:30 +0100)
committerAlexander Barton <alex@barton.de>
Tue, 31 Dec 2013 16:30:36 +0000 (17:30 +0100)
The default is to use the group of the PREFIX directory, if it exists,
or the primary group of the user running make otherwise.

Makefile.ax
btrfs/mksnapshot/Makefile

index 71a566d4029b41ebd79ce049d8aaf596267fb0df..aa91fb2cafa28218a36933762608c70f989589b4 100644 (file)
@@ -11,7 +11,9 @@
 AX_SILENT ?= @
 
 PREFIX ?= /usr/local
-GROUP ?= staff
+
+USER ?= $(shell id -un)
+GROUP ?= $(shell stat --format=%G $(DESTDIR)$(PREFIX) 2>/dev/null || id -gn)
 
 $(SUBDIRS):
        $(MAKE) -C $@
index 098f0936ef3f90fa2d8031effa89660b4ea36c39..9be1b6a09144d0d38e3751ba57f80d0678c09bb8 100644 (file)
 all: btrfs-mksnapshot
 
 install-local: btrfs-mksnapshot
-       install -d -o root -g $(GROUP) -m 755 \
+       install -d -o $(USER) -g $(GROUP) -m 755 \
         $(DESTDIR)$(PREFIX)/sbin
-       install -p -o root -g $(GROUP) -m 755 btrfs-mksnapshot \
+       install -p -o $(USER) -g $(GROUP) -m 755 btrfs-mksnapshot \
         $(DESTDIR)$(PREFIX)/sbin/btrfs-mksnapshot
-       install -d -o root -g root -m 755 \
+       install -d -o $(USER) -g $(GROUP) -m 755 \
         $(DESTDIR)/etc/apt/apt.conf.d
-       install -p -o root -g root -m 644 06btrfs-mksnapshot \
+       install -p -o $(USER) -g $(GROUP) -m 644 06btrfs-mksnapshot \
         $(DESTDIR)/etc/apt/apt.conf.d/06btrfs-mksnapshot
 
 include ../../Makefile.ax