view packaging/create-dist-package.sh.in @ 1252:9a482182f80f

(issue54) Monitor update installation and restart afterwards on Linux
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 25 Sep 2014 15:57:25 +0200
parents 014586ef8a84
children 46b598e0dfc6
line wrap: on
line source
#!/bin/bash

# Copyright (C) 2014 by Bundesamt f�r Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH
#
# This file is Free Software under the GNU GPL (v>=2)
# and comes with ABSOLUTELY NO WARRANTY!
# See LICENSE.txt for details.


# 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/trustbridge-certificate-installer.exe $TMPDIR/windows
cp @CMAKE_SOURCE_DIR@/build-windows/cinst/trustbridge-nss-installer.exe $TMPDIR/windows
cp -r @CMAKE_SOURCE_DIR@/packaging/resources $TMPDIR/resources
cp @CMAKE_SOURCE_DIR@/build-windows/packaging/DesktopShellRun.dll $TMPDIR/resources
cp -r @CMAKE_BINARY_DIR@/doc/help/client/html $TMPDIR/windows/doc
cp -r @CMAKE_SOURCE_DIR@/licenses $TMPDIR/windows/licenses

echo "; This file is autogenerated." > $TMPDIR/resources/filelist_in.nsh
echo "; This file is autogenerated." > $TMPDIR/resources/filelist_un.nsh
OLDDIR=$(pwd)
cd $TMPDIR/windows
for file in `find * -name \*.exe`; do
    echo File \"\${files_dir}\${path_sep}$file\" >> $TMPDIR/resources/filelist_in.nsh
    if [ "$file" = "trustbridge-nss-installer.exe" ]; then
        # The nss installer is handled specially on uninstallation.
        continue
    fi
    echo Delete \"\$INSTDIR\\$file\" >> $TMPDIR/resources/filelist_un.nsh
done

cd $TMPDIR/windows/licenses
echo SetOutPath \"\$INSTDIR\\licenses\" >> @CMAKE_CURRENT_BINARY_DIR@/filelist_in.nsh
for file in `find * -type f`; do
    echo File \"\${files_dir}\${path_sep}licenses\${path_sep}$file\" >> @CMAKE_CURRENT_BINARY_DIR@/filelist_in.nsh
    echo Delete \"\$INSTDIR\\licenses\\$file\" >> @CMAKE_CURRENT_BINARY_DIR@/filelist_un.nsh
done
echo RmDir \"\$INSTDIR\\licenses\" >> @CMAKE_CURRENT_BINARY_DIR@/filelist_un.nsh

cd $TMPDIR/windows/doc

for curdir in `find * -maxdepth 0 -type d -not -path .`; do
    cd $curdir
    curpath=\"\$INSTDIR\\doc\\$curdir\"
    echo SetOutPath $curpath >> $TMPDIR/resources/filelist_in.nsh
    for file in `find * -maxdepth 0 -type f`; do
        echo File \"\${files_dir}\${path_sep}doc\${path_sep}$curdir\${path_sep}$file\" >> $TMPDIR/resources/filelist_in.nsh
        echo Delete \"\$INSTDIR\\doc\\$curdir\\$file\" >> $TMPDIR/resources/filelist_un.nsh
    done
    echo RMDir $curpath >> $TMPDIR/resources/filelist_un.nsh
    cd -
done

echo SetOutPath \"\$INSTDIR\\doc\" >> $TMPDIR/resources/filelist_in.nsh
for file in `find * -maxdepth 0 -type f -not -path .buildinfo`; do
    echo File \"\${files_dir}\${path_sep}doc\${path_sep}$file\" >> $TMPDIR/resources/filelist_in.nsh
    echo Delete \"\$INSTDIR\\doc\\$file\" >> $TMPDIR/resources/filelist_un.nsh
done
echo RMDir \"\$INSTDIR\\doc\" >> $TMPDIR/resources/filelist_un.nsh

cd $OLDDIR



cp @CMAKE_SOURCE_DIR@/packaging/filelist.nsh $TMPDIR
cp @CMAKE_SOURCE_DIR@/packaging/trustbridge.nsi $TMPDIR
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="$TMPDIR/resources" \
    -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 \
    -Ddescription="TrustBridge" \
    -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/