~vorpalblade/envbot/anmaster-0.0.1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
###########################################################################
#                                                                         #
#  envbot - an IRC bot in bash                                            #
#  Copyright (C) 2007  Arvid Norlander                                    #
#                                                                         #
#  This program is free software: you can redistribute it and/or modify   #
#  it under the terms of the GNU General Public License as published by   #
#  the Free Software Foundation, either version 3 of the License, or      #
#  (at your option) any later version.                                    #
#                                                                         #
#  This program is distributed in the hope that it will be useful,        #
#  but WITHOUT ANY WARRANTY; without even the implied warranty of         #
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          #
#  GNU General Public License for more details.                           #
#                                                                         #
#  You should have received a copy of the GNU General Public License      #
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#                                                                         #
###########################################################################
# This is a wrapper that runs envbot in a sane setup.
# Using a wrapper is really the simplest way to do it.

# Default config file
config_file="bot_settings.sh"
# Default place to load libraries from
#   Also where to load main envbot from. We won't accept any other location
#   for main.sh, but main.sh will for library scripts.
library_dir="lib"

# This work-around is needed on FreeBSD
bash="$(type -p bash)"

# Later arguments on the command line will override the defaults.

# env -i:      Clean environment
# bash --norc: Don't read profile/bashrc
exec env -i "$bash" --norc "${library_dir}/main.sh" --config "$config_file" --libdir "$library_dir" "$@"