q3rally/engine/misc/setup/doit
2011-02-18 14:31:32 +00:00

102 lines
2.5 KiB
Bash

#!/bin/bash
: ${MAKESELF:=/usr/share/loki-setup/makeself}
: ${SETUPIMAGE:=/usr/share/loki-setup/image}
: ${VERSION:=0.0_`date +%Y%m%d%H%M`}
: ${RELEASE:=0}
set -e
set -x
shopt -s nullglob
rm -rf image
mkdir image
### loki-setup files
cp -a $SETUPIMAGE/{setup.data,setup.sh} image/
### splash
rm -f image/setup.data/splash.xpm
[ -e splash.xpm ] && cp splash.xpm image/setup.data/splash.xpm
rm -f image/q3rally.png
cp ../quake3.png image/q3rally.png
### binaries
topdir="../.."
echo "changequote(\`[', \`]')dnl" > defines.m4
echo "define(VERSION,$VERSION)dnl" >> defines.m4
copystartscript()
{
local arch="$1"
mkdir -p image/bin/Linux/$arch
if [ "$arch" = x86_64 ]; then
ln -s x86_64 image/bin/Linux/amd64
elif [ "$arch" = ppc ]; then
ln -s ppc image/bin/Linux/ppc64
fi
install -m 755 q3rally.sh image/bin/Linux/$arch/q3rally
}
archs=()
for arch in $topdir/build/release-*; do
arch=${arch##*-}
case "$arch" in
i386) echo "define(HAVE_I386,yes)dnl" >> defines.m4
copystartscript x86
;;
x86_64) echo "define(HAVE_X86_64,yes)dnl" >> defines.m4
copystartscript $arch
;;
ppc) echo "define(HAVE_PPC,yes)dnl" >> defines.m4
copystartscript $arch
;;
ppc64) echo "define(HAVE_PPC64,yes)dnl" >> defines.m4
copystartscript $arch
;;
*)
echo "architecture $arch unsupported"
continue;
;;
esac
archs[${#archs[@]}]=$arch
done
for arch in "${archs[@]}"; do
dst=image/tmp
mkdir $dst
mkdir $dst/q3rally
install -m 755 $topdir/build/release-linux-$arch/q3rally.$arch $dst/q3rally.$arch
install -m 755 $topdir/build/release-linux-$arch/q3rally-server.$arch $dst/q3rally-server.$arch
install -m 644 $topdir/build/release-linux-$arch/q3rally/*.so $dst/q3rally
tar --owner=root --group=root -C $dst -cf ./image/q3rally.$arch.tar .
rm -rf ./image/tmp
done
### uninstall script
install -m 755 ./preuninstall.sh image/preuninstall.sh
# desktop file handling
install -m 755 ./install-desktop-files.sh image/install-desktop-files.sh
install -m 755 /usr/bin/xdg-desktop-menu image/xdg-desktop-menu
install -m 644 q3rally.desktop image/q3rally.desktop.in
### README, COPYING and EULA
install -m 644 $topdir/README image/README
install -m 644 $topdir/COPYING.txt image/COPYING
mkdir image/q3rally
install -m 644 pak0.pk3 image/q3rally/pak0.pk3
# create setup.xml
m4 defines.m4 setup.xml.in > image/setup.data/setup.xml
### makeself installer
ARCH=
if [ "${#archs[@]}" -eq 1 ]; then
ARCH=.$arch
fi
$MAKESELF/makeself.sh image q3rally-$VERSION-$RELEASE$ARCH.run "q3rally $VERSION-$RELEASE" ./setup.sh