diff --git a/Makefile b/Makefile index e3737d1..a5a0cf2 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ VERSION = 0.7.0 -LUA_VERSION = 5.2 +LUA_VERSION = 5.3 prefix ?= /usr sharedir ?= $(prefix)/share luasharedir ?= $(sharedir)/lua/$(LUA_VERSION) bindir ?= $(prefix)/bin +# Shebang to replace "/usr/bin/env lua" with. If empty, shebang is keep +# unchanged (default). +luashebang ?= aportsfiles = \ abuild.lua \ @@ -19,6 +22,7 @@ all: @echo "To install run:" @echo " make install DESTDIR=" +# Note: -i.tmp is needed for compatibility with both GNU and BSD sed. install: $(addprefix bin/,$(binfiles)) $(addprefix aports/,$(aportsfiles)) install -d $(DESTDIR)$(luasharedir)/aports \ $(DESTDIR)$(bindir) @@ -26,6 +30,11 @@ install: $(addprefix bin/,$(binfiles)) $(addprefix aports/,$(aportsfiles)) $(DESTDIR)$(luasharedir)/aports/ for file in $(binfiles); do \ install -m755 bin/$$file $(DESTDIR)$(bindir)/$${file%.lua} || exit 1; \ + if [ -n "$(luashebang)" ]; then \ + sed -i.tmp "s|^#!/usr/bin/env lua|#!$(luashebang)|" \ + $(DESTDIR)$(bindir)/$${file%.lua} || exit 1; \ + rm $(DESTDIR)$(bindir)/$${file%.lua}.tmp; \ + fi; \ done check: lint diff --git a/bin/ap.lua b/bin/ap.lua index 1251064..c0ada61 100755 --- a/bin/ap.lua +++ b/bin/ap.lua @@ -1,4 +1,4 @@ -#!/usr/bin/lua5.2 +#!/usr/bin/env lua local lfs = require('lfs') diff --git a/bin/buildrepo.lua b/bin/buildrepo.lua index b33703f..c4b514f 100755 --- a/bin/buildrepo.lua +++ b/bin/buildrepo.lua @@ -1,4 +1,4 @@ -#!/usr/bin/lua5.2 +#!/usr/bin/env lua local abuild = require("aports.abuild") local apkrepo = require("aports.apkrepo")