# HG changeset patch # User Sascha Wilde # Date 1404295052 -7200 # Node ID 6bb3018b966d163ad3f05ee6d39623a848362595 # Parent ff2efc1cb8fa489f4ebe30a06e7bd595255e2eaf# Parent 2c63bb63de769793f721708f142924d2d178ebdd Merged diff -r 2c63bb63de76 -r 6bb3018b966d packaging/linux-installer.inc.in --- a/packaging/linux-installer.inc.in Wed Jul 02 11:49:39 2014 +0200 +++ b/packaging/linux-installer.inc.in Wed Jul 02 11:57:32 2014 +0200 @@ -1,18 +1,24 @@ #!/bin/bash ME=`basename "$0"` -DEFAULT_PREFIX=/usr/local +DEFAULT_PREFIX="$HOME/TrustBridge" CFGPATH="${XDG_DATA_HOME:-$HOME/.local/share}/BSI/TrustBridge" SYSCFGPATH="/etc/TrustBridge" INSTCFGNAME="installation.cfg" +FORCE=0 instcfg_file="${CFGPATH}/${INSTCFGNAME}" -declare -A instcfg +declare -A instcfg oldinstcfg instcfg=( [TIMESTMP]=`date -u +%Y%m%d%H%M%S` [VERSION]='@PROJECT_VERSION@' [PREFIX]='' ) +oldinstcfg=( + [TIMESTMP]='' + [VERSION]='' + [PREFIX]='' +) version() { @@ -44,6 +50,8 @@ Options: -p, --prefix=PATH install files in PATH + -f, --force install to given prefix, even when a current + installation with different prefix exists. --help display this help and exit --version output version information and exit EOF @@ -53,8 +61,8 @@ parse_args() { OPTS=`getopt \ - -l help,prefix:,version \ - -o p: -n "$ME" -- "$@"` + -l force,help,prefix:,version \ + -o f,p: -n "$ME" -- "$@"` [ $? -eq 0 ] || usage 23 eval set -- "$OPTS" @@ -65,6 +73,10 @@ instcfg[PREFIX]="$2" shift 2 ;; + --force|-f) + FORCE=1 + shift 1 + ;; --help) usage 0 ;; @@ -88,10 +100,21 @@ done } +read_oldinstcfg() +{ + if [ -r "$instcfg_file" ] ; then + echo "Reading '$instcfg_file' ..." + for key in "${!oldinstcfg[@]}" ; do + oldinstcfg[$key]=`sed -n "/$key/s/[^=]*=\(.*\)/\1/p" "$instcfg_file"` + done + fi +} + #====================================================================== # main() parse_args "$@" +read_oldinstcfg cat <