X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=blootbot;h=4ef62d5f1dfe4128bc441c6516c857cc773ca5d8;hb=ec49a5aea8a18720c4f780680de2251cd31216b4;hp=02ea59b528a5247a23385d019a426d9962ec04dc;hpb=439742e2c34ee9478d7506bdd77953e21680cce9;p=infobot.git diff --git a/blootbot b/blootbot index 02ea59b..4ef62d5 100755 --- a/blootbot +++ b/blootbot @@ -5,32 +5,30 @@ use strict; use vars qw($bot_base_dir $bot_src_dir $bot_misc_dir $bot_state_dir - $bot_data_dir $bot_config_dir $bot_log_dir $bot_run_dir - $bot_pid $memusage %param $fhs + $bot_data_dir $bot_config_dir $bot_log_dir $bot_run_dir + $bot_pid $memusage %param ); BEGIN { - $fhs = 0; - - if ($fhs) { # FHS - $bot_base_dir = $bot_state_dir; - $bot_config_dir = '.'; - } else { # non-FHS - $bot_base_dir = '.'; - $bot_config_dir = 'files/'; - $bot_data_dir = 'files/'; - $bot_state_dir = 'files/'; - $bot_run_dir = '.'; + if (@ARGV and -f $ARGV[0]) { + # source passed config to allow $bot_*_dir to be set. + do $ARGV[0]; } - # common. - $bot_src_dir = "$bot_base_dir/src"; - $bot_misc_dir = "$bot_base_dir/files"; + + # set any $bot_*_dir var's that aren't already set + $bot_base_dir ||= '.'; + $bot_config_dir ||= 'files/'; + $bot_data_dir ||= 'files/'; + $bot_state_dir ||= 'files/'; + $bot_run_dir ||= '.'; + $bot_src_dir ||= "$bot_base_dir/src"; + $bot_log_dir ||= "$bot_base_dir/log"; + $bot_misc_dir ||= "$bot_base_dir/files"; $bot_pid = $$; require "$bot_src_dir/logger.pl"; require "$bot_src_dir/core.pl"; - require "$bot_src_dir/interface.pl"; require "$bot_src_dir/modules.pl"; # load the configuration (params) file. @@ -49,7 +47,7 @@ BEGIN { # prevent duplicate processes of the same bot &duperuncheck(); -# initialize everything +# initialize everything &startup(); # first time initialization. &setup(); @@ -64,9 +62,7 @@ exit 0; # just so you don't look farther down in this file :) # --- support routines -# FIXME. -# add arguments, basically '-h' and '--help', heh. -# +# FIXME: add arguments, basically '-h' and '--help', heh. # added by the xk sub duperuncheck {