You are on page 1of 2

#!

/bin/bash
set -e

sed -e '/^127.0.0.2/g' /etc/hosts -i

cfgfile=topology.ini

cd /opt/pdinstall
rm -f /opt/pdconfigure/cfg/userconfigs/default/domaintopology.ini
if [ ! -e ${cfgfile} -a -e ${cfgfile}.enc ] ; then
title="- Decrypting ${cfgfile}.enc -";
sep=`echo "$title" | tr "[.[:alnum:][:blank:]]" "-"`
echo
echo $sep;
echo $title;
echo $sep;
echo "You will be prompted for the decryption password.";
echo
/opt/pdinstall/enc_topology.sh -d
fi
ln -s /opt/pdinstall/$cfgfile
/opt/pdconfigure/cfg/userconfigs/default/domaintopology.ini

options=$*

cd /opt/pdconfigure/
./bin/php IPConverter.php $options

answer=""
while [ "$answer" != "yes" -a "$answer" != "no" ]; do
title="- Encryption of ${cfgfile} and its backup -";
sep=`echo "$title" | tr "[.[:alnum:][:blank:]]" "-"`
echo
echo $sep;
echo $title;
echo $sep;
echo "Your '${cfgfile}' file and its backup contain passwords. It is strongly
recommended to encrypt these files."
echo "(You will be able to decrypt the files at any time using:
'/opt/pdinstall/enc_topology.sh -d [filename]')"
echo "Type 'yes' to encrypt your '${cfgfile}' file and its backup,"
echo "type 'no' to skip the encryption (e.g.: you want to run 'add_MBE' now):
"; read answer
done
if [ "$answer" == "yes" ] ; then
echo "You will be prompted for an encryption password.";
echo "WARNING: Don't forget your password, you will need it to decrypt the
files!";
echo
/opt/pdinstall/enc_topology.sh -e
if [ -d /opt/pdinstall/backup ]; then
set +e
files=`ls /opt/pdinstall/backup/*/topology.ini 2>/dev/null`
if [ $? -eq 0 ]; then
for i in $files
do
/opt/pdinstall/enc_topology.sh -e $i;
done
fi
set -e
fi

echo "You can decrypt the files at any time using:


'/opt/pdinstall/enc_topology.sh -d [filename]'"
else
echo "You can encrypt the files at any time using:
'/opt/pdinstall/enc_topology.sh -e [filename]'"
fi
echo

You might also like