2013-03-08 16:10:34 +01:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# preinst script for softprod
|
|
|
|
# This script executes before that package will be unpacked from its archive file.
|
|
|
|
#
|
|
|
|
# The following environment variables can be used to obtain information about the current installation:
|
|
|
|
# PRODUCT_ID: id of the current product
|
|
|
|
# CLIENT_DATA_DIR: directory where client data will be installed
|
|
|
|
#
|
2019-10-30 14:43:12 +01:00
|
|
|
|
|
|
|
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
|
|
|
|
|
|
|
|
if [ -d $TMP_DIR ]; then
|
|
|
|
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
|
|
|
|
mkdir $TMP_DIR
|
|
|
|
|
|
|
|
if [ -d $CLIENT_DATA_DIR ]; then
|
|
|
|
echo "Saving previous directories..."
|
|
|
|
for dirname in custom ; do
|
|
|
|
for path in $CLIENT_DATA_DIR/$dirname; do
|
|
|
|
if [ -e $path ]; then
|
|
|
|
echo " moving $path to $TMP_DIR"
|
|
|
|
mv $path $TMP_DIR/ || exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|