view packaging/create-dist-package.sh.in @ 1119:5349e2354c48

(issue54) Merge branch runafterinstall There is now an NSIS Plugin that executes the Software after installation using COM in the shell of the current user. With the way over the shell there is no inheritance / token management required. As it is impossible to drop all privileges of a token granted by UAC and still be able to reelevate the Token again with another RunAs call later this round trip over the Shell was necessary.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 16 Sep 2014 19:48:22 +0200
parents 1c1964c27b39
children a162f4cbba75
line wrap: on
line source
#!/bin/bash
# Helper script to package the files expected by the -admin application
# Windows build is expected to live in CMAKE_SOURCE_DIR/build-windows
set -x
set -e

if [ ! -x `which wine` ]; then
    echo "ERROR: Could not find wine."
    exit 1
fi

if [ ! -f @CMAKE_SOURCE_DIR@/build-windows/Makefile ]; then
    echo "Could not find a windows build in: @CMAKE_SOURCE_DIR@/build-windows "
    exit 1
fi

if [ ! -f @CMAKE_SOURCE_DIR@/build-i386/Makefile ]; then
    echo "Could not find a i386 build in: @CMAKE_SOURCE_DIR@/build-i386 "
    exit 1
fi

TMPD=$(mktemp -d)
TMPDIR=$TMPD/TrustBridge-@PROJECT_VERSION@
cd @CMAKE_SOURCE_DIR@/build-windows
echo "Updating windows build"
make -j`nproc`
cd @CMAKE_SOURCE_DIR@/build-i386
echo "Building x86 package"
make -j`nproc`
/bin/bash packaging/linux-createpackage.sh i386
cd @CMAKE_BINARY_DIR@
echo "Building amd64 package"
/bin/bash packaging/linux-createpackage.sh x86_64
mkdir -p $TMPDIR/linux
mkdir -p $TMPDIR/windows
mv @CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.sh \
    $TMPDIR/linux/TrustBridge-@PROJECT_VERSION@-amd64.sh
mv @CMAKE_SOURCE_DIR@/build-i386/TrustBridge-@PROJECT_VERSION@.sh \
    $TMPDIR/linux/TrustBridge-@PROJECT_VERSION@-i386.sh
cp @CMAKE_SOURCE_DIR@/build-windows/ui/trustbridge.exe $TMPDIR/windows
cp @CMAKE_SOURCE_DIR@/build-windows/cinst/cinst.exe $TMPDIR/windows
cp @CMAKE_SOURCE_DIR@/build-windows/cinst/mozilla.exe $TMPDIR/windows
cp -r @CMAKE_BINARY_DIR@/manuals/help-manual/html $TMPDIR/windows/doc

cp @CMAKE_SOURCE_DIR@/packaging/filelist.nsh $TMPDIR
cp @CMAKE_SOURCE_DIR@/packaging/trustbridge.nsi $TMPDIR
cp -r @CMAKE_SOURCE_DIR@/packaging/resources $TMPDIR/resources
LC_ALL="de_DE.latin-1" echo "company=Bundesamt f�r Sicherheit in der Informationstechnik" > $TMPDIR/meta.ini
EST_SIZE=$(du -s $TMPDIR/windows | cut -f 1)
echo "version_number=@PROJECT_VERSION@" >>  $TMPDIR/meta.ini
echo "setupname=%1TrustBridge-@PROJECT_VERSION@.exe" >> $TMPDIR/meta.ini
echo "productname=TrustBridge" >> $TMPDIR/meta.ini
echo "info_url=http://wald.intevation.org/projects/trustbridge/" >> $TMPDIR/meta.ini
echo "productname_short=TrustBridge" >> $TMPDIR/meta.ini
echo "description=TrustBridge" >> $TMPDIR/meta.ini
echo "size=$EST_SIZE" >> $TMPDIR/meta.ini

# Create a temporary NSIS file for the uninstaller cration
LC_ALL="de_DE.latin-1" makensis -Dfiles_dir=$TMPDIR/windows \
    -Dcompany="Bundesamt f�r Sicherheit in der Informationstechnik" \
    -Dplugin_dir="@CMAKE_CURRENT_BINARY_DIR@" \
    -Dversion_number=@PROJECT_VERSION@ \
    -Dsetupname="$TMPDIR/TrustBridge-@PROJECT_VERSION@-uni.exe" \
    -Dproductname="TrustBridge" \
    -Dpath_sep="/" \
    -Dinfo_url="http://wald.intevation.org/projects/trustbridge/" \
    -Dsize=$EST_SIZE \
    -DWRITE_UNINSTALLER \
    -Dproductname_short="TrustBridge" @CMAKE_SOURCE_DIR@/packaging/trustbridge.nsi
wine $TMPDIR/TrustBridge-@PROJECT_VERSION@-uni.exe /S || true
mv ~/.wine/drive_c/tmp-uninstaller/Uninstall.exe $TMPDIR/windows
rmdir ~/.wine/drive_c/tmp-uninstaller
rm $TMPDIR/TrustBridge-@PROJECT_VERSION@-uni.exe

cd $TMPD
zip -r TrustBridge-@PROJECT_VERSION@.zip TrustBridge-@PROJECT_VERSION@
mv TrustBridge-@PROJECT_VERSION@.zip @CMAKE_BINARY_DIR@
rm -r $TMPD
echo "Package is: @CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.zip"

http://wald.intevation.org/projects/trustbridge/