2010-03-18 15:46:07 +00:00
|
|
|
|
#!/bin/sh
|
2010-04-16 17:41:05 +00:00
|
|
|
|
# vim: filetype=zsh
|
2010-03-18 15:46:07 +00:00
|
|
|
|
|
|
|
|
|
set -e
|
2010-11-08 20:16:50 +00:00
|
|
|
|
if [ -n "$ZSH_VERSION" ]; then
|
|
|
|
|
setopt SH_WORD_SPLIT
|
|
|
|
|
fi
|
2010-11-12 14:42:48 +00:00
|
|
|
|
if [ -z "$ECHO" ]; then
|
|
|
|
|
if echo "\\\\" | grep .. >/dev/null; then
|
|
|
|
|
ECHO=echo
|
|
|
|
|
else
|
|
|
|
|
ECHO=`which echo`
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2010-03-18 15:46:07 +00:00
|
|
|
|
|
2010-05-15 20:53:45 +00:00
|
|
|
|
# I use this in EVERY shell script ;)
|
|
|
|
|
LF="
|
|
|
|
|
"
|
2010-10-15 10:49:37 +00:00
|
|
|
|
ESC=""
|
2010-05-15 20:53:45 +00:00
|
|
|
|
|
2010-04-02 18:34:05 +00:00
|
|
|
|
d00=`pwd`
|
|
|
|
|
while ! [ -f ./all ]; do
|
|
|
|
|
if [ x"`pwd`" = x"/" ]; then
|
2010-11-12 14:42:48 +00:00
|
|
|
|
$ECHO "Cannot find myself."
|
|
|
|
|
$ECHO "Please run this script with the working directory inside a Xonotic checkout."
|
2010-04-02 18:34:05 +00:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
cd ..
|
|
|
|
|
done
|
2010-08-05 04:11:40 +00:00
|
|
|
|
export d0=`pwd`
|
2010-04-02 18:34:05 +00:00
|
|
|
|
SELF="$d0/all"
|
|
|
|
|
|
|
|
|
|
# If we are on WINDOWS:
|
|
|
|
|
case "$0" in
|
|
|
|
|
all|*/all)
|
|
|
|
|
case "`uname`" in
|
2010-04-11 10:23:32 +00:00
|
|
|
|
MINGW*|Win*)
|
2010-04-02 18:34:05 +00:00
|
|
|
|
# Windows hates users. So this script has to copy itself elsewhere first...
|
2010-04-02 18:35:19 +00:00
|
|
|
|
cp "$SELF" ../all.xonotic.sh
|
2010-04-25 18:21:54 +00:00
|
|
|
|
export WE_HATE_OUR_USERS=1
|
2010-04-02 18:34:05 +00:00
|
|
|
|
exec ../all.xonotic.sh "$@"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
2010-03-29 13:21:24 +00:00
|
|
|
|
msg()
|
|
|
|
|
{
|
2010-11-12 14:42:48 +00:00
|
|
|
|
$ECHO >&2 "$ESC""[1m$*$ESC""[m"
|
2010-03-29 13:21:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-22 15:05:06 +00:00
|
|
|
|
self=`git hash-object "$SELF"`
|
2010-03-29 13:21:24 +00:00
|
|
|
|
checkself()
|
|
|
|
|
{
|
2010-06-22 15:05:06 +00:00
|
|
|
|
self_new=`git hash-object "$SELF"`
|
2010-03-29 13:21:24 +00:00
|
|
|
|
if [ x"$self" != x"$self_new" ]; then
|
|
|
|
|
msg "./all has changed."
|
|
|
|
|
if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
|
|
|
|
|
msg "Rerunning the requested operation to make sure."
|
|
|
|
|
export XONOTIC_FORBID_RERUN_ALL=1
|
2010-04-02 18:34:05 +00:00
|
|
|
|
exec "$SELF" "$@"
|
2010-03-29 13:21:24 +00:00
|
|
|
|
else
|
2010-04-02 18:34:05 +00:00
|
|
|
|
msg "Please try $SELF update, and then retry your requested operation."
|
2010-03-29 13:21:24 +00:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2010-03-29 13:24:49 +00:00
|
|
|
|
return 0
|
2010-03-29 13:21:24 +00:00
|
|
|
|
}
|
2010-03-29 13:17:50 +00:00
|
|
|
|
|
2010-03-26 08:18:04 +00:00
|
|
|
|
verbose()
|
|
|
|
|
{
|
2010-03-29 13:21:24 +00:00
|
|
|
|
msg "+ $*"
|
2010-03-26 08:18:04 +00:00
|
|
|
|
"$@"
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 17:40:25 +00:00
|
|
|
|
yesno()
|
|
|
|
|
{
|
|
|
|
|
yesno=
|
|
|
|
|
while [ x"$yesno" != x"y" -a x"$yesno" != x"n" ]; do
|
2010-05-15 18:11:23 +00:00
|
|
|
|
eval "$2"
|
2010-11-12 14:42:48 +00:00
|
|
|
|
$ECHO "$1"
|
2011-03-09 17:47:38 +00:00
|
|
|
|
if ! IFS= read -r yesno; then
|
|
|
|
|
yesno=n
|
|
|
|
|
break
|
|
|
|
|
fi
|
2010-05-09 17:40:25 +00:00
|
|
|
|
done
|
|
|
|
|
[ x"$yesno" = x"y" ]
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-02 19:11:17 +00:00
|
|
|
|
enter()
|
|
|
|
|
{
|
2010-07-18 15:18:15 +00:00
|
|
|
|
$2 cd "$1" || exit 1
|
2012-03-01 13:09:29 +00:00
|
|
|
|
check_mergeconflict "$1" # defined in git.subr
|
2010-08-25 04:59:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-03-18 15:57:21 +00:00
|
|
|
|
if [ "$#" = 0 ]; then
|
|
|
|
|
set -- help
|
|
|
|
|
fi
|
2010-03-18 15:46:07 +00:00
|
|
|
|
cmd=$1
|
|
|
|
|
shift
|
|
|
|
|
|
2012-03-01 13:09:29 +00:00
|
|
|
|
# project config
|
|
|
|
|
. "$d0/misc/tools/all/config.subr"
|
2010-08-04 10:26:57 +00:00
|
|
|
|
|
2012-03-01 13:09:29 +00:00
|
|
|
|
# shared commands
|
|
|
|
|
handled=false
|
|
|
|
|
. "$d0/misc/tools/all/git.subr" "$@"
|
2010-08-04 10:26:57 +00:00
|
|
|
|
|
2012-03-01 13:09:29 +00:00
|
|
|
|
# optional modules
|
|
|
|
|
$handled || . "$d0/misc/tools/all/release.subr" "$@"
|
|
|
|
|
$handled || . "$d0/misc/tools/all/xonotic.subr" "$@"
|
2010-08-04 10:26:57 +00:00
|
|
|
|
|
2012-03-01 13:09:29 +00:00
|
|
|
|
if ! $handled; then
|
|
|
|
|
if [ x"$cmd" != x"help" ]; then
|
|
|
|
|
$ECHO "Run $SELF help for help."
|
2011-07-27 17:50:16 +00:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2012-03-01 13:09:29 +00:00
|
|
|
|
fi
|