lsyncd/signames.sh

45 lines
944 B
Bash
Raw Permalink Normal View History

2018-04-21 12:23:21 +00:00
##
# signames.sh from Lsyncd -- the Live (Mirror) Syncing Demon
#
2018-04-22 11:01:01 +00:00
# Creates a .lua file for all signal names understood by the kill command
2018-04-21 12:23:21 +00:00
# on the system Lsyncd is being compiled for.
#
2018-04-22 15:52:35 +00:00
# This script has been tested with bash and dash.
#
2018-04-21 12:23:21 +00:00
# License: GPLv2 (see COPYING) or any later version
# Authors: Axel Kittenberger <axkibe@gmail.com>
#
KILL=/bin/kill
2018-04-28 12:32:56 +00:00
# Don't know a better way, checks only until this signal number
# To quote, this ought to be enough for anybody.
nmax=256
2018-04-22 15:52:35 +00:00
2018-04-21 12:23:21 +00:00
if [ "$#" -ne 1 ];
then
2018-04-22 11:01:01 +00:00
echo >&2 "$0 needs excatly one argument -- the lua file to create"
2018-04-21 12:23:21 +00:00
exit 1
fi
2018-04-22 15:52:35 +00:00
if ! [ "$BASH_VERSION" = '' ];
then
echoe=-e
fi
2018-04-22 11:01:01 +00:00
echo "-- This file is autogenerated by $0 querying `$KILL --version`" > $1
2018-04-22 15:52:35 +00:00
echo "signames =" >> $1
2018-04-21 12:23:21 +00:00
echo "{" >> $1
n=1
2018-04-28 12:32:56 +00:00
while name=`$KILL --list=$n 2>/dev/null`;
2018-04-21 12:23:21 +00:00
do
2018-04-22 15:52:35 +00:00
if ! [ -z $name ]
2018-04-22 11:01:01 +00:00
then
2018-04-22 15:52:35 +00:00
echo $echoe "\t[ $n ] = '$name'," >> $1
2018-04-22 11:01:01 +00:00
fi
n=$(( n + 1 ))
2018-04-28 12:32:56 +00:00
if [ $n -gt $nmax ]; then break; fi
2018-04-21 12:23:21 +00:00
done
echo "}" >> $1