fix issue with logs dir not being created

This commit is contained in:
ducoterra
2018-09-12 22:45:03 -04:00
parent 1d860dcacd
commit c733abb19d

View File

@@ -3,28 +3,36 @@
# Installs Dependencies automatically
#TODO: 1. add success outputs to script
################################################################################
mkdir scripts
mkdir logs
# create necessary dirs
if [ ! -d "/root/scripts" ] ; then
mkdir scripts
fi
if [ ! -d "/root/logs" ] ; then
mkdir logs
fi
# check if root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
cd /root/
# yum update
yum -y update > logs/additional.log
yum -y update > logs/yum.log
if [ $? -ne 0 ] ; then
echo "yum failed to update, see logs/yum.log for more info"
exit 1
fi
# get epel-release
yum -y install epel-release >> logs/additional.log
yum -y install epel-release >> logs/yum.log
if [ $? -ne 0 ] ; then
echo "yum failed to install epel-release, see logs/yum.log for more info"
exit 1
fi
# install dependencies
yum -y install vim nano gcc wget nginx libsqlite3x-devel.x86_64 postgresql-server postgresql-devel postgresql-contrib bzip2-devel zlib-devel libffi-devel openssl-devel policycoreutils-python.x86_64 0:2.5-22.el7 >> logs/additional.log
yum -y install vim nano gcc wget nginx libsqlite3x-devel.x86_64 postgresql-server postgresql-devel postgresql-contrib bzip2-devel zlib-devel libffi-devel openssl-devel policycoreutils-python.x86_64 >> logs/yum.log
if [ $? -ne 0 ] ; then
echo "yum failed to install a dependency, see logs/yum.log for more info"
exit 1