mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-11 08:08:12 +01:00
Merge branch '4.5.2'
Conflicts: Shorewall-core/configure.pl Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
commit
f88584b916
91
Shorewall-core/configure
vendored
91
Shorewall-core/configure
vendored
@ -21,10 +21,24 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
#
|
#
|
||||||
# Usage: ./configure <option>=<setting> ...
|
# Usage: ./configure [ <option>=<setting> ] ...
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
################################################################################################
|
################################################################################################
|
||||||
|
#
|
||||||
|
# Build updates this
|
||||||
|
#
|
||||||
|
VERSION=4.5.2.1
|
||||||
|
|
||||||
|
case "$BASH_VERSION" in
|
||||||
|
[4-9].*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: This program requires Bash 4.0 or later" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
declare -A params
|
declare -A params
|
||||||
declare -A options
|
declare -A options
|
||||||
|
|
||||||
@ -46,21 +60,17 @@ getfileparams() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo "Usage: $0 <var>=<val> ..." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
for p in $@; do
|
for p in $@; do
|
||||||
p=${p#--}
|
|
||||||
|
|
||||||
if [ -n "${p}" ]; then
|
if [ -n "${p}" ]; then
|
||||||
declare -u pn
|
declare -u pn
|
||||||
|
|
||||||
pn=${p%=*}
|
pn=${p%=*}
|
||||||
|
pn=${pn#--}
|
||||||
pv=${p#*=}
|
pv=${p#*=}
|
||||||
|
|
||||||
if [ -n "${pn}" ]; then
|
if [ -n "${pn}" ]; then
|
||||||
|
|
||||||
case ${pn} in
|
case ${pn} in
|
||||||
VENDOR)
|
VENDOR)
|
||||||
pn=HOST
|
pn=HOST
|
||||||
@ -77,6 +87,9 @@ for p in $@; do
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
params[${pn}]="${pv}"
|
params[${pn}]="${pv}"
|
||||||
|
else
|
||||||
|
echo "ERROR: Invalid option ($p)" >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -84,22 +97,75 @@ done
|
|||||||
vendor=${params[HOST]}
|
vendor=${params[HOST]}
|
||||||
|
|
||||||
if [ -z "$vendor" ]; then
|
if [ -z "$vendor" ]; then
|
||||||
rcfile=shorewallrc.default
|
case `uname` in
|
||||||
vendor=linux
|
Darwin)
|
||||||
|
$params[HOST]=apple
|
||||||
|
rcfile=shorewallrc.apple
|
||||||
|
;;
|
||||||
|
|
||||||
|
cygwin*)
|
||||||
|
$params[HOST]=cygwin
|
||||||
|
rcfile=shorewallrc.cygwin
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -f /etc/debian_version ]; then
|
||||||
|
params[HOST]=debian
|
||||||
|
rcfile=shorewallrc.debian
|
||||||
|
elif [ -f /etc/redhat-release ]; then
|
||||||
|
params[HOST]=redhat
|
||||||
|
rcfile=shorewallrc.redhat
|
||||||
|
elif [ -f /etc/slackware-version ] ; then
|
||||||
|
params[HOST]=slackware
|
||||||
|
rcfile=shorewallrc.slackware
|
||||||
|
elif [ -f /etc/SuSE-release ]; then
|
||||||
|
params[HOST]=suse
|
||||||
|
rcfile=shorewallrc.suse
|
||||||
|
elif [ -f /etc/arch-release ] ; then
|
||||||
|
params[HOST]=archlinux
|
||||||
|
rcfile=shorewallrc.archlinux
|
||||||
|
else
|
||||||
|
params[HOST]=linux
|
||||||
|
rcfile=shorewallrc.default
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
vendor=${params[HOST]}
|
||||||
|
elif [ $vendor = linux ]; then
|
||||||
|
rcfile=$shorewallrc.default;
|
||||||
else
|
else
|
||||||
rcfile=shorewallrc.$vendor
|
rcfile=shorewallrc.$vendor
|
||||||
|
if [ ! -f $rcfile ]; then
|
||||||
|
echo "ERROR: $vendor is not a recognized host type" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $vendor = linux ]; then
|
||||||
|
echo "INFO: Creating a generic Linux installation - " `date`;
|
||||||
|
else
|
||||||
|
echo "INFO: Creating a ${vendor}-specific installation - " `date`;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
getfileparams < $rcfile || exit 1
|
getfileparams < $rcfile || exit 1
|
||||||
|
|
||||||
for p in ${!params[@]}; do
|
for p in ${!params[@]}; do
|
||||||
options[${p}]="${params[${p}]}"
|
options[${p}]="${params[${p}]}"
|
||||||
options[${p}]="${params[${p}]}"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "HOST=$vendor" > shorewallrc
|
echo '#' > shorewallrc
|
||||||
|
echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc
|
||||||
|
echo '#' >> shorewallrc
|
||||||
|
|
||||||
|
if [ -n "$@" ]; then
|
||||||
|
echo "# Input: $@" >> shorewallrc
|
||||||
|
echo '#' >> shorewallrc
|
||||||
|
fi
|
||||||
|
|
||||||
for on in \
|
for on in \
|
||||||
|
HOST \
|
||||||
PREFIX \
|
PREFIX \
|
||||||
SHAREDIR \
|
SHAREDIR \
|
||||||
LIBEXECDIR \
|
LIBEXECDIR \
|
||||||
@ -118,7 +184,6 @@ for on in \
|
|||||||
ANNOTATED \
|
ANNOTATED \
|
||||||
VARDIR
|
VARDIR
|
||||||
do
|
do
|
||||||
|
echo "$on=${options[${on}]}"
|
||||||
echo "$on=${options[${on}]}" >> shorewallrc
|
echo "$on=${options[${on}]}" >> shorewallrc
|
||||||
done
|
done
|
||||||
|
|
||||||
cat shorewallrc
|
|
||||||
|
@ -27,22 +27,23 @@
|
|||||||
################################################################################################
|
################################################################################################
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build updates this
|
||||||
|
#
|
||||||
|
use constant {
|
||||||
|
VERSION => '4.5.2.1'
|
||||||
|
};
|
||||||
|
|
||||||
my %params;
|
my %params;
|
||||||
my %options;
|
my %options;
|
||||||
|
|
||||||
my %aliases = ( VENDOR => 'HOST',
|
my %aliases = ( VENDOR => 'HOST',
|
||||||
SHAREDSTATEDIR => 'VARDIR',
|
SHAREDSTATEDIR => 'VARDIR',
|
||||||
DATADIR => 'SHAREDIR',
|
DATADIR => 'SHAREDIR',
|
||||||
SYSCONFDIR => 'CONFDIR' );
|
SYSCONFDIR => 'CONFDIR' );
|
||||||
|
|
||||||
die "Usage: $0 <var>=<val> ..." unless @ARGV;
|
for ( @ARGV ) {
|
||||||
|
die "ERROR: Invalid option specification ( $_ )" unless /^(?:--)?(\w+)=(.*)$/;
|
||||||
for ( @ARGV) {
|
|
||||||
s/^--//;
|
|
||||||
|
|
||||||
next unless defined $_ && $_ ne '';
|
|
||||||
|
|
||||||
die "Invalid option specification ( $_ )" unless /^(\w+)=(.*)$/;
|
|
||||||
|
|
||||||
my $pn = uc $1;
|
my $pn = uc $1;
|
||||||
my $pv = $2 || '';
|
my $pv = $2 || '';
|
||||||
@ -57,21 +58,56 @@ my $rcfile;
|
|||||||
my $rcfilename;
|
my $rcfilename;
|
||||||
|
|
||||||
if ( defined $vendor ) {
|
if ( defined $vendor ) {
|
||||||
$rcfilename = 'shorewallrc.' . $vendor;
|
$rcfilename = $vendor eq 'linux' ? 'shorewallrc.default' : 'shorewallrc.' . $vendor;
|
||||||
|
die qq("ERROR: $vendor" is not a recognized host type) unless -f $rcfilename;
|
||||||
} else {
|
} else {
|
||||||
$rcfilename = 'shorewallrc.default';
|
if ( -f '/etc/debian_version' ) {
|
||||||
$params{HOST} = 'linux';
|
$vendor = 'debian';
|
||||||
|
$rcfilename = 'shorewallrc.debian';
|
||||||
|
} elsif ( -f '/etc/redhat-release' ){
|
||||||
|
$vendor = 'redhat';
|
||||||
|
$rcfilename = 'shorewallrc.redhat';
|
||||||
|
} elsif ( -f '/etc/slackware-version' ) {
|
||||||
|
$vendor = 'slackware';
|
||||||
|
$rcfilename = 'shorewallrc.slackware';
|
||||||
|
} elsif ( -f '/etc/SuSE-release' ) {
|
||||||
|
$vendor = 'suse';
|
||||||
|
$rcfilename = 'shorewallrc.suse';
|
||||||
|
} elsif ( -f '/etc/arch-release' ) {
|
||||||
|
$vendor = 'archlinux';
|
||||||
|
$rcfilename = 'shorewallrc.archlinux';
|
||||||
|
} elsif ( `uname` =~ '^Darwin' ) {
|
||||||
|
$vendor = 'apple';
|
||||||
|
$rcfilename = 'shorewallrc.apple';
|
||||||
|
} elsif ( `uname` =~ '^Cygwin' ) {
|
||||||
|
$vendor = 'cygwin';
|
||||||
|
$rcfilename = 'shorewallrc.cygwin';
|
||||||
|
} else {
|
||||||
|
$vendor = 'linux';
|
||||||
|
$rcfilename = 'shorewallrc.default';
|
||||||
|
}
|
||||||
|
|
||||||
|
$params{HOST} = $vendor;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @localtime = localtime;
|
||||||
|
my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
|
||||||
|
|
||||||
|
if ( $vendor eq 'linux' ) {
|
||||||
|
printf "INFO: Creating a generic Linux installation - %s %2d %04d %02d:%02d:%02d\n\n", $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];;
|
||||||
|
} else {
|
||||||
|
printf "INFO: Creating a %s-specific installation - %s %2d %04d %02d:%02d:%02d\n\n", $vendor, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];;
|
||||||
}
|
}
|
||||||
|
|
||||||
open $rcfile, '<', $rcfilename or die "Unable to open $rcfilename for input: $!";
|
open $rcfile, '<', $rcfilename or die "Unable to open $rcfilename for input: $!";
|
||||||
|
|
||||||
while ( <$rcfile> ) {
|
while ( <$rcfile> ) {
|
||||||
next if /^\s*#/;
|
|
||||||
s/\s*#.*//;
|
s/\s*#.*//;
|
||||||
next if /^\s*$/;
|
unless ( /^\s*$/ ) {
|
||||||
chomp;
|
chomp;
|
||||||
die "Invalid entry ($_) in $rcfilename, line $." unless /\s*(\w+)=(.*)/;
|
die "ERROR: Invalid entry ($_) in $rcfilename, line $." unless /\s*(\w+)=(.*)/;
|
||||||
$options{$1} = $2;
|
$options{$1} = $2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
close $rcfile;
|
close $rcfile;
|
||||||
@ -84,6 +120,10 @@ my $outfile;
|
|||||||
|
|
||||||
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
|
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
|
||||||
|
|
||||||
|
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n#\n", VERSION, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];
|
||||||
|
|
||||||
|
print $outfile "# Input: @ARGV\n#\n" if @ARGV;
|
||||||
|
|
||||||
for ( qw/ HOST
|
for ( qw/ HOST
|
||||||
PREFIX
|
PREFIX
|
||||||
SHAREDIR
|
SHAREDIR
|
||||||
|
@ -373,8 +373,10 @@ fi
|
|||||||
#
|
#
|
||||||
# Install the Makefile
|
# Install the Makefile
|
||||||
#
|
#
|
||||||
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}${SHAREDIR}/$PRODUCT
|
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||||
echo "Makefile installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/Makefile"
|
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile
|
||||||
|
[ $SBINDIR = /sbin ] || eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile
|
||||||
|
echo "Makefile installed as ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Install the default config path file
|
# Install the default config path file
|
||||||
|
@ -957,9 +957,11 @@ echo "Standard actions file installed as ${DESTDIR}${SHAREDIR}d/$PRODUCT/actions
|
|||||||
# Install the Makefiles
|
# Install the Makefiles
|
||||||
#
|
#
|
||||||
run_install $OWNERSHIP -m 0644 Makefile-lite ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/Makefile
|
run_install $OWNERSHIP -m 0644 Makefile-lite ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/Makefile
|
||||||
|
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/Makefile
|
||||||
|
[ $SBINDIR = /sbin ] || eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/Makefile
|
||||||
|
|
||||||
if [ -z "$SPARSE" ]; then
|
if [ -z "$SPARSE" ]; then
|
||||||
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}${CONFDIR}/$PRODUCT
|
run_install $OWNERSHIP -m 0600 ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/Makefile ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||||
echo "Makefile installed as ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile"
|
echo "Makefile installed as ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user