robotframework-demo/Project/task4/Script/SC0_Common/01_Update/updateUDB.sh

46 lines
1.1 KiB
Bash

#!/bin/bash
WORK_DIR=$(cd `dirname $0`; pwd)
check_env() {
which decudb
if [ $? -ne 0 ] ; then
echo "No decudb.Please place decudb in the /usr/bin directory."
exit 1
fi
}
install_udb() {
if [ -f $WORK_DIR/outfile.txt ] ; then
rm -rf $WORK_DIR/outfile.txt
fi
cd $WORK_DIR
files=$(ls *.udb | awk -F ".udb" '{print $1}')
for filename in $files
do
decudb ./$filename.udb
if [ -d ./$filename ] ; then
cd ./$filename
chmod 755 ./setup.sh
./setup.sh
if [ $? -ne 0 ] ; then
echo "Fail to install package $filename.udb."
echo "$filename.udb failed" >> $WORK_DIR/outfile.txt
else
echo "Install package $filename.udb successfully."
echo "$filename.udb success" >> $WORK_DIR/outfile.txt
fi
cd ..
\rm -rf ./$filename
fi
done
echo "Please refer to outfile.txt for installation results."
echo "For detailed installation, please refer to /var/www/html/output/log/udbRun.log."
}
check_env
install_udb
exit 0