summaryrefslogtreecommitdiff
path: root/bin/sbang
diff options
context:
space:
mode:
authorElizabeth Fischer <elizabeth.fischer@columbia.edu>2016-06-30 09:13:24 -0400
committerElizabeth Fischer <elizabeth.fischer@columbia.edu>2016-06-30 09:13:24 -0400
commit50ac98bc04d9be2eead0b31e0a898a2dfd24a7a4 (patch)
treee190a29f85712b580d48d0ae6bca24367245f42c /bin/sbang
parentefa506b235523c8a9a925c1ecf91690266da4fd4 (diff)
parent0e422dec8c8d075e68c31b032628b7d4db96c552 (diff)
downloadspack-50ac98bc04d9be2eead0b31e0a898a2dfd24a7a4.tar.gz
spack-50ac98bc04d9be2eead0b31e0a898a2dfd24a7a4.tar.bz2
spack-50ac98bc04d9be2eead0b31e0a898a2dfd24a7a4.tar.xz
spack-50ac98bc04d9be2eead0b31e0a898a2dfd24a7a4.zip
Merge remote-tracking branch 'upstream/develop' into efischer/160630-StagedPackage
# Conflicts: # lib/spack/docs/packaging_guide.rst # lib/spack/spack/package.py Mostly minor/formatting issues in lib/spack/spack/package.py (the heavyweight merge was already done recently). Only one serious issue: it looks like the feature branch had accidentally deleted the line `spack.hooks.post_install(self)`. This got added back in from develop.
Diffstat (limited to 'bin/sbang')
-rwxr-xr-xbin/sbang35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/sbang b/bin/sbang
index ebfbe2e7a1..1ea5f06592 100755
--- a/bin/sbang
+++ b/bin/sbang
@@ -1,4 +1,28 @@
#!/bin/bash
+##############################################################################
+# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/llnl/spack
+# Please also see the LICENSE file for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License (as
+# published by the Free Software Foundation) version 2.1, February 1999.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
+# conditions of the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##############################################################################
#
# `sbang`: Run scripts with long shebang lines.
#
@@ -55,6 +79,15 @@
# Obviously, for this to work, `sbang` needs to have a short enough
# path that *it* will run without hitting OS limits.
#
+# For Lua, scripts the second line can't start with #!, as # is not
+# the comment character in lua (even though lua ignores #! on the
+# *first* line of a script). So, instrument a lua script like this,
+# using -- instead of # on the second line:
+#
+# 1 #!/bin/bash /path/to/sbang
+# 2 --!/long/path/to/lua with arguments
+# 3
+# 4 print "success!"
#
# How it works
# -----------------------------
@@ -71,6 +104,8 @@ lines=0
while read line && ((lines < 2)) ; do
if [[ "$line" = '#!'* ]]; then
interpreter="${line#\#!}"
+ elif [[ "$line" = '--!'*lua* ]]; then
+ interpreter="${line#--!}"
fi
lines=$((lines+1))
done < "$script"