Mercurial > trustbridge
changeset 700:bf87feccb26c
Write installation configuration file.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 02 Jul 2014 10:53:43 +0200 |
parents | f12b102b33ca |
children | 31c3d2bc9880 480bc550d2ad |
files | packaging/linux-createpackage.sh.in packaging/linux-installer.inc.in |
diffstat | 2 files changed, 41 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/packaging/linux-createpackage.sh.in Tue Jul 01 17:22:31 2014 +0200 +++ b/packaging/linux-createpackage.sh.in Wed Jul 02 10:53:43 2014 +0200 @@ -7,6 +7,7 @@ # See LICENSE.txt for details. TMPDIR=$(mktemp -d) +TMPSHAR=$(mktemp "@CMAKE_BINARY_DIR@/shar.XXXXXXXXXX") INSTALLER="@CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.sh" @@ -21,10 +22,12 @@ install "${EXEFILES[@]}" "$TMPDIR/bin" echo "Building $INSTALLER..." -cat "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" >"$INSTALLER" +cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER" cd "$TMPDIR" -shar -z -B bin/* >>"$INSTALLER" +shar -z -B bin/* | sed 's/^exit 0//' >>"$TMPSHAR" +sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER" chmod +x "$INSTALLER" echo "Cleaning up..." rm -r "$TMPDIR" +rm "$TMPSHAR"
--- a/packaging/linux-installer.inc.in Tue Jul 01 17:22:31 2014 +0200 +++ b/packaging/linux-installer.inc.in Wed Jul 02 10:53:43 2014 +0200 @@ -1,15 +1,23 @@ #!/bin/bash ME=`basename "$0"` -VERSION='@PROJECT_VERSION@' DEFAULT_PREFIX=/usr/local +CFGPATH="${XDG_DATA_HOME:-$HOME/.local/share}/BSI/TrustBridge" +SYSCFGPATH="/etc/TrustBridge" +INSTCFGNAME="installation.cfg" -path="" +instcfg_file="${CFGPATH}/${INSTCFGNAME}" +declare -A instcfg +instcfg=( + [TIMESTMP]=`date -u +%Y%m%d%H%M%S` + [VERSION]='@PROJECT_VERSION@' + [PREFIX]='' +) version() { cat <<EOF -TrustBridge $VERSION Installer +TrustBridge ${instcfg[VERSION]} Installer Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik Software engineering by Intevation GmbH @@ -54,7 +62,7 @@ while true ; do case "$1" in --prefix|-p) - path="$2" + instcfg[PREFIX]="$2" shift 2 ;; --help) @@ -71,6 +79,15 @@ done } +write_instcfg() +{ + install -d `dirname "$instcfg_file"` + echo "# Created by TrustBridge-Installer, don't touch!" >"$instcfg_file" + for key in "${!instcfg[@]}" ; do + echo "${key}=${instcfg[$key]}" >>"$instcfg_file" + done +} + #====================================================================== # main() @@ -80,27 +97,33 @@ ------------------------------------------------------------------------ TrustBridge - Installer - Version $VERSION + Version ${instcfg[VERSION]} ------------------------------------------------------------------------ EOF -if [ -z "$path" ] ; then +if [ -z "${instcfg[PREFIX]}" ] ; then echo -n "Select installation prefix for TrustBridge [${DEFAULT_PREFIX}]: " - read -e path + read -e instcfg[PREFIX] - [ -z "$path" ] && path="${DEFAULT_PREFIX}" + [ -z "${instcfg[PREFIX]}" ] && instcfg[PREFIX]="${DEFAULT_PREFIX}" fi -echo "Installing to '$path':" +echo "Installing to '${instcfg[PREFIX]}':" -if [ ! -d "$path" ] ; then +if [ ! -d "${instcfg[PREFIX]}" ] ; then echo "creating installation directory ..." - install -d "$path" || fatal "Could not create '$path'!" + install -d "${instcfg[PREFIX]}" || fatal "Could not create '${instcfg[PREFIX]}'!" fi echo "unpacking files ..." -cd "$path" +cd "${instcfg[PREFIX]}" # ---------------------------------------------------------------------- -# regular shar archive appended here: +# regular shar archive inserted here: +###SHAR### +# ---------------------------------------------------------------------- + +echo "Writing installation configuration to: $instcfg_file ..." +write_instcfg +exit 0