Skip to contentSkip to conversation

files: replace interpreter during installation

PATCH New Arturo Borrero Gonzalez 1 participant 1 message Dec 24, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 files: replace interpreter during installation

Many systems (for example Debian) don't recognice `#!nft -f' as a valid interpreter.

A short way to handle this is to provide the full path to the interpreter in the shebang.
That is what this patch does: update the shebang's path during installation.

For example, if you are installing under /usr/local, the shebang becomes:
#!/usr/local/sbin/nft -f

If using --prefix=/, then:
#!/sbin/nft -f

NOTE: If the shebang in source files are changed in a future, this sed script should be updated as well.

---
 Makefile.defs.in  |    1 +
 configure.ac      |    1 +
 files/Makefile.in |    1 +
 3 files changed, 3 insertions(+)
Makefile.defs.in +1 -0
index 502f374..3fee9c2 100644
@@ -5,6 +5,7 @@ LEX		= @LEX@
 YACC		= @YACC@
 MKDIR_P		= @MKDIR_P@
 INSTALL		= @INSTALL@
+SED		= @SED@
 
 PACKAGE_TARNAME	= @PACKAGE_TARNAME@
 
configure.ac +1 -0
index 811d7e2..ca14d83 100644
@@ -23,6 +23,7 @@ AC_SUBST([CONFIG_DEBUG])
 AC_PROG_CC
 AC_PROG_MKDIR_P
 AC_PROG_INSTALL
+AC_PROG_SED
 
 AC_CHECK_PROG(CONFIG_MAN, docbook2x-man, y, n)
 if test "$CONFIG_MAN" != "y"
files/Makefile.in +1 -0
index cd67c37..563383b 100644
@@ -2,3 +2,4 @@ install:
 	@echo -e "  INSTALL\tfiles"
 	$(MKDIR_P) $(DESTDIR)/$(confdir)
 	$(INSTALL) -m 755 -o root -g root $(SUBDIR)nftables/* $(DESTDIR)/$(confdir)/
+	$(SED) -i "s~#\! nft~#\!@sbindir@/nft~" $(DESTDIR)/$(confdir)/*