Added installer creation scripts.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@789 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
This directory contains files pertaining to generating self-extracting
|
||||||
|
installer files for unix-like platforms.
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Making a release binary:
|
||||||
|
|
||||||
|
- Build the game in release mode.
|
||||||
|
|
||||||
|
- From the top of the cvs tree, run the following command, but
|
||||||
|
change the actual arguments to suit your needs.
|
||||||
|
The first one is the name of the final executable, the second a
|
||||||
|
space-seperated list of possible content files the installer will look
|
||||||
|
for.
|
||||||
|
|
||||||
|
build/unix_installer/buildinstaller.sh uqm-0.2-linux-dynamic.sh \
|
||||||
|
"content.tgz"
|
||||||
|
|
||||||
Executable
+61
@@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Script for creating self-extracting installer files for unix-like systems.
|
||||||
|
# By Serge van den Boom, 2003-02-20
|
||||||
|
|
||||||
|
TEMPDIR="/tmp/buildinstaller_$$"
|
||||||
|
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
cat >&2 << EOF
|
||||||
|
Usage: buildinstaller.sh <installername> <contentfiles>
|
||||||
|
where 'installername' is the name you want to give the final installer
|
||||||
|
and 'contentfiles' is a space-seperated list of possible content files.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
DESTFILE="$1"
|
||||||
|
CONTENTFILES="$2"
|
||||||
|
|
||||||
|
if [ ! -d src -o ! -d build ]; then
|
||||||
|
cat >&2 << EOF
|
||||||
|
Error: The current directory should be the top of the cvs tree.
|
||||||
|
Please try again from that dir
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f uqm ]; then
|
||||||
|
cat >&2 << EOF
|
||||||
|
Error: There should be an 'uqm' binary in the top of the cvs tree.
|
||||||
|
please recompile and try again.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir "$TEMPDIR" 2> /dev/null
|
||||||
|
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "Could not create temporary dir." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -- "${TEMPDIR}/lib" "${TEMPDIR}/lib/uqm" "${TEMPDIR}/lib/uqm/doc"
|
||||||
|
|
||||||
|
cp -- AUTHORS COPYING ChangeLog WhatsNew README doc/users/manual.txt \
|
||||||
|
"${TEMPDIR}/lib/uqm/doc/"
|
||||||
|
cp -- uqm "${TEMPDIR}/lib/uqm/"
|
||||||
|
chmod -R go+rX "${TEMPDIR}/lib"
|
||||||
|
|
||||||
|
echo "Making tar.gz file for everything except from the content."
|
||||||
|
echo "Using maximum compression; this may take a moment."
|
||||||
|
tar -cf "${TEMPDIR}/libpkg.tar" -C "${TEMPDIR}/lib/" uqm
|
||||||
|
gzip -9 "${TEMPDIR}/libpkg.tar"
|
||||||
|
|
||||||
|
echo "Making final executable."
|
||||||
|
sh build/unix_installer/mkinstall "$DESTFILE" "${TEMPDIR}/libpkg.tar.gz" \
|
||||||
|
"$CONTENTFILES" COPYING
|
||||||
|
|
||||||
|
rm -r -- "$TEMPDIR"
|
||||||
|
|
||||||
|
chmod 755 "$DESTFILE"
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Installation program for binaries.
|
||||||
|
# By Serge van den Boom, 2002-11-26
|
||||||
|
|
||||||
|
CONTENT_FILES="@CONTENT_FILES@"
|
||||||
|
|
||||||
|
quithandler() {
|
||||||
|
echo
|
||||||
|
echo "Bye."
|
||||||
|
trap INT
|
||||||
|
kill -INT $$
|
||||||
|
}
|
||||||
|
|
||||||
|
trap quithandler INT
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
-== The Ur-Quan Masters installation ==-
|
||||||
|
|
||||||
|
Hi, I'm your friendly neighbourhood installation program.
|
||||||
|
I will make you very happy, but first, we've got some business to take care
|
||||||
|
of.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
CONTENT_FILE=""
|
||||||
|
have_content_file() {
|
||||||
|
for FILE in $CONTENT_FILES; do
|
||||||
|
if [ -r "$CONTENT_PATH$FILE" ]; then
|
||||||
|
CONTENT_FILE="$FILE"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
CONTENT_PATH="./"
|
||||||
|
have_content_file
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
cat << EOF
|
||||||
|
I need a content .tgz package and I can't find one in
|
||||||
|
the $CONTENT_PATH dir. I really can't work without it.
|
||||||
|
If you don't have it, please press CTRL-C and quickly get it, before I get
|
||||||
|
swapped out.
|
||||||
|
EOF
|
||||||
|
echo -n "Otherwise, please tell me where you've hidden it: "
|
||||||
|
while :; do
|
||||||
|
read CONTENT_PATH
|
||||||
|
CONTENT_PATH="${CONTENT_PATH%/}/"
|
||||||
|
have_content_file && break
|
||||||
|
echo "There's nothing there, I tell you."
|
||||||
|
echo -n "Guess again: "
|
||||||
|
done
|
||||||
|
echo "Yay! Found it."
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
CONTENT_FILE="$CONTENT_PATH$CONTENT_FILE"
|
||||||
|
|
||||||
|
PAGER="${PAGER:-more}"
|
||||||
|
type "$PAGER" > /dev/null 2>&1
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "I can't find a good pager. I need one. That's all folks."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "I need to show you something. I don't want to, but I have to."
|
||||||
|
echo "Press enter when you're ready."
|
||||||
|
read TEMP
|
||||||
|
|
||||||
|
$PAGER << "EOF"
|
||||||
|
@LICENCE@
|
||||||
|
EOF
|
||||||
|
echo "That's hard reading, isn't it? But it's pretty important stuff. "
|
||||||
|
echo -n "Now, the big question is, do you agree to it? "
|
||||||
|
while :; do
|
||||||
|
read TEMP
|
||||||
|
case "$TEMP" in
|
||||||
|
[yY][eE][sS]|[aA][gG][rR][eE][eE])
|
||||||
|
echo "Good. Now we can be friends."
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
[nN][oO])
|
||||||
|
cat << EOF
|
||||||
|
No? You're sure you didn't mean 'yes'? You do realise I can't let you pass
|
||||||
|
now? Oh well, come back if you change your mind. I'm not going anywhere.
|
||||||
|
I AM not going anywere, right?
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -n "Hmm... Please type 'Yes' or 'No': "
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [ "$(id -u)" -eq "0" ]; then
|
||||||
|
INSTALL_BASE=/usr/local/games/
|
||||||
|
else
|
||||||
|
INSTALL_BASE="$HOME/uqm/"
|
||||||
|
fi
|
||||||
|
echo "I've got a lot of files, and I need somewhere to put them. "
|
||||||
|
echo "My invisible friend tells me $INSTALL_BASE is a good place."
|
||||||
|
echo "I would put an executable there in a bin/ dir and a lot of junk "
|
||||||
|
echo "together in a subdir under lib/"
|
||||||
|
echo -n "But you're the boss, so where shall I put them [$INSTALL_BASE]? "
|
||||||
|
while :; do
|
||||||
|
read TEMP
|
||||||
|
echo
|
||||||
|
if [ "$TEMP" = "/dev/null" ]; then
|
||||||
|
echo "Ok, done. That was quick, wasn't it? Well, have fun."
|
||||||
|
echo
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$TEMP" ]; then
|
||||||
|
TEMP="$INSTALL_BASE"
|
||||||
|
else
|
||||||
|
TEMP="${TEMP%/}/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$TEMP" ]; then
|
||||||
|
cat << EOF
|
||||||
|
There's no such directory. If you want me to stuff it all in /dev/null,
|
||||||
|
just say so. No need to toy with me.
|
||||||
|
Then again, I could create that directory for you.
|
||||||
|
EOF
|
||||||
|
echo -n "Would you like that? "
|
||||||
|
|
||||||
|
read TEMP2
|
||||||
|
echo
|
||||||
|
case "$TEMP2" in
|
||||||
|
y|Y|yes|Yes|YES)
|
||||||
|
mkdir -p "$TEMP" 2> /dev/null
|
||||||
|
if [ "$?" -gt 0 ]; then
|
||||||
|
cat << EOF
|
||||||
|
I cannot do it, captain! I don't have enough power!
|
||||||
|
Erm... I mean 'permission denied'. Sorry about that.
|
||||||
|
I guess we'll need to find another place.
|
||||||
|
EOF
|
||||||
|
echo -n "So what shall it be [$INSTALL_BASE]? "
|
||||||
|
else
|
||||||
|
cat << EOF
|
||||||
|
Ok, I've created that dir for you, even though it isn't in my job
|
||||||
|
description. Now let's get on with the copying.
|
||||||
|
EOF
|
||||||
|
INSTALL_BASE="$TEMP"
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
n|N|no|No|NO)
|
||||||
|
echo "Great! That saves me some work."
|
||||||
|
echo "Then where DO you want me to put my files?"
|
||||||
|
echo "I promise I'll handle them with care."
|
||||||
|
echo -n "[$INSTALL_BASE]? "
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "I'll take that as a 'no'."
|
||||||
|
echo -n "So, where should I put my files [$INSTALL_BASE]? "
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -w "$TEMP" ]; then
|
||||||
|
cat << EOF
|
||||||
|
Ooh, a very fine place indeed. Unfortunately it's not your fine place.
|
||||||
|
You can't write there, and for some strange cosmological coincidence,
|
||||||
|
neither can I. I think we need another place."
|
||||||
|
EOF
|
||||||
|
echo -n "So, what shall it be [$INSTALL_BASE]? "
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
INSTALL_BASE="$TEMP"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
cat << EOF
|
||||||
|
$INSTALL_BASE it is. I can work with that.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
Ok, I'm ready now to start filling your hard drive.
|
||||||
|
It might take some time though, so don't hold your breath.
|
||||||
|
On second thought, DO hold your breath, I like the colour blue.
|
||||||
|
Orange too, for that matter, but I don't think you can manage that.
|
||||||
|
EOF
|
||||||
|
echo -n "Ready? Just say the word. Any word will do: "
|
||||||
|
read TEMP
|
||||||
|
echo "A word as good as any."
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "Making directories..."
|
||||||
|
mkdir -p -- "$INSTALL_BASE"/lib/uqm 2> /dev/null
|
||||||
|
mkdir -p -- "$INSTALL_BASE"/bin 2> /dev/null
|
||||||
|
|
||||||
|
echo "Unpacking content..."
|
||||||
|
tar -xzf "$CONTENT_FILE" -C "$INSTALL_BASE"lib/uqm
|
||||||
|
|
||||||
|
echo "Unpacking other stuff..."
|
||||||
|
tail -c @ATTACHLEN@ < "$0" | tar -xzf - -C "$INSTALL_BASE"lib/
|
||||||
|
|
||||||
|
echo "Creating wrapper script..."
|
||||||
|
cat << EOF > "$INSTALL_BASE"bin/uqm
|
||||||
|
#!/bin/sh
|
||||||
|
# Wrapper script for starting The Ur-Quan Masters
|
||||||
|
"${INSTALL_BASE}lib/uqm/uqm" "--contentdir=${INSTALL_BASE}lib/uqm/content" "\$@"
|
||||||
|
EOF
|
||||||
|
chmod 755 "$INSTALL_BASE"bin/uqm
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
All done. Now you can play The Ur-Quan masters.
|
||||||
|
I told you I was going to make you very happy.
|
||||||
|
And if you're looking for documentation, you can find some in
|
||||||
|
${INSTALL_BASE}lib/uqm/doc/. If you aren't looking for documentation, too.
|
||||||
|
But feel free to delete them. You know where to find them.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Script for creating install.sh from install.sh.in
|
||||||
|
# By Serge van den Boom, 2002-11-26
|
||||||
|
|
||||||
|
if [ $# -ne 4 ]; then
|
||||||
|
echo "Usage: mkinstall <attachment> <contentfiles> <licence>"
|
||||||
|
echo "'attachment' is the .tgz file to attach to the script."
|
||||||
|
echo "contentfiles is a space-seperated list of possible content files."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
OUTFILE="$1"
|
||||||
|
ATTACHMENT="$2"
|
||||||
|
CONTENT_FILES="$3"
|
||||||
|
LICENSE="$4"
|
||||||
|
case "$0" in
|
||||||
|
*/*) EXECDIR="${0%/*}/" ;;
|
||||||
|
*) EXECDIR="" ;;
|
||||||
|
esac
|
||||||
|
INFILE="${EXECDIR}install.sh.in"
|
||||||
|
|
||||||
|
# A slow way, but a reliable way.
|
||||||
|
ATTACHLEN=`wc -c < $ATTACHMENT`
|
||||||
|
|
||||||
|
#ATTACHLEN="$(du -b $ATTACHMENT | cut -f 1)"
|
||||||
|
|
||||||
|
# Very ugly, but I can't get sed to replace a pattern by the contents
|
||||||
|
# of a file.
|
||||||
|
FILEDATA="$(cat $INFILE)"
|
||||||
|
LICENSE_TEXT="$(cat $LICENSE)"
|
||||||
|
sed -e "s/@ATTACHLEN@/$ATTACHLEN/" \
|
||||||
|
-e "s/@CONTENT_FILES@/$CONTENT_FILES/" > "$OUTFILE" << EOF
|
||||||
|
${FILEDATA/@LICENCE@/$LICENSE_TEXT}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#sed -e "s/@ATTACHLEN@/$ATTACHLEN/" \
|
||||||
|
# -e "s/@CONTENT_FILES@/$CONTENT_FILES/" \
|
||||||
|
# -e "s/@LICENSE@/$LICENSE_TEXT/" \
|
||||||
|
# < "$INFILE" > "$OUTFILE"
|
||||||
|
|
||||||
|
cat "$ATTACHMENT" >> "$OUTFILE"
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user