[OpenWrt-Devel] Remove requirement of an absolute path to the perl interpreter

Thomas Strobel ts468 at cam.ac.uk
Sun May 10 08:16:27 EDT 2015

On 05/10/2015 01:12 PM, Felix Fietkau wrote:
> On 2015-05-09 16:50, Thomas Strobel wrote:
>> Hi,
>> I'm using OpenWRT on NixOS, a Linux operating system that uses a
>> sophisticated hash mechanism instead of the Filesystem Hierarchy
>> Standard. A consequence of the hashing mechanism is that files like,
>> e.g., /usr/bin/perl don't exist under NixOS.
>> I've tried to create a patch that replaces two occurrences where
>> "/usr/bin/perl" would be needed with a more general calling scheme that
>> "shouldn't" break OpenWRT on any other platform, but allows to build it
>> on NixOS.
>> Could you please comment on the changes suggested, e.g., if they break
>> anything, and whether there is an interest in merging the patch upstream?
>> Many thanks!
>> Thomas
>> diff --git a/include/feeds.mk b/include/feeds.mk
>> index 695b03b..27f3e8f 100644
>> --- a/include/feeds.mk
>> +++ b/include/feeds.mk
>> @@ -7,7 +7,7 @@
>>  -include $(TMP_DIR)/.packagefeeds
>> -FEEDS_AVAILABLE:=$(shell $(SCRIPT_DIR)/feeds list -n)
>> +FEEDS_AVAILABLE:=$(perl $(SCRIPT_DIR)/feeds list -n)
> I think this is the wrong place to make the change. Why not change
> scripts/feeds to replace the #! line with:
> #!/usr/bin/env perl
> - Felix
Thanks for the review.
Unfortunately, "/usr/bin/env" does not exist either. In NixOS there is
no "/usr", no "/sbin", and only a "/bin/sh ->
/nix/store/nixos_installation_specific_hash/bash". The absolute path to,
e.g., "perl" or "env" is different for each installation of NixOS, so it
can't be hard-coded into the build script. That's why I thought of
calling "perl" directly from the PATH environment.

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list