From 2e5c0694344078b92650565322e767a6f2075ca8 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Tue, 31 Dec 2013 17:30:36 +0100 Subject: [PATCH] Make USER configurable on make command line 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 | 4 +++- btrfs/mksnapshot/Makefile | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile.ax b/Makefile.ax index 71a566d..aa91fb2 100644 --- a/Makefile.ax +++ b/Makefile.ax @@ -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 $@ diff --git a/btrfs/mksnapshot/Makefile b/btrfs/mksnapshot/Makefile index 098f093..9be1b6a 100644 --- a/btrfs/mksnapshot/Makefile +++ b/btrfs/mksnapshot/Makefile @@ -11,13 +11,13 @@ 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 -- 2.39.2