Tighten up dependency handling

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6749 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-07-02 19:47:46 +00:00
parent 8efc2d9b91
commit a066fba60f
7 changed files with 16 additions and 30 deletions

View File

@ -96,22 +96,21 @@ sub generate_script_1() {
'VARDIR=/var/lib/shorewall-lite',
'PRODUCT="Shorewall Lite"'
);
copy "$globals{SHAREDIR}/lib.base";
emitj ( '################################################################################',
'# End of /usr/share/shorewall/lib.base',
'################################################################################'
);
} else {
emitj ( 'SHAREDIR=/usr/share/shorewall',
'CONFDIR=/etc/shorewall',
'VARDIR=/var/lib/shorewall',
'PRODUCT=\'Shorewall\'',
'. /usr/share/shorewall/lib.base'
);
}
copy "$globals{SHAREDIRPL}/lib.base";
emitj ( '################################################################################',
'# End of /usr/share/shorewall-perl/lib.base',
'################################################################################'
);
emit "TEMPFILE=\n";
for my $exit qw/init start tcclear started stop stopped clear/ {

View File

@ -936,22 +936,6 @@ sub ensure_config_path() {
}
}
#
# Ensure that the version of Shorewall-common currently installed is acceptable
#
sub validate_shorewall_common() {
my $f = "$globals{SHAREDIR}/version";
fatal_error "$f does not exist" unless -f $f;
fatal_error "$f is empty" unless -s _;
open V, '<', $f or fatal_error "Cannot open $f: $!";
my $version = <V>;
close V;
chomp $version;
fatal_error "Invalid $f contents" unless $version =~ /(\d+)\.(\d+)\.(\d+)/;
$version = ( $1 * 10000 ) + ( $2 * 100 ) + $3;
fatal_error "Shorewall-perl $globals{VERSION} requires shorewall-common >= $globals{MIN_COMMON_VERSION_PRINTABLE}" unless $version >= $globals{MIN_COMMON_VERSION};
}
#
# Set $shorewall_dir
#
@ -1047,8 +1031,6 @@ sub get_configuration( $ ) {
my $export = $_[0];
validate_shorewall_common;
ensure_config_path;
process_shorewall_conf;

View File

@ -182,6 +182,9 @@ for f in Shorewall/*.pm ; do
echo "Module ${f%.*} installed as ${PREFIX}/usr/share/shorewall-perl/$f"
done
install_file lib.base ${PREFIX}/usr/share/shorewall-perl/lib.base 0644
echo "Shell library lib.base installed as ${PREFIX}/usr/share/shorewall-perl/lib.base";
#
# Install the program skeleton files
#

View File

@ -63,6 +63,7 @@ fi
%attr(755,root,root) /usr/share/shorewall-perl/buildports.pl
%attr(755,root,root) /usr/share/shorewall-perl/compiler.pl
%attr(0644,root,root) /usr/share/shorewall-perl/lib.base
%attr(0644,root,root) /usr/share/shorewall-perl/prog.header
%attr(0644,root,root) /usr/share/shorewall-perl/prog.functions
%attr(0644,root,root) /usr/share/shorewall-perl/prog.footer

View File

@ -35,8 +35,8 @@
# SHOREWALL_DIR A directory name was passed to /sbin/shorewall
# VERBOSE Standard Shorewall verbosity control.
MIN_COMMON_VERSION=40000
MIN_COMMON_VERSION_PRINTABLE=4.0.0
COMMON_VERSION=40000
COMMON_VERSION_PRINTABLE=4.0.0
#
# Fatal error -- stops the compiler after issuing the error message
@ -5741,7 +5741,7 @@ done
VERSION=$(cat $SHELLSHAREDIR/version)
[ $SHOREWALL_LIBVERSION -ge $MIN_COMMON_VERSION ] || fatal_error "Shorewall-shell $VERSION requires Shorewall-common >= $MIN_COMMON_VERSION_PRINTABLE"
[ $SHOREWALL_LIBVERSION -ne $COMMON_VERSION ] || fatal_error "Shorewall-shell $VERSION requires Shorewall-common $MIN_COMMON_VERSION_PRINTABLE"
PROGRAM=compiler

View File

@ -13,7 +13,7 @@ Source: %{name}-%{version}.tgz
URL: http://www.shorewall.net/
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: iptables iproute shorewall-common >= 4.0.0
Requires: iptables iproute shorewall-common = 4.0.0-0RC1
Provides: shorewall_compiler = %{version}-%{release}
Provides: shorewall = %{version}-%{release}
Obsoletes: shorewall < 4.0.0-0Beta7

View File

@ -346,6 +346,7 @@ if [ -n "${BUILDTARBALL}${BUILDRPM}" ]; then
do_or_die "cp $SHOREWALLDIR/modules $SHOREWALLLITEDIR >> $LOGFILE 2>&1"
if [ -f $SHOREWALLDIR/lib.base ]; then
do_or_die "cp $SHOREWALLDIR/lib.base $SHOREWALLLITEDIR >> $LOGFILE 2>&1"
do_or_die "cp $SHOREWALLDIR/lib.base $PERLDIR >> $LOGFILE 2>&1"
if [ -f $SHOREWALLDIR/lib.cli ]; then
do_or_die "cp $SHOREWALLDIR/lib.cli $SHOREWALLLITEDIR >> $LOGFILE 2>&1"
fi