Compiler changes for Shorewall[6]-lite relocation

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-04-02 07:46:38 -07:00
parent a11e2dd452
commit 348c99c7d0
3 changed files with 31 additions and 35 deletions

View File

@ -148,7 +148,9 @@ sub generate_script_2() {
' #',
' # Be sure that umask is sane',
' #',
' umask 077',
' umask 077' );
emit ( '',
' #',
' # These variables are required by the library functions called in this script',
' #'
@ -156,21 +158,27 @@ sub generate_script_2() {
push_indent;
if ( $shorewallrc{TEMPDIR} ) {
emit( '',
qq(TMPDIR="$shorewallrc{TEMPDIR}") ,
q(export TMPDIR) );
}
if ( $family == F_IPV4 ) {
emit( 'g_family=4' );
if ( $export ) {
emit ( 'SHAREDIR=$SHAREDIR/shorewall-lite',
'CONFDIR=$CONFDIR/shorewall-lite',
'VARDIR=$VARDIR/shorewall-lite',
emit ( qq(SHAREDIR=$shorewallrc{SHAREDIR}/shorewall-lite),
qq(CONFDIR=$shorewallrc{CONFDIR}/shorewall-lite),
qq(VARDIR=$shorewallrc{VARDIR}/shorewall-lite),
'g_product="Shorewall Lite"',
'g_program=shorewall-lite',
'g_basedir=/usr/share/shorewall-lite',
);
} else {
emit ( 'SHAREDIR=$SHAREDIR/shorewall',
'CONFDIR=$CONFDIR/shorewall',
'VARDIR=$VARDIR/shorewall',
emit ( qq(SHAREDIR=$shorewallrc{SHAREDIR}/shorewall),
qq(CONFDIR=$shorewallrc{CONFDIR}/shorewall),
qq(VARDIR=$shorewallrc{VARDIR}/shorewall),
'g_product=Shorewall',
'g_program=shorewall',
'g_basedir=/usr/share/shorewall',
@ -180,17 +188,17 @@ sub generate_script_2() {
emit( 'g_family=6' );
if ( $export ) {
emit ( 'SHAREDIR=/$SHAREDIR/shorewall6-lite',
'CONFDIR=$CONFDIR/shorewall6-lite',
'VARDIR=$VARDIR/shorewall6-lite',
emit ( qq(SHAREDIR=$shorewallrc{SHAREDIR}/shorewall6-lite),
qq(CONFDIR=$shorewallrc{CONFDIR}/shorewall6-lite),
qq(VARDIR=$shorewallrc{VARDIR}/shorewall6-lite),
'g_product="Shorewall6 Lite"',
'g_program=shorewall6-lite',
'g_basedir=/usr/share/shorewall6',
);
} else {
emit ( 'SHAREDIR=/usr/share/shorewall6',
'CONFDIR=/etc/shorewall6',
'VARDIR=$VARDIR/shorewall6',
emit ( qq(SHAREDIR=$shorewallrc{SHAREDIR}/shorewall6),
qq(CONFDIR=$shorewallrc{CONFDIR}/shorewall6),
qq(VARDIR=$shorewallrc{VARDIR}/shorewall6}),
'g_product=Shorewall6',
'g_program=shorewall6',
'g_basedir=/usr/share/shorewall'

View File

@ -85,27 +85,6 @@ g_noroutes=$NOROUTES
g_timestamp=$TIMESTAMP
g_recovering=$RECOVERING
if [ -f ./.shorewallrc ]; then
. ./.shorewallrc || exit 1
elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
elif [ -r /root/.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif [ -r /.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then
. ${SHOREAWLLRC_HOME}/.shorewallrc || exit 1
else
CONFDIR=/etc
SHAREDIR=/usr/share
VARDIR=/var/lib
fi
if [ -n "$TEMPDIR" ]; then
TMPDIR="$TEMPDIR"
export TMPDIR
fi
initialize
if [ -n "$STARTUP_LOG" ]; then

View File

@ -366,6 +366,8 @@ uptodate() {
#
compiler() {
local pc
local shorewallrc
pc=$g_libexec/shorewall/compiler.pl
if [ $(id -u) -ne 0 ]; then
@ -401,7 +403,14 @@ compiler() {
[ "$1" = nolock ] && shift;
shift
options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH --shorewallrc=${g_sharedir}/shorewall/shorewallrc"
if [ -n "$g_export" ]; then
shorewallrc=$(find_file shorewallrc)
[ -f "$shorewallrc" ] || fatal_error "Compiling for export requires a shorewallrc file"
else
shorewallrc="${g_sharedir}/shorewall/shorewallrc"
fi
options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH --shorewallrc=${shorewallrc}"
[ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
[ -n "$LOG_VERBOSITY" ] && options="$options --log_verbosity=$LOG_VERBOSITY";
[ -n "$g_export" ] && options="$options --export"