#!/bin/bash

source debian/vars.sh

# nodejs now has support for Microsoft Powershell, since that is not relevant
# to any of our deployed systems, I am removing them so they do not
# automatically require powershell, causing a dependency issue
cat > remove_pwsh.pl <<EOF
use strict;
use warnings;
my @files = split (/\n/, \`find . -type f -print\`);
foreach my \$file (@files) {
    my \$first_line = \`head -n 1 \$file\`;
    if (\$first_line =~ m/env\s+pwsh/) {
        print "Removing file \$file\n";
        unlink \$file;
    }
}
EOF
/usr/bin/perl remove_pwsh.pl
