rpm-build/scripts/shebang.req.in
Alexey Tourbin 2fc12ef2fa factored shebang.req
This is the dependency generator for #! lines.
shebang.req.files makes sure that only executable scripts are processed.

Here is why I chose the "shebang" name.

From Jargon File (4.3.1, 29 Jun 2001) [jargon]:

  shebang /sh*-bang/ n. The character sequence "#!" that frequently
     begins executable shell scripts under Unix. Probably derived from "shell
     bang" under the influence of American slang "the whole shebang"
     (everything, the works).

$ cd /usr/lib/perl5/pod
$ grep -i sharpbang *
perltoc.pod:C<shar>, C<sharpbang>, C<shmattype>, C<shortsize>, C<shrpenv>, C<shsharp>,
$ grep -i shebang *
perl58delta.pod:The command-line options -s and -F are now recognized on the shebang
perlbs2000.pod:BS2000 POSIX doesn't support the shebang notation
perlfaq3.pod:batch file and codify it in C<ALTERNATE_SHEBANG> (see the
perlfaq7.pod:line in your perl script (the "shebang" line) does not contain the
perlfaq7.pod:where you expect it so you need to adjust your shebang line.
perlfaq8.pod:but my shebang line is not the path to perl, so the shell runs the
perlglossary.pod:=item shebang
perljp.pod: "shebang"ѹǡJperlѤscriptΤۤȤɤѹʤѲǽȻפޤ
perlplan9.pod:such as "#!/usr/local/bin/perl". This is known as a shebang
perlplan9.pod:shebang path from config information located in Plan 9
perlport.pod:sub-systems do not support the C<#!> shebang trick for script invocation.
perlport.pod:OS/390 will support the C<#!> shebang trick in release 2.8 and beyond.
perlrun.pod:C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source
perltoc.pod:serialization, server, service, setgid, setuid, shared memory, shebang,
perlwin32.pod:Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to
$
2007-03-11 15:00:24 +03:00

21 lines
346 B
Bash
Executable File

#!/bin/sh -efu
. @RPMCONFIGDIR@/functions
. @RPMCONFIGDIR@/find-package
ShebangReq()
{
local f="$1" line=; shift
line=$(sed -n '1s|^#![[:space:]]*/|/|p' "$f")
[ -n "$line" ] || return 0
set -- $line
case "$#,$1" in
2,/usr/bin/env)
FindPackage "$f" "$1" "$2" ;;
*)
FindPackage "$f" "$1" ;;
esac
}
ArgvFileAction ShebangReq "$@"