Added new packager for POSIX (e.g. FreeBSD, Linux etc.).
Stéphane Peter's makeself.sh script (http://megastep.org/makeself/) is used to produce the installers/posix/oolite-<version>.x86[_64].run self-extractible package. Packager targets added: * pkg-posix - builds a release self-extracting package * pkg-posix-test - builds a test release self-extracting package * pkg-posix-snapshot - builds a snapshot release self-extracting package git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4492 127b21dd-08f5-0310-b4b7-95ae10353056master
parent
3b5e5cb2e3
commit
b386776e8b
31
Makefile
31
Makefile
|
@ -32,7 +32,7 @@ ifeq ($(GNUSTEP_HOST_OS),mingw32)
|
|||
DEPS_DBG = $(LIBJS_DBG)
|
||||
else
|
||||
# define autopackage .apspec file according to the CPU architecture
|
||||
HOST_ARCH := $(shell echo $(GNUSTEP_HOST_CPU) | sed -e s/i.86/i386/ -e s/amd64/x86_64/ )
|
||||
HOST_ARCH := $(shell echo $(GNUSTEP_HOST_CPU) | sed -e s/i.86/x86/ -e s/amd64/x86_64/ )
|
||||
ifeq ($(HOST_ARCH),x86_64)
|
||||
APSPEC_FILE = installers/autopackage/default.x86_64.apspec
|
||||
else
|
||||
|
@ -114,6 +114,7 @@ distclean: clean
|
|||
ifneq ($(GNUSTEP_HOST_OS),mingw32)
|
||||
$(MAKE) -f libjs.make distclean debug=yes
|
||||
$(MAKE) -f libjs.make distclean debug=no
|
||||
$(RM) -rf AddOns && cd DebugOXP && $(MAKE) clean && cd ..
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
|
@ -133,6 +134,25 @@ deps-remake: clean deps-all
|
|||
pkg-autopackage:
|
||||
makepackage -c -m $(APSPEC_FILE)
|
||||
|
||||
# Here are our POSIX (e.g. FreeBSD, Linux etc.) self-extracted packager targets
|
||||
#
|
||||
# TODO: For debug package the "oolite" startup script should point to "oolite.app/oolite.dbg" binary,
|
||||
# the "uninstall" script should remove the "oolite.dbg" binary and
|
||||
# either not distribute the "oolite-update" scripts or create an Oolite debug repository and
|
||||
# update the "oolite.app/oolite-update" script to synchronize accordingly
|
||||
#
|
||||
# pkg-posix-debug:
|
||||
# installers/posix/make_installer.sh $(HOST_ARCH) $(VERSION) $(SVNREVISION) "debug"
|
||||
#
|
||||
pkg-posix:
|
||||
installers/posix/make_installer.sh $(HOST_ARCH) $(VERSION) $(SVNREVISION) "release-deployment"
|
||||
|
||||
pkg-posix-test:
|
||||
installers/posix/make_installer.sh $(HOST_ARCH) $(VERSION) $(SVNREVISION) "release"
|
||||
|
||||
pkg-posix-snapshot:
|
||||
installers/posix/make_installer.sh $(HOST_ARCH) $(VERSION) $(SVNREVISION) "release-snapshot"
|
||||
|
||||
# Here are our Debian packager targets
|
||||
#
|
||||
.PHONY: debian/changelog
|
||||
|
@ -202,7 +222,7 @@ help:
|
|||
@echo " clean - removes all generated files"
|
||||
@echo
|
||||
@echo "Packaging Targets:"
|
||||
@echo " Linux:"
|
||||
@echo " Linux (debian):"
|
||||
@echo " pkg-autopackage - builds a Linux autopackage"
|
||||
@echo
|
||||
@echo " pkg-deb - builds a release Debian package"
|
||||
|
@ -210,6 +230,13 @@ help:
|
|||
@echo " pkg-debsnapshot - builds a snapshot release Debian package"
|
||||
@echo " pkg-debclean - cleans up after a Debian package build"
|
||||
@echo
|
||||
@echo " POSIX (e.g. FreeBSD, Linux etc.):"
|
||||
@echo " pkg-autopackage - builds a Linux autopackage"
|
||||
@echo
|
||||
@echo " pkg-posix - builds a release self-extracting package"
|
||||
@echo " pkg-posix-test - builds a test release self-extracting package"
|
||||
@echo " pkg-posix-snapshot - builds a snapshot release self-extracting package"
|
||||
@echo
|
||||
@echo " Windows Installer:"
|
||||
@echo " pkg-win - builds a test-release version"
|
||||
@echo " pkg-win-deployment - builds a release version"
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
#
|
||||
# Original by Konstantinos Sykas <ksykas@gmail.com> (26-Mar-2011)
|
||||
#
|
||||
# Type: shell script
|
||||
# Description: Wrapper script for "makeself.sh". Prepares a clean build and
|
||||
# generates the tarballs (e.g. docs, icons, libraries) to be
|
||||
# packaged by "makeself.sh".
|
||||
#
|
||||
|
||||
|
||||
make_rc=0
|
||||
build_mode=$4
|
||||
if [ "$build_mode" = "release-deployment" ]
|
||||
then
|
||||
make -f Makefile distclean # force libraries clean build
|
||||
else
|
||||
make -f Makefile clean
|
||||
fi
|
||||
make -f Makefile deps-$build_mode
|
||||
make_rc=$?
|
||||
if [ $make_rc -ne 0 ]
|
||||
then
|
||||
exit $make_rc
|
||||
fi
|
||||
|
||||
cpu_architecture=x86
|
||||
if [ "$1" = "x86_64" ]; then
|
||||
cpu_architecture=x86_64
|
||||
fi
|
||||
oolite_version=$2
|
||||
oolite_version_extended=${oolite_version}"."$3
|
||||
oolite_app=oolite.app
|
||||
setup_root=${oolite_app}/oolite.installer.tmp
|
||||
|
||||
|
||||
echo
|
||||
echo "Starting \"makeself\" packager..."
|
||||
mkdir -p ${setup_root}
|
||||
|
||||
echo "Generating version info..."
|
||||
echo ${oolite_version_extended} > ${setup_root}/release.txt
|
||||
|
||||
if [ "$build_mode" != "release-deployment" ]
|
||||
then
|
||||
echo "Packing AddOns..."
|
||||
tar zcf ${setup_root}/addons.tar.gz AddOns/ --exclude .svn
|
||||
fi
|
||||
|
||||
echo "Packing desktop menu files..."
|
||||
cd installers/
|
||||
tar zcf ../${setup_root}/freedesktop.tar.gz FreeDesktop/ --exclude .svn
|
||||
|
||||
echo "Packing $cpu_architecture architecture library dependencies..."
|
||||
cd ../deps/Linux-deps/${cpu_architecture}/
|
||||
tar zcf ../../../${setup_root}/oolite.deps.tar.gz lib/ --exclude .svn
|
||||
|
||||
echo "Packing documentation..."
|
||||
cd ../../../Doc/
|
||||
tar cf ../${setup_root}/oolite.doc.tar AdviceForNewCommanders.pdf OoliteReadMe.pdf OoliteRS.pdf CHANGELOG.TXT
|
||||
cd ../deps/Linux-deps/
|
||||
tar rf ../../${setup_root}/oolite.doc.tar README.TXT
|
||||
gzip ../../${setup_root}/oolite.doc.tar
|
||||
|
||||
echo "Packing wrapper scripts and startup README..."
|
||||
tar zcf ../../${setup_root}/oolite.wrap.tar.gz oolite.src oolite-update.src
|
||||
|
||||
echo "Packing GNUstep DTDs..."
|
||||
cd ../Cross-platform-deps/
|
||||
tar zcf ../../${setup_root}/oolite.dtd.tar.gz DTDs --exclude .svn
|
||||
|
||||
echo "Copying setup script..."
|
||||
cd ../../installers/posix/
|
||||
cp -p setup ../../${oolite_app}/.
|
||||
cp -p uninstall.source ../../${oolite_app}/.
|
||||
|
||||
|
||||
echo
|
||||
./makeself.sh ../../${oolite_app} oolite-${oolite_version}.${cpu_architecture}.run "Oolite ${oolite_version} " ./setup $oolite_version
|
||||
ms_rc=$?
|
||||
if [ $ms_rc -eq 0 ]
|
||||
then
|
||||
echo "It is located in the \"installers/posix/\" folder."
|
||||
fi
|
||||
|
||||
exit $ms_rc
|
|
@ -0,0 +1,401 @@
|
|||
cat << EOF > "$archname"
|
||||
#!/bin/sh
|
||||
# This script was generated using Makeself $MS_VERSION
|
||||
|
||||
CRCsum="$CRCsum"
|
||||
MD5="$MD5sum"
|
||||
TMPROOT=\${TMPDIR:=/tmp}
|
||||
|
||||
label="$LABEL"
|
||||
script="$SCRIPT"
|
||||
scriptargs="$SCRIPTARGS"
|
||||
targetdir="$archdirname"
|
||||
filesizes="$filesizes"
|
||||
keep=$KEEP
|
||||
|
||||
print_cmd_arg=""
|
||||
if type printf > /dev/null; then
|
||||
print_cmd="printf"
|
||||
elif test -x /usr/ucb/echo; then
|
||||
print_cmd="/usr/ucb/echo"
|
||||
else
|
||||
print_cmd="echo"
|
||||
fi
|
||||
|
||||
unset CDPATH
|
||||
|
||||
MS_Printf()
|
||||
{
|
||||
\$print_cmd \$print_cmd_arg "\$1"
|
||||
}
|
||||
|
||||
MS_Progress()
|
||||
{
|
||||
while read a; do
|
||||
MS_Printf .
|
||||
done
|
||||
}
|
||||
|
||||
MS_diskspace()
|
||||
{
|
||||
(
|
||||
if test -d /usr/xpg4/bin; then
|
||||
PATH=/usr/xpg4/bin:\$PATH
|
||||
fi
|
||||
df -kP "\$1" | tail -1 | awk '{print \$4}'
|
||||
)
|
||||
}
|
||||
|
||||
MS_dd()
|
||||
{
|
||||
blocks=\`expr \$3 / 1024\`
|
||||
bytes=\`expr \$3 % 1024\`
|
||||
dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\
|
||||
{ test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks ; \\
|
||||
test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null
|
||||
}
|
||||
|
||||
MS_Help()
|
||||
{
|
||||
cat << EOH >&2
|
||||
Makeself version $MS_VERSION
|
||||
1) Getting help or info about \$0 :
|
||||
\$0 --help Print this message
|
||||
\$0 --info Print embedded info : title, default target directory, embedded script ...
|
||||
\$0 --lsm Print embedded lsm entry (or no LSM)
|
||||
\$0 --list Print the list of files in the archive
|
||||
\$0 --check Checks integrity of the archive
|
||||
|
||||
2) Running \$0 :
|
||||
\$0 [options] [--] [additional arguments to embedded script]
|
||||
with following options (in that order)
|
||||
--confirm Ask before running embedded script
|
||||
--noexec Do not run embedded script
|
||||
--keep Do not erase target directory after running
|
||||
the embedded script
|
||||
--nox11 Do not spawn an xterm
|
||||
--nochown Do not give the extracted files to the current user
|
||||
--target NewDirectory Extract in NewDirectory
|
||||
--tar arg1 [arg2 ...] Access the contents of the archive through the tar command
|
||||
-- Following arguments will be passed to the embedded script
|
||||
EOH
|
||||
}
|
||||
|
||||
MS_Check()
|
||||
{
|
||||
OLD_PATH="\$PATH"
|
||||
PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"}
|
||||
MD5_ARG=""
|
||||
MD5_PATH=\`exec <&- 2>&-; which md5sum || type md5sum\`
|
||||
test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which md5 || type md5\`
|
||||
test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which digest || type digest\`
|
||||
PATH="\$OLD_PATH"
|
||||
|
||||
MS_Printf "Verifying archive integrity..."
|
||||
offset=\`head -n $SKIP "\$1" | wc -c | tr -d " "\`
|
||||
verb=\$2
|
||||
i=1
|
||||
for s in \$filesizes
|
||||
do
|
||||
crc=\`echo \$CRCsum | cut -d" " -f\$i\`
|
||||
if test -x "\$MD5_PATH"; then
|
||||
if test \`basename \$MD5_PATH\` = digest; then
|
||||
MD5_ARG="-a md5"
|
||||
fi
|
||||
md5=\`echo \$MD5 | cut -d" " -f\$i\`
|
||||
if test \$md5 = "00000000000000000000000000000000"; then
|
||||
test x\$verb = xy && echo " \$1 does not contain an embedded MD5 checksum." >&2
|
||||
else
|
||||
md5sum=\`MS_dd "\$1" \$offset \$s | eval "\$MD5_PATH \$MD5_ARG" | cut -b-32\`;
|
||||
if test "\$md5sum" != "\$md5"; then
|
||||
echo "Error in MD5 checksums: \$md5sum is different from \$md5" >&2
|
||||
exit 2
|
||||
else
|
||||
test x\$verb = xy && MS_Printf " MD5 checksums are OK." >&2
|
||||
fi
|
||||
crc="0000000000"; verb=n
|
||||
fi
|
||||
fi
|
||||
if test \$crc = "0000000000"; then
|
||||
test x\$verb = xy && echo " \$1 does not contain a CRC checksum." >&2
|
||||
else
|
||||
sum1=\`MS_dd "\$1" \$offset \$s | CMD_ENV=xpg4 cksum | awk '{print \$1}'\`
|
||||
if test "\$sum1" = "\$crc"; then
|
||||
test x\$verb = xy && MS_Printf " CRC checksums are OK." >&2
|
||||
else
|
||||
echo "Error in checksums: \$sum1 is different from \$crc"
|
||||
exit 2;
|
||||
fi
|
||||
fi
|
||||
i=\`expr \$i + 1\`
|
||||
offset=\`expr \$offset + \$s\`
|
||||
done
|
||||
echo " All good."
|
||||
}
|
||||
|
||||
UnTAR()
|
||||
{
|
||||
tar \$1vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; }
|
||||
}
|
||||
|
||||
finish=true
|
||||
xterm_loop=
|
||||
nox11=$NOX11
|
||||
copy=$COPY
|
||||
ownership=y
|
||||
verbose=n
|
||||
|
||||
initargs="\$@"
|
||||
|
||||
while true
|
||||
do
|
||||
case "\$1" in
|
||||
-h | --help)
|
||||
MS_Help
|
||||
exit 0
|
||||
;;
|
||||
--info)
|
||||
echo Identification: "\$label"
|
||||
echo Target directory: "\$targetdir"
|
||||
echo Uncompressed size: $USIZE KB
|
||||
echo Compression: $COMPRESS
|
||||
echo Date of packaging: $DATE
|
||||
echo Built with Makeself version $MS_VERSION on $OSTYPE
|
||||
echo Build command was: "$MS_COMMAND"
|
||||
if test x\$script != x; then
|
||||
echo Script run after extraction:
|
||||
echo " " \$script \$scriptargs
|
||||
fi
|
||||
if test x"$copy" = xcopy; then
|
||||
echo "Archive will copy itself to a temporary location"
|
||||
fi
|
||||
if test x"$KEEP" = xy; then
|
||||
echo "directory \$targetdir is permanent"
|
||||
else
|
||||
echo "\$targetdir will be removed after extraction"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
--dumpconf)
|
||||
echo LABEL=\"\$label\"
|
||||
echo SCRIPT=\"\$script\"
|
||||
echo SCRIPTARGS=\"\$scriptargs\"
|
||||
echo archdirname=\"$archdirname\"
|
||||
echo KEEP=$KEEP
|
||||
echo COMPRESS=$COMPRESS
|
||||
echo filesizes=\"\$filesizes\"
|
||||
echo CRCsum=\"\$CRCsum\"
|
||||
echo MD5sum=\"\$MD5\"
|
||||
echo OLDUSIZE=$USIZE
|
||||
echo OLDSKIP=`expr $SKIP + 1`
|
||||
exit 0
|
||||
;;
|
||||
--lsm)
|
||||
cat << EOLSM
|
||||
EOF
|
||||
eval "$LSM_CMD"
|
||||
cat << EOF >> "$archname"
|
||||
EOLSM
|
||||
exit 0
|
||||
;;
|
||||
--list)
|
||||
echo Target directory: \$targetdir
|
||||
offset=\`head -n $SKIP "\$0" | wc -c | tr -d " "\`
|
||||
for s in \$filesizes
|
||||
do
|
||||
MS_dd "\$0" \$offset \$s | eval "$GUNZIP_CMD" | UnTAR t
|
||||
offset=\`expr \$offset + \$s\`
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
--tar)
|
||||
offset=\`head -n $SKIP "\$0" | wc -c | tr -d " "\`
|
||||
arg1="\$2"
|
||||
shift 2
|
||||
for s in \$filesizes
|
||||
do
|
||||
MS_dd "\$0" \$offset \$s | eval "$GUNZIP_CMD" | tar "\$arg1" - \$*
|
||||
offset=\`expr \$offset + \$s\`
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
--check)
|
||||
MS_Check "\$0" y
|
||||
exit 0
|
||||
;;
|
||||
--confirm)
|
||||
verbose=y
|
||||
shift
|
||||
;;
|
||||
--noexec)
|
||||
script=""
|
||||
shift
|
||||
;;
|
||||
--keep)
|
||||
keep=y
|
||||
shift
|
||||
;;
|
||||
--target)
|
||||
keep=y
|
||||
targetdir=\${2:-.}
|
||||
shift 2
|
||||
;;
|
||||
--nox11)
|
||||
nox11=y
|
||||
shift
|
||||
;;
|
||||
--nochown)
|
||||
ownership=n
|
||||
shift
|
||||
;;
|
||||
--xwin)
|
||||
finish="echo Press Return to close this window...; read junk"
|
||||
xterm_loop=1
|
||||
shift
|
||||
;;
|
||||
--phase2)
|
||||
copy=phase2
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break ;;
|
||||
-*)
|
||||
echo Unrecognized flag : "\$1" >&2
|
||||
MS_Help
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "\$copy" in
|
||||
copy)
|
||||
tmpdir=\$TMPROOT/makeself.\$RANDOM.\`date +"%y%m%d%H%M%S"\`.\$\$
|
||||
mkdir "\$tmpdir" || {
|
||||
echo "Could not create temporary directory \$tmpdir" >&2
|
||||
exit 1
|
||||
}
|
||||
SCRIPT_COPY="\$tmpdir/makeself"
|
||||
echo "Copying to a temporary location..." >&2
|
||||
cp "\$0" "\$SCRIPT_COPY"
|
||||
chmod +x "\$SCRIPT_COPY"
|
||||
cd "\$TMPROOT"
|
||||
exec "\$SCRIPT_COPY" --phase2 -- \$initargs
|
||||
;;
|
||||
phase2)
|
||||
finish="\$finish ; rm -rf \`dirname \$0\`"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "\$nox11" = "n"; then
|
||||
if tty -s; then # Do we have a terminal?
|
||||
:
|
||||
else
|
||||
if test x"\$DISPLAY" != x -a x"\$xterm_loop" = x; then # No, but do we have X?
|
||||
if xset q > /dev/null 2>&1; then # Check for valid DISPLAY variable
|
||||
GUESS_XTERMS="xterm rxvt dtterm eterm Eterm kvt konsole aterm"
|
||||
for a in \$GUESS_XTERMS; do
|
||||
if type \$a >/dev/null 2>&1; then
|
||||
XTERM=\$a
|
||||
break
|
||||
fi
|
||||
done
|
||||
chmod a+x \$0 || echo Please add execution rights on \$0
|
||||
if test \`echo "\$0" | cut -c1\` = "/"; then # Spawn a terminal!
|
||||
exec \$XTERM -title "\$label" -e "\$0" --xwin "\$initargs"
|
||||
else
|
||||
exec \$XTERM -title "\$label" -e "./\$0" --xwin "\$initargs"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "\$targetdir" = "."; then
|
||||
tmpdir="."
|
||||
else
|
||||
if test "\$keep" = y; then
|
||||
echo "Creating directory \$targetdir" >&2
|
||||
tmpdir="\$targetdir"
|
||||
dashp="-p"
|
||||
else
|
||||
tmpdir="\$TMPROOT/selfgz\$\$\$RANDOM"
|
||||
dashp=""
|
||||
fi
|
||||
mkdir \$dashp \$tmpdir || {
|
||||
echo 'Cannot create target directory' \$tmpdir >&2
|
||||
echo 'You should try option --target OtherDirectory' >&2
|
||||
eval \$finish
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
location="\`pwd\`"
|
||||
if test x\$SETUP_NOCHECK != x1; then
|
||||
MS_Check "\$0"
|
||||
fi
|
||||
offset=\`head -n $SKIP "\$0" | wc -c | tr -d " "\`
|
||||
|
||||
if test x"\$verbose" = xy; then
|
||||
MS_Printf "About to extract $USIZE KB in \$tmpdir ... Proceed ? [Y/n] "
|
||||
read yn
|
||||
if test x"\$yn" = xn; then
|
||||
eval \$finish; exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MS_Printf "Uncompressing \$label"
|
||||
res=3
|
||||
if test "\$keep" = n; then
|
||||
trap 'echo Signal caught, cleaning up >&2; cd \$TMPROOT; /bin/rm -rf \$tmpdir; eval \$finish; exit 15' 1 2 3 15
|
||||
fi
|
||||
|
||||
leftspace=\`MS_diskspace \$tmpdir\`
|
||||
if test \$leftspace -lt $USIZE; then
|
||||
echo
|
||||
echo "Not enough space left in "\`dirname \$tmpdir\`" (\$leftspace KB) to decompress \$0 ($USIZE KB)" >&2
|
||||
if test "\$keep" = n; then
|
||||
echo "Consider setting TMPDIR to a directory with more free space."
|
||||
fi
|
||||
eval \$finish; exit 1
|
||||
fi
|
||||
|
||||
for s in \$filesizes
|
||||
do
|
||||
if MS_dd "\$0" \$offset \$s | eval "$GUNZIP_CMD" | ( cd "\$tmpdir"; UnTAR x ) | MS_Progress; then
|
||||
if test x"\$ownership" = xy; then
|
||||
(PATH=/usr/xpg4/bin:\$PATH; cd "\$tmpdir"; chown -R \`id -u\` .; chgrp -R \`id -g\` .)
|
||||
fi
|
||||
else
|
||||
echo
|
||||
echo "Unable to decompress \$0" >&2
|
||||
eval \$finish; exit 1
|
||||
fi
|
||||
offset=\`expr \$offset + \$s\`
|
||||
done
|
||||
echo
|
||||
|
||||
cd "\$tmpdir"
|
||||
res=0
|
||||
if test x"\$script" != x; then
|
||||
if test x"\$verbose" = xy; then
|
||||
MS_Printf "OK to execute: \$script \$scriptargs \$* ? [Y/n] "
|
||||
read yn
|
||||
if test x"\$yn" = x -o x"\$yn" = xy -o x"\$yn" = xY; then
|
||||
eval \$script \$scriptargs \$*; res=\$?;
|
||||
fi
|
||||
else
|
||||
eval \$script \$scriptargs \$*; res=\$?
|
||||
fi
|
||||
if test \$res -ne 0; then
|
||||
test x"\$verbose" = xy && echo "The program '\$script' returned an error code (\$res)" >&2
|
||||
fi
|
||||
fi
|
||||
if test "\$keep" = n; then
|
||||
cd \$TMPROOT
|
||||
/bin/rm -rf \$tmpdir
|
||||
fi
|
||||
eval \$finish; exit \$res
|
||||
EOF
|
|
@ -0,0 +1,426 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Makeself version 2.1.x
|
||||
# by Stephane Peter <megastep@megastep.org>
|
||||
#
|
||||
# $Id: makeself.sh,v 1.64 2008/01/04 23:52:14 megastep Exp $
|
||||
#
|
||||
# Utility to create self-extracting tar.gz archives.
|
||||
# The resulting archive is a file holding the tar.gz archive with
|
||||
# a small Shell script stub that uncompresses the archive to a temporary
|
||||
# directory and then executes a given script from withing that directory.
|
||||
#
|
||||
# Makeself home page: http://www.megastep.org/makeself/
|
||||
#
|
||||
# Version 2.0 is a rewrite of version 1.0 to make the code easier to read and maintain.
|
||||
#
|
||||
# Version history :
|
||||
# - 1.0 : Initial public release
|
||||
# - 1.1 : The archive can be passed parameters that will be passed on to
|
||||
# the embedded script, thanks to John C. Quillan
|
||||
# - 1.2 : Package distribution, bzip2 compression, more command line options,
|
||||
# support for non-temporary archives. Ideas thanks to Francois Petitjean
|
||||
# - 1.3 : More patches from Bjarni R. Einarsson and Francois Petitjean:
|
||||
# Support for no compression (--nocomp), script is no longer mandatory,
|
||||
# automatic launch in an xterm, optional verbose output, and -target
|
||||
# archive option to indicate where to extract the files.
|
||||
# - 1.4 : Improved UNIX compatibility (Francois Petitjean)
|
||||
# Automatic integrity checking, support of LSM files (Francois Petitjean)
|
||||
# - 1.5 : Many bugfixes. Optionally disable xterm spawning.
|
||||
# - 1.5.1 : More bugfixes, added archive options -list and -check.
|
||||
# - 1.5.2 : Cosmetic changes to inform the user of what's going on with big
|
||||
# archives (Quake III demo)
|
||||
# - 1.5.3 : Check for validity of the DISPLAY variable before launching an xterm.
|
||||
# More verbosity in xterms and check for embedded command's return value.
|
||||
# Bugfix for Debian 2.0 systems that have a different "print" command.
|
||||
# - 1.5.4 : Many bugfixes. Print out a message if the extraction failed.
|
||||
# - 1.5.5 : More bugfixes. Added support for SETUP_NOCHECK environment variable to
|
||||
# bypass checksum verification of archives.
|
||||
# - 1.6.0 : Compute MD5 checksums with the md5sum command (patch from Ryan Gordon)
|
||||
# - 2.0 : Brand new rewrite, cleaner architecture, separated header and UNIX ports.
|
||||
# - 2.0.1 : Added --copy
|
||||
# - 2.1.0 : Allow multiple tarballs to be stored in one archive, and incremental updates.
|
||||
# Added --nochown for archives
|
||||
# Stopped doing redundant checksums when not necesary
|
||||
# - 2.1.1 : Work around insane behavior from certain Linux distros with no 'uncompress' command
|
||||
# Cleaned up the code to handle error codes from compress. Simplified the extraction code.
|
||||
# - 2.1.2 : Some bug fixes. Use head -n to avoid problems.
|
||||
# - 2.1.3 : Bug fixes with command line when spawning terminals.
|
||||
# Added --tar for archives, allowing to give arbitrary arguments to tar on the contents of the archive.
|
||||
# Added --noexec to prevent execution of embedded scripts.
|
||||
# Added --nomd5 and --nocrc to avoid creating checksums in archives.
|
||||
# Added command used to create the archive in --info output.
|
||||
# Run the embedded script through eval.
|
||||
# - 2.1.4 : Fixed --info output.
|
||||
# Generate random directory name when extracting files to . to avoid problems. (Jason Trent)
|
||||
# Better handling of errors with wrong permissions for the directory containing the files. (Jason Trent)
|
||||
# Avoid some race conditions (Ludwig Nussel)
|
||||
# Unset the $CDPATH variable to avoid problems if it is set. (Debian)
|
||||
# Better handling of dot files in the archive directory.
|
||||
# - 2.1.5 : Made the md5sum detection consistent with the header code.
|
||||
# Check for the presence of the archive directory
|
||||
# Added --encrypt for symmetric encryption through gpg (Eric Windisch)
|
||||
# Added support for the digest command on Solaris 10 for MD5 checksums
|
||||
# Check for available disk space before extracting to the target directory (Andreas Schweitzer)
|
||||
# Allow extraction to run asynchronously (patch by Peter Hatch)
|
||||
# Use file descriptors internally to avoid error messages (patch by Kay Tiong Khoo)
|
||||
#
|
||||
# (C) 1998-2008 by Stéphane Peter <megastep@megastep.org>
|
||||
#
|
||||
# This software is released under the terms of the GNU GPL version 2 and above
|
||||
# Please read the license at http://www.gnu.org/copyleft/gpl.html
|
||||
#
|
||||
#
|
||||
# Konstantinos Sykas <ksykas@gmail.com> (26-Mar-2011): Altered TAR arguments (lines 137 and 353) for Oolite purposes.
|
||||
#
|
||||
|
||||
MS_VERSION=2.1.5
|
||||
MS_COMMAND="$0"
|
||||
unset CDPATH
|
||||
|
||||
for f in "${1+"$@"}"; do
|
||||
MS_COMMAND="$MS_COMMAND \\\\
|
||||
\\\"$f\\\""
|
||||
done
|
||||
|
||||
# Procedures
|
||||
|
||||
MS_Usage()
|
||||
{
|
||||
echo "Usage: $0 [params] archive_dir file_name label [startup_script] [args]"
|
||||
echo "params can be one or more of the following :"
|
||||
echo " --version | -v : Print out Makeself version number and exit"
|
||||
echo " --help | -h : Print out this help message"
|
||||
echo " --gzip : Compress using gzip (default if detected)"
|
||||
echo " --bzip2 : Compress using bzip2 instead of gzip"
|
||||
echo " --compress : Compress using the UNIX 'compress' command"
|
||||
echo " --nocomp : Do not compress the data"
|
||||
echo " --notemp : The archive will create archive_dir in the"
|
||||
echo " current directory and uncompress in ./archive_dir"
|
||||
echo " --copy : Upon extraction, the archive will first copy itself to"
|
||||
echo " a temporary directory"
|
||||
echo " --append : Append more files to an existing Makeself archive"
|
||||
echo " The label and startup scripts will then be ignored"
|
||||
echo " --current : Files will be extracted to the current directory."
|
||||
echo " Implies --notemp."
|
||||
echo " --nomd5 : Don't calculate an MD5 for archive"
|
||||
echo " --nocrc : Don't calculate a CRC for archive"
|
||||
echo " --header file : Specify location of the header script"
|
||||
echo " --follow : Follow the symlinks in the archive"
|
||||
echo " --nox11 : Disable automatic spawn of a xterm"
|
||||
echo " --nowait : Do not wait for user input after executing embedded"
|
||||
echo " program from an xterm"
|
||||
echo " --lsm file : LSM file describing the package"
|
||||
echo
|
||||
echo "Do not forget to give a fully qualified startup script name"
|
||||
echo "(i.e. with a ./ prefix if inside the archive)."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Default settings
|
||||
if type gzip 2>&1 > /dev/null; then
|
||||
COMPRESS=gzip
|
||||
else
|
||||
COMPRESS=Unix
|
||||
fi
|
||||
KEEP=n
|
||||
CURRENT=n
|
||||
NOX11=n
|
||||
APPEND=n
|
||||
COPY=none
|
||||
#
|
||||
# Konstantinos Sykas <ksykas@gmail.com> (26-Mar-2011): Altered for Oolite packaging purposes. TAR not to verbosely list files processed.
|
||||
#
|
||||
# original source:
|
||||
# TAR_ARGS=cvf
|
||||
#
|
||||
TAR_ARGS=cf
|
||||
HEADER=`dirname $0`/makeself-header.sh
|
||||
|
||||
# LSM file stuff
|
||||
LSM_CMD="echo No LSM. >> \"\$archname\""
|
||||
|
||||
while true
|
||||
do
|
||||
case "$1" in
|
||||
--version | -v)
|
||||
echo Makeself version $MS_VERSION
|
||||
exit 0
|
||||
;;
|
||||
--bzip2)
|
||||
COMPRESS=bzip2
|
||||
shift
|
||||
;;
|
||||
--gzip)
|
||||
COMPRESS=gzip
|
||||
shift
|
||||
;;
|
||||
--compress)
|
||||
COMPRESS=Unix
|
||||
shift
|
||||
;;
|
||||
--encrypt)
|
||||
COMPRESS=gpg
|
||||
shift
|
||||
;;
|
||||
--nocomp)
|
||||
COMPRESS=none
|
||||
shift
|
||||
;;
|
||||
--notemp)
|
||||
KEEP=y
|
||||
shift
|
||||
;;
|
||||
--copy)
|
||||
COPY=copy
|
||||
shift
|
||||
;;
|
||||
--current)
|
||||
CURRENT=y
|
||||
KEEP=y
|
||||
shift
|
||||
;;
|
||||
--header)
|
||||
HEADER="$2"
|
||||
shift 2
|
||||
;;
|
||||
--follow)
|
||||
TAR_ARGS=cvfh
|
||||
shift
|
||||
;;
|
||||
--nox11)
|
||||
NOX11=y
|
||||
shift
|
||||
;;
|
||||
--nowait)
|
||||
shift
|
||||
;;
|
||||
--nomd5)
|
||||
NOMD5=y
|
||||
shift
|
||||
;;
|
||||
--nocrc)
|
||||
NOCRC=y
|
||||
shift
|
||||
;;
|
||||
--append)
|
||||
APPEND=y
|
||||
shift
|
||||
;;
|
||||
--lsm)
|
||||
LSM_CMD="cat \"$2\" >> \"\$archname\""
|
||||
shift 2
|
||||
;;
|
||||
-h | --help)
|
||||
MS_Usage
|
||||
;;
|
||||
-*)
|
||||
echo Unrecognized flag : "$1"
|
||||
MS_Usage
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test $# -lt 1; then
|
||||
MS_Usage
|
||||
else
|
||||
if test -d "$1"; then
|
||||
archdir="$1"
|
||||
else
|
||||
echo "Directory $1 does not exist."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
archname="$2"
|
||||
|
||||
if test "$APPEND" = y; then
|
||||
if test $# -lt 2; then
|
||||
MS_Usage
|
||||
fi
|
||||
|
||||
# Gather the info from the original archive
|
||||
OLDENV=`sh "$archname" --dumpconf`
|
||||
if test $? -ne 0; then
|
||||
echo "Unable to update archive: $archname" >&2
|
||||
exit 1
|
||||
else
|
||||
eval "$OLDENV"
|
||||
fi
|
||||
else
|
||||
if test "$KEEP" = n -a $# = 3; then
|
||||
echo "ERROR: Making a temporary archive with no embedded command does not make sense!" >&2
|
||||
echo
|
||||
MS_Usage
|
||||
fi
|
||||
# We don't really want to create an absolute directory...
|
||||
if test "$CURRENT" = y; then
|
||||
archdirname="."
|
||||
else
|
||||
archdirname=`basename "$1"`
|
||||
fi
|
||||
|
||||
if test $# -lt 3; then
|
||||
MS_Usage
|
||||
fi
|
||||
|
||||
LABEL="$3"
|
||||
SCRIPT="$4"
|
||||
test x$SCRIPT = x || shift 1
|
||||
shift 3
|
||||
SCRIPTARGS="$*"
|
||||
fi
|
||||
|
||||
if test "$KEEP" = n -a "$CURRENT" = y; then
|
||||
echo "ERROR: It is A VERY DANGEROUS IDEA to try to combine --notemp and --current." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $COMPRESS in
|
||||
gzip)
|
||||
GZIP_CMD="gzip -c9"
|
||||
GUNZIP_CMD="gzip -cd"
|
||||
;;
|
||||
bzip2)
|
||||
GZIP_CMD="bzip2 -9"
|
||||
GUNZIP_CMD="bzip2 -d"
|
||||
;;
|
||||
gpg)
|
||||
GZIP_CMD="gpg -ac -z9"
|
||||
GUNZIP_CMD="gpg -d"
|
||||
;;
|
||||
Unix)
|
||||
GZIP_CMD="compress -cf"
|
||||
GUNZIP_CMD="exec 2>&-; uncompress -c || test \\\$? -eq 2 || gzip -cd"
|
||||
;;
|
||||
none)
|
||||
GZIP_CMD="cat"
|
||||
GUNZIP_CMD="cat"
|
||||
;;
|
||||
esac
|
||||
|
||||
tmpfile="${TMPDIR:=/tmp}/mkself$$"
|
||||
|
||||
if test -f $HEADER; then
|
||||
oldarchname="$archname"
|
||||
archname="$tmpfile"
|
||||
# Generate a fake header to count its lines
|
||||
SKIP=0
|
||||
. $HEADER
|
||||
SKIP=`cat "$tmpfile" |wc -l`
|
||||
# Get rid of any spaces
|
||||
SKIP=`expr $SKIP`
|
||||
rm -f "$tmpfile"
|
||||
echo Header is $SKIP lines long >&2
|
||||
|
||||
archname="$oldarchname"
|
||||
else
|
||||
echo "Unable to open header file: $HEADER" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
if test "$APPEND" = n; then
|
||||
if test -f "$archname"; then
|
||||
echo "WARNING: Overwriting existing file: $archname" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
USIZE=`du -ks $archdir | cut -f1`
|
||||
DATE=`LC_ALL=C date`
|
||||
|
||||
if test "." = "$archdirname"; then
|
||||
if test "$KEEP" = n; then
|
||||
archdirname="makeself-$$-`date +%Y%m%d%H%M%S`"
|
||||
fi
|
||||
fi
|
||||
|
||||
test -d "$archdir" || { echo "Error: $archdir does not exist."; rm -f "$tmpfile"; exit 1; }
|
||||
echo About to compress $USIZE KB of data...
|
||||
echo Adding files to archive named \"$archname\"...
|
||||
exec 3<> "$tmpfile"
|
||||
#
|
||||
# Konstantinos Sykas <ksykas@gmail.com> (26-Mar-2011): Altered for Oolite packaging purposes. TAR is excluding subversion files.
|
||||
#
|
||||
# original source:
|
||||
# (cd "$archdir" && ( tar $TAR_ARGS - . | eval "$GZIP_CMD" >&3 ) ) || { echo Aborting: Archive
|
||||
# directory
|
||||
# not found or temporary file: "$tmpfile" could not be created.; exec 3>&-; rm -f "$tmpfile"; exit 1; }
|
||||
#
|
||||
(cd "$archdir" && ( tar $TAR_ARGS - . --exclude .svn | eval "$GZIP_CMD" >&3 ) ) || { echo Aborting: Archive
|
||||
directory
|
||||
not found or temporary file: "$tmpfile" could not be created.; exec 3>&-; rm -f "$tmpfile"; exit 1; }
|
||||
exec 3>&- # try to close the archive
|
||||
|
||||
fsize=`cat "$tmpfile" | wc -c | tr -d " "`
|
||||
|
||||
# Compute the checksums
|
||||
|
||||
md5sum=00000000000000000000000000000000
|
||||
crcsum=0000000000
|
||||
|
||||
if test "$NOCRC" = y; then
|
||||
echo "skipping crc at user request"
|
||||
else
|
||||
crcsum=`cat "$tmpfile" | CMD_ENV=xpg4 cksum | sed -e 's/ /Z/' -e 's/ /Z/' | cut -dZ -f1`
|
||||
echo "CRC: $crcsum"
|
||||
fi
|
||||
|
||||
if test "$NOMD5" = y; then
|
||||
echo "skipping md5sum at user request"
|
||||
else
|
||||
# Try to locate a MD5 binary
|
||||
OLD_PATH=$PATH
|
||||
PATH=${GUESS_MD5_PATH:-"$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"}
|
||||
MD5_ARG=""
|
||||
MD5_PATH=`exec <&- 2>&-; which md5sum || type md5sum`
|
||||
test -x $MD5_PATH || MD5_PATH=`exec <&- 2>&-; which md5 || type md5`
|
||||
test -x $MD5_PATH || MD5_PATH=`exec <&- 2>&-; which digest || type digest`
|
||||
PATH=$OLD_PATH
|
||||
if test `basename $MD5_PATH` = digest; then
|
||||
MD5_ARG="-a md5"
|
||||
fi
|
||||
if test -x "$MD5_PATH"; then
|
||||
md5sum=`cat "$tmpfile" | eval "$MD5_PATH $MD5_ARG" | cut -b-32`;
|
||||
echo "MD5: $md5sum"
|
||||
else
|
||||
echo "MD5: none, MD5 command not found"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$APPEND" = y; then
|
||||
mv "$archname" "$archname".bak || exit
|
||||
|
||||
# Prepare entry for new archive
|
||||
filesizes="$filesizes $fsize"
|
||||
CRCsum="$CRCsum $crcsum"
|
||||
MD5sum="$MD5sum $md5sum"
|
||||
USIZE=`expr $USIZE + $OLDUSIZE`
|
||||
# Generate the header
|
||||
. $HEADER
|
||||
# Append the original data
|
||||
tail -n +$OLDSKIP "$archname".bak >> "$archname"
|
||||
# Append the new data
|
||||
cat "$tmpfile" >> "$archname"
|
||||
|
||||
chmod +x "$archname"
|
||||
rm -f "$archname".bak
|
||||
echo Self-extractible archive \"$archname\" successfully updated.
|
||||
else
|
||||
filesizes="$fsize"
|
||||
CRCsum="$crcsum"
|
||||
MD5sum="$md5sum"
|
||||
|
||||
# Generate the header
|
||||
. $HEADER
|
||||
|
||||
# Append the compressed tar data after the stub
|
||||
echo
|
||||
cat "$tmpfile" >> "$archname"
|
||||
chmod +x "$archname"
|
||||
echo Self-extractible archive \"$archname\" successfully created.
|
||||
fi
|
||||
rm -f "$tmpfile"
|
|
@ -0,0 +1,299 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
#
|
||||
# Original by Konstantinos Sykas <ksykas@gmail.com> (26-Mar-2011)
|
||||
#
|
||||
# Type: shell script
|
||||
# Description: The Oolite installation script, executed following the package self-extraction.
|
||||
#
|
||||
|
||||
|
||||
# Environment vars init part 1 of 2
|
||||
OOLITE_VERSION=$1
|
||||
INSTALL_ROOT=""
|
||||
OOLITE_ROOT_NAME="Oolite" # Redefined with full path later in this script
|
||||
STARTUP_SCRIPTS_PATH_SYSTEMWIDE="/usr/local/bin"
|
||||
INSTALL_ROOT_SYSTEMWIDE="/opt"
|
||||
ERROR_CODE_UNINSTALL_FAILED=111 # arbitrary error code to detect if uninstall did nothing
|
||||
# NOTE: also used in uninstall[.source] script
|
||||
|
||||
|
||||
# System-wide or single user installation selection
|
||||
# The default option changes depending on if the
|
||||
# user is root or not.
|
||||
if [ `id -u` -eq 0 ]
|
||||
then
|
||||
USER_IS_ROOT=1
|
||||
USER_CHOICES="[S/h]"
|
||||
else
|
||||
USER_CHOICES="[s/H]"
|
||||
fi
|
||||
read -p "Install Oolite system-wide or in your home directory? ${USER_CHOICES} " CHOICE
|
||||
if [ ${USER_IS_ROOT} ]
|
||||
then
|
||||
if [ "x$CHOICE" = "xh" ] || [ "x$CHOICE" = "xH" ]
|
||||
then
|
||||
echo "You cannot be root and install Oolite in your home directory."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [ "x$CHOICE" = "xs" ] || [ "x$CHOICE" = "xS" ]
|
||||
then
|
||||
echo "You must be root to install Oolite system-wide."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Environment vars init part 2 of 2
|
||||
ICON_SIZE="48"
|
||||
if [ ${USER_IS_ROOT} ]
|
||||
then
|
||||
INSTALL_ROOT=${INSTALL_ROOT_SYSTEMWIDE}
|
||||
STARTUP_SCRIPTS_PATH=${STARTUP_SCRIPTS_PATH_SYSTEMWIDE}
|
||||
DESKTOP_MODE="system"
|
||||
else
|
||||
INSTALL_ROOT="$HOME/GNUstep/Applications"
|
||||
STARTUP_SCRIPTS_PATH=${INSTALL_ROOT}/${OOLITE_ROOT_NAME}
|
||||
DESKTOP_MODE="user"
|
||||
fi
|
||||
OOLITE_ROOT=${INSTALL_ROOT}/${OOLITE_ROOT_NAME}
|
||||
OOLITEAPP_PATH=${OOLITE_ROOT}/oolite.app
|
||||
INSTALLER_REPOS=${OOLITEAPP_PATH}/oolite.installer.tmp
|
||||
SELF_PATH=$(cd $(dirname $0); pwd -P)
|
||||
SELF_FILENAME=$(basename $0)
|
||||
|
||||
|
||||
# Check if uninstall is necessary
|
||||
#
|
||||
# a. If user is not root, this script checks if another
|
||||
# system-wide or current user home directory installation
|
||||
# exists.
|
||||
# b. If user is root, this script checks only if another
|
||||
# system-wide installation exists.
|
||||
#
|
||||
# TODO - When user is root this script cannot detect
|
||||
# if there is an Oolite installation in any
|
||||
# user home directory.
|
||||
|
||||
# Uninstall if possible the system-wide installation
|
||||
${INSTALL_ROOT_SYSTEMWIDE}/${OOLITE_ROOT_NAME}/uninstall 2> /dev/null
|
||||
if [ $? -eq 111 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Uninstall user's instalation
|
||||
${OOLITE_ROOT}/uninstall 2> /dev/null
|
||||
|
||||
|
||||
# Start installation
|
||||
echo "Installing Oolite in \"${OOLITE_ROOT}\"..."
|
||||
|
||||
|
||||
# Generate Oolite root directory and
|
||||
# copy main oolite binary and Resources
|
||||
# as well as the rest of the tars
|
||||
echo -n "Copying oolite executable and resources... "
|
||||
mkdir -p ${OOLITEAPP_PATH}
|
||||
cp -pR ${SELF_PATH}/* ${OOLITEAPP_PATH}/.
|
||||
cd ${OOLITE_ROOT}
|
||||
# Generate uninstall script
|
||||
echo "#!/bin/sh" > uninstall
|
||||
echo >> uninstall
|
||||
echo >> uninstall
|
||||
echo "OOLITE_ROOT=${OOLITE_ROOT}" >> uninstall
|
||||
echo "STARTUP_SCRIPTS_PATH=${STARTUP_SCRIPTS_PATH}" >> uninstall
|
||||
echo "DESKTOP_MODE=\"${DESKTOP_MODE}\"" >> uninstall
|
||||
echo "ICON_SIZE=\"${ICON_SIZE}\"" >> uninstall
|
||||
echo "ERROR_CODE_UNINSTALL_FAILED=${ERROR_CODE_UNINSTALL_FAILED}" >> uninstall
|
||||
if [ $USER_IS_ROOT ]
|
||||
then
|
||||
echo "SYSTEM_WIDE=1" >> uninstall
|
||||
fi
|
||||
cat ${OOLITEAPP_PATH}/uninstall.source >> uninstall
|
||||
rm -f ${OOLITEAPP_PATH}/uninstall.source
|
||||
chmod +x uninstall
|
||||
echo "Done."
|
||||
|
||||
# Install AddOns/Basic-debug.oxp
|
||||
if [ -f ${INSTALLER_REPOS}/addons.tar.gz ]
|
||||
then
|
||||
echo -n "Extracting AddOns/Basic-debug.oxp... "
|
||||
cd ${OOLITE_ROOT}
|
||||
tar zxf ${INSTALLER_REPOS}/addons.tar.gz
|
||||
rm ${INSTALLER_REPOS}/addons.tar.gz
|
||||
echo "Done."
|
||||
fi
|
||||
|
||||
# Install documentation
|
||||
echo -n "Extracting documentation... "
|
||||
mkdir -p ${OOLITE_ROOT}/doc
|
||||
cd ${OOLITE_ROOT}/doc
|
||||
tar zxf ${INSTALLER_REPOS}/oolite.doc.tar.gz
|
||||
rm ${INSTALLER_REPOS}/oolite.doc.tar.gz
|
||||
echo "This is the first time you've run the game. Here is the README file -" > README-PREAMBLE.TXT
|
||||
echo "more docs can be found at ${OOLITE_ROOT}/doc/" >> README-PREAMBLE.TXT
|
||||
echo "Press q to exit this document and launch the game" >> README-PREAMBLE.TXT
|
||||
echo >> README-PREAMBLE.TXT
|
||||
echo "Done."
|
||||
|
||||
# Copy dependency libraries and DTDs
|
||||
# Note that we do not install any libraries to the system.
|
||||
# We just copy them in the Oolite tree structure.
|
||||
echo -n "Extracting dependencies... "
|
||||
mkdir -p ${OOLITE_ROOT}/oolite-deps
|
||||
cd ${OOLITE_ROOT}/oolite-deps
|
||||
tar zxf ${INSTALLER_REPOS}/oolite.deps.tar.gz
|
||||
tar zxf ${INSTALLER_REPOS}/oolite.dtd.tar.gz
|
||||
rm ${INSTALLER_REPOS}/oolite.deps.tar.gz
|
||||
rm ${INSTALLER_REPOS}/oolite.dtd.tar.gz
|
||||
echo "Done."
|
||||
|
||||
# Create folder for the OXPs
|
||||
mkdir -p ${OOLITE_ROOT}/AddOns
|
||||
|
||||
# Generate release.txt used by oolite-update
|
||||
echo -n "Generating startup and wrapper scripts... "
|
||||
cd ${OOLITE_ROOT}
|
||||
# Generate release information
|
||||
mv ${INSTALLER_REPOS}/release.txt .
|
||||
|
||||
# Generate startup scripts
|
||||
cd ${STARTUP_SCRIPTS_PATH}
|
||||
echo "#!/bin/sh" > oolite
|
||||
echo "${OOLITEAPP_PATH}/oolite-wrapper \$@" >> oolite
|
||||
echo "exit \$?" >> oolite
|
||||
chmod +x oolite
|
||||
echo "#!/bin/sh" > oolite-update
|
||||
echo "${OOLITEAPP_PATH}/oolite-update \$@" >> oolite-update
|
||||
echo "exit \$?" >> oolite-update
|
||||
chmod +x oolite-update
|
||||
|
||||
# Generate oolite wrapper script
|
||||
cd ${OOLITEAPP_PATH}
|
||||
tar zxf ${INSTALLER_REPOS}/oolite.wrap.tar.gz
|
||||
rm ${INSTALLER_REPOS}/oolite.wrap.tar.gz
|
||||
# Generate a thick oolite wrapper script as well as
|
||||
# the oolite-update script
|
||||
echo "#!/bin/sh" > oolite-wrapper
|
||||
echo "OOLITE_ROOT=${OOLITE_ROOT}" >> oolite-wrapper
|
||||
cat oolite.src >> oolite-wrapper
|
||||
rm oolite.src
|
||||
chmod +x oolite-wrapper
|
||||
|
||||
# Generate oolite update script
|
||||
echo "#!/bin/sh" > oolite-update
|
||||
echo "OOLITE_ROOT=${OOLITE_ROOT}" >> oolite-update
|
||||
cat oolite-update.src >> oolite-update
|
||||
rm oolite-update.src
|
||||
chmod +x oolite-update
|
||||
echo "Done."
|
||||
|
||||
# Install desktop menu and icon
|
||||
echo -n "Updating desktop menu... "
|
||||
cd ${OOLITE_ROOT}
|
||||
tar zxf ${INSTALLER_REPOS}/freedesktop.tar.gz
|
||||
rm ${INSTALLER_REPOS}/freedesktop.tar.gz
|
||||
|
||||
cd FreeDesktop
|
||||
|
||||
if [ ! ${USER_IS_ROOT} ]
|
||||
then
|
||||
awk -v var="Exec=${OOLITE_ROOT}/oolite" '{ gsub(/Exec=oolite/,var,$0); print }' oolite.desktop >oolite.desktop.tmp
|
||||
mv oolite.desktop.tmp oolite.desktop
|
||||
fi
|
||||
|
||||
# Ensure no desktop menu conflict with Linux repos oolite installation
|
||||
awk -v var="Icon=oolite.org-icon" '{ gsub(/Icon=oolite-icon/,var,$0); print }' oolite.desktop > oolite.desktop.tmp
|
||||
mv oolite.desktop.tmp oolite.desktop
|
||||
awk -v var="Name=Oolite (oolite.org)" '{ gsub(/Name=Oolite/,var,$0); print }' oolite.desktop > oolite.desktop.tmp
|
||||
mv oolite.desktop.tmp oolite.desktop
|
||||
mv oolite.desktop oolite.org.desktop
|
||||
mv oolite-icon.png oolite.org-icon.png
|
||||
xdg-desktop-menu install --novendor --mode ${DESKTOP_MODE} oolite.org.desktop 1> /dev/null 2> /dev/null
|
||||
desktop_rc=$?
|
||||
if [ $desktop_rc -eq 0 ]
|
||||
then
|
||||
rm oolite.org.desktop
|
||||
xdg-icon-resource install --novendor --mode ${DESKTOP_MODE} --size ${ICON_SIZE} oolite.org-icon.png 1> /dev/null 2> /dev/null
|
||||
icon_rc=$?
|
||||
if [ $icon_rc -eq 3 ] || [ $icon_rc -eq 4 ] || [ $icon_rc -eq 127 ]
|
||||
then
|
||||
echo
|
||||
echo "Warning $icon_rc: xdg-utils not properly installed. Oolite icon cannot be installed."
|
||||
else
|
||||
if [ $icon_rc -eq 1 ] || [ $icon_rc -eq 2 ] || [ $icon_rc -eq 5 ]
|
||||
then
|
||||
echo
|
||||
echo "Warning $icon_rc: oolite.org-icon.png not found. Please report this as a broken package."
|
||||
else
|
||||
rm oolite.org-icon.png
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ $desktop_rc -eq 3 ] || [ $desktop_rc -eq 4 ] || [ $desktop_rc -eq 127 ]
|
||||
then
|
||||
echo
|
||||
echo "Warning ${desktop_rc}: xdg-utils not properly installed. Oolite desktop menu cannot be installed."
|
||||
else
|
||||
if [ $desktop_rc -eq 1 ] || [ $desktop_rc -eq 2 ] || [ $desktop_rc -eq 5 ]
|
||||
then
|
||||
echo
|
||||
echo "Warning ${desktop_rc}: oolite.org.desktop not found. Please report this as a broken package."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $desktop_rc -eq 0 ] && [ $icon_rc -eq 0 ]
|
||||
then
|
||||
echo "Done."
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
echo -n "Cleaning up temporary folders... "
|
||||
rc=0
|
||||
rm ${OOLITEAPP_PATH}/setup 1> /dev/null 2> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
rc=$(($rc+1))
|
||||
fi
|
||||
rmdir ${OOLITE_ROOT}/FreeDesktop 1> /dev/null 2> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
rc=$(($rc+2))
|
||||
fi
|
||||
rmdir ${INSTALLER_REPOS} 1> /dev/null 2> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
rc=$(($rc+11))
|
||||
fi
|
||||
if [ $rc -gt 10 ]
|
||||
then
|
||||
echo
|
||||
echo "Error ${rc}: Some temporary files and/or folders could not be deleted. Please report this as a broken package."
|
||||
# Uninstall whatever you can and exit!
|
||||
exit 1
|
||||
else
|
||||
if [ $rc -gt 0 ]
|
||||
then
|
||||
echo "Warning ${rc}: Some temporary files and/or folders could not be deleted."
|
||||
else
|
||||
echo "Done."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Finished installation!
|
||||
echo "Finished!"
|
||||
echo
|
||||
if [ $desktop_rc -eq 0 ]
|
||||
then
|
||||
echo "A desktop menu entry \"Oolite (oolite.org)\" has been added under Games."
|
||||
fi
|
||||
echo "To start Oolite from a shell, run \"${STARTUP_SCRIPTS_PATH}/oolite\"."
|
||||
echo "To uninstall Oolite, run \"${OOLITE_ROOT}/uninstall\"."
|
||||
echo
|
||||
|
||||
# Exit with grace!
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
|
||||
|
||||
#
|
||||
# Original by Konstantinos Sykas <ksykas@gmail.com> (26-Mar-2011)
|
||||
#
|
||||
# Type: shell script
|
||||
# Description: The Oolite uninstall script. During installation the "setup" script
|
||||
# adds a header defining the environment variables used below.
|
||||
#
|
||||
|
||||
|
||||
SELF_FILENAME=$(basename $0)
|
||||
|
||||
|
||||
# Check if user is root
|
||||
if [ `id -u` -eq 0 ]
|
||||
then
|
||||
USER_IS_ROOT=1
|
||||
fi
|
||||
|
||||
echo -n "Removing Oolite from \"${OOLITE_ROOT}\"... "
|
||||
|
||||
# Check if we are OK to proceed with removal
|
||||
if [ ${SYSTEM_WIDE} ]
|
||||
then
|
||||
if [ ! ${USER_IS_ROOT} ]
|
||||
then
|
||||
echo
|
||||
echo "Error: Oolite was installed by root, so you must be root to uninstall it."
|
||||
exit ${ERROR_CODE_UNINSTALL_FAILED}
|
||||
fi
|
||||
else
|
||||
if [ ${USER_IS_ROOT} ]
|
||||
then
|
||||
OOLITE_OWNER=`echo ${OOLITE_ROOT} | awk -F"/" '{print $3}'`
|
||||
echo
|
||||
echo "Error: You are running as root, but Oolite was installed to"
|
||||
echo " user \"${OOLITE_OWNER}\" home directory."
|
||||
echo " If you're using sudo, you don't need it this time."
|
||||
exit ${ERROR_CODE_UNINSTALL_FAILED}
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Remove Oolite
|
||||
rm_rc=0 # Initialize (r)e(m)ove (r)eturn (c)ode counter
|
||||
cd ${OOLITE_ROOT}
|
||||
|
||||
# Remove Oolite menu
|
||||
xdg-desktop-menu uninstall --novendor --mode ${DESKTOP_MODE} oolite.org.desktop 1> /dev/null 2> /dev/null
|
||||
xdg-icon-resource uninstall --novendor --mode ${DESKTOP_MODE} --size ${ICON_SIZE} oolite.org-icon.png 1> /dev/null 2> /dev/null
|
||||
|
||||
# Only remove known files from oolite root and oolite startup scripts path
|
||||
rm -f release.txt 1> /dev/null 2> /dev/null
|
||||
rm -f ${STARTUP_SCRIPTS_PATH}/oolite 1> /dev/null 2> /dev/null
|
||||
rm -f ${STARTUP_SCRIPTS_PATH}/oolite-update 1> /dev/null 2> /dev/null
|
||||
rm -f ${SELF_FILENAME}
|
||||
|
||||
# Unconditionally remove FreeDesktop/ in case setup left it there
|
||||
rm -rf FreeDesktop/ 1> /dev/null 2> /dev/null
|
||||
|
||||
# Unconditionally remove oolite-deps/
|
||||
rm -rf oolite-deps/ 1> /dev/null 2> /dev/null
|
||||
|
||||
# Only remove known files from doc/ and
|
||||
# delete doc/ if it is empty
|
||||
rm -f doc/AdviceForNewCommanders.pdf 1> /dev/null 2> /dev/null
|
||||
rm -f doc/CHANGELOG.TXT 1> /dev/null 2> /dev/null
|
||||
rm -f doc/OoliteReadMe.pdf 1> /dev/null 2> /dev/null
|
||||
rm -f doc/OoliteRS.pdf 1> /dev/null 2> /dev/null
|
||||
rm -f doc/README-PREAMBLE.TXT 1> /dev/null 2> /dev/null
|
||||
rm -f doc/README.TXT 1> /dev/null 2> /dev/null
|
||||
rmdir doc/ 1> /dev/null 2> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
rm_rc=$(($rm_rc+1))
|
||||
fi
|
||||
|
||||
# Only remove add-on placed by setup and
|
||||
# delete AddOns/ if it is empty
|
||||
rm -rf AddOns/Basic-debug.oxp/ 1> /dev/null 2> /dev/null
|
||||
rmdir AddOns/ 1> /dev/null 2> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
rm_rc=$(($rm_rc+1))
|
||||
fi
|
||||
|
||||
# Only remove known files from oolite.app/ and
|
||||
# unconditionally remove oolite.app/Resources/ and
|
||||
# delete oolite.app/ if it is empty
|
||||
rm -f oolite.app/oolite 1> /dev/null 2> /dev/null
|
||||
rm -f oolite.app/oolite-update 1> /dev/null 2> /dev/null
|
||||
rm -f oolite.app/oolite-wrapper 1> /dev/null 2> /dev/null
|
||||
rm -rf oolite.app/Resources/ 1> /dev/null 2> /dev/null
|
||||
rmdir oolite.app/ 1> /dev/null 2> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
rm_rc=$(($rm_rc+1))
|
||||
fi
|
||||
|
||||
|
||||
# Remove Oolite/ root folder if it is empty
|
||||
rmdir ${OOLITE_ROOT}/../Oolite/ 1> /dev/null 2> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
rm_rc=$(($rm_rc+1))
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
|
||||
|
||||
# Finished uninstall!
|
||||
if [ $rm_rc -ne 0 ]
|
||||
then
|
||||
echo "Warning $rm_rc: Some folders could not be removed."
|
||||
fi
|
||||
|
||||
# Exit with grace
|
||||
exit $rm_rc
|
||||
|
Loading…
Reference in New Issue