Poky build script...for ubunto 16 replace shabang sh with bash

Hi,

I just wanted to make a comment that I tried to build poky using the following script with ubuntu 16 and it failed on “altera-init”

$ git clone http://git.rocketboards.org/poky-socfpga.git
$ cd poky-socfpga/
$ git checkout -b test_branch_name ACDS13.1_REL_GSRD_PR_UPDATE1
$ source ./altera-init build
$ bitbake virtual/kernel virtual/bootloader altera-gsrd-image

The way I got it to work was by recurisvely replacing the shabangs on the scripts from older bourne shell (/bin/sh) and replacing it with bash (/bin/bash)

here’s the code that i used to make this change.

#WORKAROUND: Fix Script’s Shabang so that it run

bash shell instead of the old bourne shell

(probably the script was written in another

version of linux that treats #!/bin/sh

as bash shell instead of bourne shell)

sub fix_bash_shabang($) {
my $script = shift;
if (! -f $script) {
die(“file does not exist: $script\n”);
}

open(F, “$script”);
@lines = ;
close(F);
for($i=0; $i < 2; $i++) {
$lines[$i] =~ s|^#!/bin/sh|#!/bin/bash|;
}
open(F, “>$script”);
print F @lines;
close(F);
}

sub recursively_fix_shabangs($) {

my $rootdir = shift;
open(P, “find $rootdir -type f |”) || die(“recursively_fix_shabangs failed\n”);
while(

) {
my $file = $_;
chomp($file);
$rc = open(F, “$file”);
next if (!$rc);
$shabang=;
close(F);

$found_sh = ($shabang =~ /#!\/bin\/sh/);
$found_bash = ($shabang =~ /#!\/bin\/bash/);

#if ($found_bash) {
#  print "bash: $file\n";            
#}  

if ($found_sh) {
  print "shabang-processing: $file\n";            
  fix_bash_shabang($file);
}  

}
}

recursively_fix_shabangs(".");

If anybody knows a better way to get “/bin/sh” to behave like “/bin/bash” … let me know…

Thanks

Bill