#! /bin/bash
# Copyright (2011) David Francos Cuartero, and some of the sources might be from other versions.
#        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 2
#        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, write to the Free Software
#        Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

! /bin/bash

declare -a -x enabled_plugins
declare -a p_menu

_source(){ for cfile in $@; do if [ -f $cfile ] && [ -O $cfile ]; then source $cfile; else if [ "$debug" == 1 ]; then echo "Could not load $cfile"; sleep 0.2 ;fi; fi; done; }

[[ ! $path ]] && {
	[[ $(dirname ${BASH_SOURCE[0]}) =~ "local" ]] &&  {
		path=/usr/local/share/airoscript-ng
		_source "/usr/local/etc/airoscript-ng_advanced.conf /usr/local/etc/airoscript-ng.conf"
	} || {
		_source "/usr/etc/airoscript-ng_advanced.conf /usr/etc/airoscript-ng.conf"
		_source "/etc/airoscript-ng_advanced.conf /etc/airoscript-ng.conf"
	    path=/usr/share/airoscript-ng
	}
}

_source "$path/_internal $path/menu $path/interface"
_source  "$path/themes/$theme" || default_theme

