Skip to content

Commit

Permalink
Fix race condition when installing init binary
Browse files Browse the repository at this point in the history
The old situation led to errors when building the Debian package with
more than one thread.
  • Loading branch information
viccie30 committed Feb 14, 2024
1 parent e593718 commit 6cc3c03
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AM_CPPFLAGS = -Wall -Wextra

pkglibexec_PROGRAMS = tiny_initramfs
noinst_PROGRAMS = tiny_initramfs

tiny_initramfs_SOURCES = tiny_initramfs.c io.c fstab.c mount.c log.c devices.c util.c
if ENABLE_NFS4
Expand All @@ -11,12 +11,19 @@ tiny_initramfs_LDFLAGS = -static

EXTRA_DIST = README.md tiny_initramfs.h nfs4.h

installdirs-local:
$(MKDIR_P) "$(DESTDIR)$(pkglibexecdir)"

if HAVE_VARIANT
install-exec-hook:
cd $(DESTDIR)$(pkglibexecdir) && \
mv -f tiny_initramfs init-@VARIANT@
install-exec-local:
$(MKDIR_P) "$(DESTDIR)$(pkglibexecdir)"
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) tiny_initramfs$(EXEEXT) "$(DESTDIR)$(pkglibexecdir)/init-@VARIANT@$(EXEEXT)"
uninstall-local:
rm -f "$(DESTDIR)$(pkglibexecdir)/init-@VARIANT@$(EXEEXT)"
else
install-exec-hook:
cd $(DESTDIR)$(pkglibexecdir) && \
mv -f tiny_initramfs init
install-exec-local:
$(MKDIR_P) "$(DESTDIR)$(pkglibexecdir)"
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) tiny_initramfs$(EXEEXT) "$(DESTDIR)$(pkglibexecdir)/init$(EXEEXT)"
uninstall-local:
rm -f "$(DESTDIR)$(pkglibexecdir)/init$(EXEEXT)"
endif

0 comments on commit 6cc3c03

Please sign in to comment.