2010-01-16 01:11:44 +00:00
|
|
|
include ../vars.mk
|
|
|
|
|
2010-04-26 12:15:49 +00:00
|
|
|
SH_BINS = xbps-src-chroot-helper xbps-src-doinst-helper
|
|
|
|
MOUNT_BIN = xbps-src-chroot-capmount
|
|
|
|
UMOUNT_BIN = xbps-src-chroot-capumount
|
|
|
|
CHROOT_BIN = xbps-src-capchroot
|
|
|
|
BINS = $(CHROOT_BIN) $(MOUNT_BIN) $(UMOUNT_BIN)
|
|
|
|
WFLAGS = -Wall -Werror
|
|
|
|
LDFLAGS = -lcap
|
|
|
|
|
|
|
|
ifdef IN_CHROOT
|
|
|
|
BINS =
|
|
|
|
endif
|
2010-01-16 01:11:44 +00:00
|
|
|
|
|
|
|
.PHONY: all
|
2010-04-26 12:15:49 +00:00
|
|
|
all: $(BINS)
|
|
|
|
for bin in $(SH_BINS); do \
|
2010-01-16 01:11:44 +00:00
|
|
|
sed -e "s|@@XBPS_INSTALL_PREFIX@@|$(PREFIX)|g" \
|
|
|
|
-e "s|@@XBPS_INSTALL_ETCDIR@@|$(ETCDIR)|g" \
|
|
|
|
-e "s|@@XBPS_INSTALL_SHAREDIR@@|$(SHAREDIR)|g" \
|
|
|
|
-e "s|@@XBPS_INSTALL_SBINDIR@@|$(SBINDIR)|g" \
|
2010-04-26 12:15:49 +00:00
|
|
|
-e "s|@@XBPS_INSTALL_LIBEXECDIR@@|$(LIBEXECDIR)|g" \
|
2010-01-16 01:11:44 +00:00
|
|
|
$$bin.sh.in > $$bin; \
|
|
|
|
done
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2010-04-26 12:15:49 +00:00
|
|
|
-rm -f $(BINS) $(SH_BINS)
|
2010-01-16 01:11:44 +00:00
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: all
|
|
|
|
install -d $(DESTDIR)$(LIBEXECDIR)
|
2010-04-26 12:15:49 +00:00
|
|
|
for bin in $(SH_BINS); do \
|
|
|
|
install -m755 $$bin $(DESTDIR)$(LIBEXECDIR); \
|
2010-01-16 01:11:44 +00:00
|
|
|
done
|
2010-04-26 12:15:49 +00:00
|
|
|
ifdef BINS
|
|
|
|
install -m755 $(MOUNT_BIN) $(DESTDIR)$(LIBEXECDIR)
|
|
|
|
setcap cap_sys_admin=ep $(DESTDIR)$(LIBEXECDIR)/$(MOUNT_BIN)
|
|
|
|
install -m755 $(UMOUNT_BIN) $(DESTDIR)$(LIBEXECDIR)
|
|
|
|
setcap cap_sys_admin=ep $(DESTDIR)$(LIBEXECDIR)/$(UMOUNT_BIN)
|
|
|
|
install -m755 $(CHROOT_BIN) $(DESTDIR)$(LIBEXECDIR)
|
|
|
|
setcap cap_sys_chroot=ep $(DESTDIR)$(LIBEXECDIR)/$(CHROOT_BIN)
|
|
|
|
endif
|
2010-01-16 01:11:44 +00:00
|
|
|
|
|
|
|
.PHONY: uninstall
|
|
|
|
uninstall:
|
2010-04-26 12:15:49 +00:00
|
|
|
for bin in $(BINS) $(SH_BINS); do \
|
2010-01-16 01:11:44 +00:00
|
|
|
rm -f $(DESTDIR)$(LIBEXECDIR)/$$bin; \
|
|
|
|
done
|
2010-04-26 12:15:49 +00:00
|
|
|
|
|
|
|
$(MOUNT_BIN):
|
|
|
|
$(CC) $(WFLAGS) $(LDFLAGS) mount.c -o $@
|
|
|
|
|
|
|
|
$(UMOUNT_BIN):
|
|
|
|
$(CC) $(WFLAGS) $(LDFLAGS) umount.c -o $@
|
|
|
|
|
|
|
|
$(CHROOT_BIN):
|
|
|
|
$(CC) $(WFLAGS) $(LDFLAGS) chroot.c -o $@
|