wilde@680: #!/bin/bash wilde@680: # Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik wilde@680: # Software engineering by Intevation GmbH wilde@680: # wilde@680: # This file is Free Software under the GNU GPL (v>=2) wilde@680: # and comes with ABSOLUTELY NO WARRANTY! wilde@680: # See LICENSE.txt for details. wilde@680: wilde@680: TMPDIR=$(mktemp -d) wilde@700: TMPSHAR=$(mktemp "@CMAKE_BINARY_DIR@/shar.XXXXXXXXXX") wilde@680: andre@972: ARCH="$1" andre@972: andre@972: if [ "$ARCH" != "i386" -a "$ARCH" != "x86_64" ]; then andre@972: echo "Usage $0 " andre@972: echo "with archtiecture either i386 or x86_64" andre@1113: echo "defaulting to x86_64" andre@1113: ARCH=x86_64 andre@972: fi andre@972: wilde@680: INSTALLER="@CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.sh" wilde@680: wilde@680: EXEFILES=("@CMAKE_BINARY_DIR@/cinst/cinst" wilde@680: "@CMAKE_BINARY_DIR@/cinst/mozilla" wilde@738: "@CMAKE_BINARY_DIR@/ui/trustbridge" wilde@738: "@CMAKE_BINARY_DIR@/ui/trustbridge-tray-starter.sh") andre@972: andre@892: ICON="@CMAKE_SOURCE_DIR@/ui/img/logo-128.png" andre@938: HELPFILES=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html \ andre@938: -maxdepth 1 -type f -printf "%p \n") andre@938: HELPFILES_STATIC=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_static \ andre@938: -maxdepth 1 -type f -printf "%p \n") andre@938: HELPFILES_IMG=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_images \ andre@938: -maxdepth 1 -type f -printf "%p \n") andre@938: HELPFILES_SOURCES=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_sources \ andre@938: -maxdepth 1 -type f -printf "%p \n") wilde@680: wilde@795: L10N_DE_FILE="@CMAKE_BINARY_DIR@/packaging/linux-installer.l10n-de" wilde@795: wilde@680: # Make installation in TMPDIR, this is what we will put into the wilde@680: # shar-archive. wilde@680: echo "Using $TMPDIR for temporary installation to build installer..." wilde@680: install -d "$TMPDIR/bin" andre@872: install -d "$TMPDIR/share/pixmaps/trustbridge" andre@938: install -d "$TMPDIR/share/doc/trustbridge" andre@938: install -d "$TMPDIR/share/doc/trustbridge/_static" andre@938: install -d "$TMPDIR/share/doc/trustbridge/_sources" andre@938: install -d "$TMPDIR/share/doc/trustbridge/_images" wilde@711: install "${EXEFILES[@]}" "$TMPDIR/bin" andre@872: install "$ICON" "$TMPDIR/share/pixmaps/trustbridge/trustbridge.png" wilde@711: wilde@680: echo "Building $INSTALLER..." wilde@700: cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER" wilde@711: binnames="" wilde@711: for file in "${EXEFILES[@]}" ; do wilde@711: binnames="`basename $file` $binnames" wilde@711: done andre@938: for file in ${HELPFILES} ; do andre@938: install "$file" "$TMPDIR/share/doc/trustbridge" andre@938: helpnames="`basename $file` $helpnames" andre@938: done andre@980: for file in ${HELPFILES_IMG} ; do andre@938: install "$file" "$TMPDIR/share/doc/trustbridge/_images" andre@938: helpnames_img="`basename $file` $helpnames_img" andre@938: done andre@938: for file in ${HELPFILES_STATIC} ; do andre@938: install "$file" "$TMPDIR/share/doc/trustbridge/_static" andre@938: helpnames_static="`basename $file` $helpnames_static" andre@938: done andre@938: for file in ${HELPFILES_SOURCES}; do andre@938: install "$file" "$TMPDIR/share/doc/trustbridge/_sources" andre@938: helpnames_sources="`basename $file` $helpnames_sources" andre@938: done andre@938: andre@938: echo "Creating shar archive ..." andre@938: cd "$TMPDIR" andre@938: shar -z -B `find -type f` | sed 's/^exit 0//' >>"$TMPSHAR" andre@938: wilde@711: sed -i "s/###BINNAMES###/${binnames}/" "$INSTALLER" andre@872: sed -i "s/###ICONNAME###/trustbridge.png/" "$INSTALLER" wilde@700: sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER" wilde@795: sed -i "/###L10N_DE###/r $L10N_DE_FILE" "$INSTALLER" andre@938: sed -i "s/###HELPNAMES###/${helpnames}/" "$INSTALLER" andre@938: sed -i "s/###HELPNAMES_SOURCES###/${helpnames_sources}/" "$INSTALLER" andre@938: sed -i "s/###HELPNAMES_STATIC###/${helpnames_static}/" "$INSTALLER" wilde@1135: sed -i "s/###HELPNAMES_IMG###/${helpnames_img}/" "$INSTALLER" wilde@1135: sed -i "s/###ARCH###/${ARCH}/" "$INSTALLER" andre@938: wilde@680: chmod +x "$INSTALLER" andre@921: echo "Signing" andre@1130: "@CMAKE_SOURCE_DIR@/ui/tests/append-sig.sh" \ andre@1130: "@CMAKE_SOURCE_DIR@/ui/tests/data/codesign/codesigning.key" \ andre@1130: "$INSTALLER" "${INSTALLER}_signed" andre@1130: mv "${INSTALLER}_signed" "$INSTALLER" wilde@680: wilde@680: echo "Cleaning up..." wilde@680: rm -r "$TMPDIR" wilde@700: rm "$TMPSHAR"