@ -7,81 +7,103 @@
moduleselfname = " $( basename " $( readlink -f " ${ BASH_SOURCE [0] } " ) " ) "
if [ " ${ checklogs } " != "1 " ] ; then
if [ -z " ${ checklogs } " ] ; then
echo -e ""
echo -e " ${ lightyellow } Creating log directories ${ default } "
echo -e "================================="
fi
fn_sleep_time
# Create LinuxGSM logs.
echo -en " installing log dir: ${ logdir } ... "
mkdir -p " ${ logdir } "
if [ $? != 0 ] ; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fn_sleep_time
fi
echo -en " installing LinuxGSM log dir: ${ lgsmlogdir } ... "
mkdir -p " ${ lgsmlogdir } "
if [ $? != 0 ] ; then
fn_print_fail_eol_nl
core_exit.sh
echo -en " creating log directory [ ${ logdir } ]... "
if [ ! -d " ${ logdir } " ] ; then
if ! mkdir -p " ${ logdir } " ; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
else
fn_print_ok_eol_nl
fn_print_skip _eol_nl
fi
echo -en " creating LinuxGSM log: ${ lgsmlog } ... "
touch " ${ lgsmlog } "
if [ $? != 0 ] ; then
fn_print_fail_eol_nl
core_exit.sh
echo -en " creating script log directory [ ${ lgsmlogdir } ]... "
if [ ! -d " ${ lgsmlogdir } " ] ; then
if ! mkdir -p " ${ lgsmlogdir } " ; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
else
fn_print_ok_eol_nl
fn_print_skip _eol_nl
fi
# Create Console logs.
if [ " ${ consolelogdir } " ] ; then
echo -en " installing console log dir: ${ consolelogdir } ... "
mkdir -p " ${ consolelogdir } "
if [ $? != 0 ] ; then
echo -en " creating script log [ ${ lgsmlog } ]... "
if [ ! -f " ${ lgsmlog } " ] ; then
if ! touch " ${ lgsmlog } " ; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
echo -en " creating console log: ${ consolelog } ... "
if ! touch " ${ consolelog } " ; then
else
fn_print_skip_eol_nl
fi
echo -en " creating console log directory [ ${ consolelogdir } ]... "
if [ ! -d " ${ consolelogdir } " ] ; then
if ! mkdir -p " ${ consolelogdir } " ; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
else
fn_print_skip_eol_nl
fi
# Create Game logs.
if [ " ${ gamelogdir } " ] && [ ! -d " ${ gamelogdir } " ] ; then
echo -en " installing game log dir: ${ gamelogdir } ... "
if ! mkdir -p " ${ gamelogdir } " ; then
echo -en " creating console log [ ${ consolelog } ] ... "
if [ ! -f " ${ consolelog } " ] ; then
if ! touch " ${ consolelog } " ; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
else
fn_print_skip_eol_nl
fi
if [ -n " ${ gamelogdir } " ] ; then
echo -en " creating game log directory [ ${ gamelogdir } ]... "
if [ ! -d " ${ gamelogdir } " ] ; then
if ! mkdir -p " ${ gamelogdir } " ; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
else
fn_print_skip_eol_nl
fi
fi
# Symlink to gamelogdir
# unless gamelogdir is within logdir.
# e.g serverfiles/log is not within log/: symlink created
# log/server is in log/: symlink not created
if [ " ${ gamelogdir } " ] ; then
if [ " ${ gamelogdir : 0 : ${# logdir } } " != " ${ logdir } " ] ; then
echo -en " creating symlink to game log dir: ${ logdir } /server -> ${ gamelogdir } ... "
if [ -n " ${ gamelogdir } " ] && [ " ${ gamelogdir : 0 : ${# logdir } } " != " ${ logdir } " ] ; then
echo -en " creating symlink to game log dir [ ${ logdir } /server -> ${ gamelogdir } ]... "
# if path does not exist or does not match gamelogdir
if [ ! -h " ${ logdir } /server " ] || [ " $( readlink -f " ${ logdir } /server " ) " != " ${ gamelogdir } " ] ; then
if ! ln -nfs " ${ gamelogdir } " " ${ logdir } /server " ; then
fn_print_fail_eol_nl
core_exit.sh
else
fn_print_ok_eol_nl
fi
else
fn_print_skip_eol_nl
fi
fi