add wsusoffline to the package

This commit is contained in:
Mario Fetka
2014-03-14 13:03:00 +01:00
parent 999a6fb79b
commit 0e46e826c5
6 changed files with 104 additions and 11 deletions

View File

@@ -1,9 +1,54 @@
#! /bin/sh
#!/bin/bash
#
# postinst script for softprod
# 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: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
# 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

View File

@@ -1,9 +1,41 @@
#! /bin/sh
#!/bin/bash
#
# preinst script for softprod
# preinst script
# 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
#
# 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 "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 client; 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