microsoft.wsusoffline/OPSI/postinst

55 lines
1.1 KiB
Plaintext
Raw Normal View History

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
major=`cat /etc/opsi/version | cut -d'.' -f1`
minor=`cat /etc/opsi/version | cut -d'.' -f2`
if [ ! $major -ge 4 ]; then
if [ $major -le 2 -o $minor -le 98 ]; then
echo "This product requires opsi version >= 3.99" 1>&2
exit 1
fi
fi
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 $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
chmod u+x,g+x $CLIENT_DATA_DIR/*.py