Merge pull request #2085 from github/shebang-first

Shebang first
This commit is contained in:
Arfon Smith
2015-02-11 16:00:25 -06:00
3 changed files with 157 additions and 1 deletions

View File

@@ -96,8 +96,8 @@ module Linguist
STRATEGIES = [
Linguist::Strategy::Modeline,
Linguist::Strategy::Filename,
Linguist::Shebang,
Linguist::Strategy::Filename,
Linguist::Heuristics,
Linguist::Classifier
]

View File

@@ -0,0 +1,57 @@
#! /bin/sh
#
# Builds and installs liblua5.1 for the cross toolchain.
# Executed by build-uqm-dependencies.chroot
# Include our common functions
. /usr/lib/crossbuild/crossbuild.subr
# envvar LIBLUA51_URL
#
# Specifies the URL of the liblua5.1 source tarball you want to use.
export LIBLUA51_URL="http://www.lua.org/ftp/lua-5.1.5.tar.gz"
# envvar INSTALL_TOP
#
# This determines where lua's makefiles install everything (we don't want to use
# /usr/local!).
export INSTALL_TOP="/usr/${HOST_TRIPLET}"
# envvar TO_BIN
#
# Names of the binary files to install (that's right, lua's makefiles don't
# determine this automatically, and since we end up with files named according
# to Windows conventions the install chokes without these)
export TO_BIN="lua.exe luac.exe"
# envvar TO_LIB
#
# Names of the libraries to install, see TO_BIN
export TO_LIB="liblua.a lua51.dll"
# liblua5.1 uses custom makefiles and does not natively support cross-building.
# However, with our cross toolchain in its PATH it successfully builds the mingw
# target.
export PATH=/usr/${HOST_TRIPLET}/bin:${PATH}
echo "*************************************************************************"
echo "--- BEGIN: crossbuild_liblua5.1 ---"
get_tarball "liblua5.1" "${LIBLUA51_URL}" gz
cd ${SRC_ROOT_DIR}/liblua5.1/*
if [ -f Makefile ]; then
make clean
make --environment-overrides mingw install
else
echo "crossbuild_liblua5.1 failed: Could not find Makefile"
echo "(is the liblua5.1 source tarball sane?)"
exit 1
fi
echo "--- END: crossbuild_liblua5.1 ---"
echo "*************************************************************************"

99
test/fixtures/Shell/graylog2-server.init.d vendored Executable file
View File

@@ -0,0 +1,99 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: graylog2-server
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: Start Graylog2 server
### END INIT INFO
# Written by Lital Natan <litaln@gmail.com>
PREFIX=/usr
SHAREDIR=$PREFIX/share/graylog2-server
SERVER_JAR=$SHAREDIR/graylog2-server.jar
SYSLOG4J_JAR=$SHAREDIR/syslog4j-0.9.46-bin.jar
SVCNAME="graylog2-server"
CONFIG="/etc/graylog2.conf"
LOGFILE="/var/log/graylog2.log"
PIDFILE="/var/run/graylog2.pid"
start() {
if [ ! -e $CONFIG ]; then
echo "Config file $CONFIG does not exist"
return 1
fi
echo "Starting ${SVCNAME}"
nohup `which java` -cp $SERVER_JAR:$SYSLOG4J_JAR org.graylog2.Main \
-p ${PIDFILE} -f ${CONFIG} > $LOGFILE 2>&1 &
# Sleep before testing the service
sleep 2
graylog2_test || return 1
}
stop() {
pid=`< $PIDFILE`
kill $pid
rm -f ${PIDFILE} # just in case
}
graylog2_test() {
# Graylog2 only deletes its PID file if it hits a config error
if [ ! -e ${PIDFILE} ]; then
echo "Configuration error, check ${CONFIG}"
return 1
fi
local pid=`cat ${PIDFILE}`
# Graylog2 isn't running, so that means there was a problem
if [ ! -e /proc/$pid ]; then
echo "Something went wrong, check ${LOGFILE}"
rm -f ${PIDFILE}
return 1
else
return 0
fi
}
status() {
graylog2_test > /dev/null 2>&1
if [ "$?" == "0" ]; then
echo "Graylog2 server is up"
return 0
else
echo "Graylog2 server is down"
return 1
fi
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo "Usage $0 {start|stop|restart|status}"
RETVAL=1
esac