#!/bin/bash # # postinst script # This script executes after unpacking files from that archive and registering the product at the server. # # The following environment variables can be used to obtain information about the current installation: # PRODUCT_ID, PRODUCT_TYPE, PRODUCT_VERSION, PACKAGE_VERSION, CLIENT_DATA_DIR, DEPOT_ID TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp if [ -d $TMP_DIR ]; then echo 'Restoring previous directories...' for dirname in client; do for path in $TMP_DIR/$dirname; do if [ -d $path ]; then test -e $TMP_DIR/`basename $path` && cp -ar $CLIENT_DATA_DIR/`basename $path`/* $TMP_DIR/`basename $path` test -e $CLIENT_DATA_DIR/`basename $path` && rm -rf $CLIENT_DATA_DIR/`basename $path` echo " moving $path to $CLIENT_DATA_DIR" mv $path $CLIENT_DATA_DIR/ || exit 1 fi done done fi echo "Removing temporary files..." rm -rf $TMP_DIR