2014-03-14 13:03:00 +01:00
|
|
|
#!/bin/bash
|
2013-07-23 19:23:35 +02:00
|
|
|
#
|
2014-03-14 13:03:00 +01:00
|
|
|
# postinst script
|
2013-07-23 19:23:35 +02:00
|
|
|
# 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:
|
2014-03-14 13:03:00 +01:00
|
|
|
# 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
|
2014-03-14 13:19:06 +01:00
|
|
|
test -e $TMP_DIR/`basename $path` && cp -ar $CLIENT_DATA_DIR/`basename $path`/* $TMP_DIR/`basename $path`
|
2014-03-14 13:03:00 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|