Kelven Yang 58cc90c10f 1) Modify domain router manager to support vmware
2) Add python and shell scripts for domr to support vmware
2010-10-20 18:49:18 -07:00

35 lines
512 B
Bash
Executable File

#!/bin/bash
# Usage
# save_password -v <user VM IP> -p <password>
#
while getopts 'v:p:' OPTION
do
case $OPTION in
v) VM_IP="$OPTARG"
;;
p)
ENCODEDPASSWORD="$OPTARG"
PASSWORD=$(echo $ENCODEDPASSWORD | tr '[a-m][n-z][A-M][N-Z]' '[n-z][a-m][N-Z][A-M]')
;;
?) echo "Incorrect usage"
exit 1
;;
esac
done
if [ ! -f /root/passwords ];
then
touch /root/passwords;
fi
sed -i /$VM_IP/d /root/passwords
echo "$VM_IP=$PASSWORD" >> /root/passwords
if [ $? -ne 0 ]
then
exit 1
fi
exit 0