From f4fef3a931c921ec94a14c31b50a29e9dd871778 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 29 Nov 2015 09:06:39 -0800 Subject: [PATCH] Configure script corrections for Debian - Matt Darfeuille and Tom Eastep Signed-off-by: Tom Eastep --- Shorewall-core/configure | 20 ++++++++++++-------- Shorewall-core/configure.pl | 25 +++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Shorewall-core/configure b/Shorewall-core/configure index 2a10565a3..6aecc88a8 100755 --- a/Shorewall-core/configure +++ b/Shorewall-core/configure @@ -102,7 +102,7 @@ if [ -z "$vendor" ]; then vendor=redhat ;; debian|ubuntu) - ls -l /sbin/init |fgrep -q systemd | vendor=debian.systemd | vendor=debian.sysvinit + vendor=debian ;; opensuse) vendor=suse @@ -122,7 +122,6 @@ if [ -z "$vendor" ]; then params[HOST]=apple rcfile=shorewallrc.apple ;; - cygwin*|CYGWIN*) params[HOST]=cygwin rcfile=shorewallrc.cygwin @@ -130,7 +129,7 @@ if [ -z "$vendor" ]; then *) if [ -f /etc/debian_version ]; then params[HOST]=debian - rcfile=shorewallrc.debian.sysvinit + ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit elif [ -f /etc/redhat-release ]; then params[HOST]=redhat rcfile=shorewallrc.redhat @@ -152,12 +151,16 @@ if [ -z "$vendor" ]; then fi ;; esac - vendor=${params[HOST]} -elif [ $vendor = linux ]; then - rcfile=shorewallrc.default; else - rcfile=shorewallrc.$vendor + if [ $vendor = linux ]; then + rcfile=shorewallrc.default; + elif [ $vendor = debian -a -f /etc/debian_version ]; then + ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit + else + rcfile=shorewallrc.$vendor + fi + if [ ! -f $rcfile ]; then echo "ERROR: $vendor is not a recognized host type" >&2 exit 1 @@ -170,7 +173,7 @@ fi if [ $vendor = linux ]; then echo "INFO: Creating a generic Linux installation - " `date`; else - echo "INFO: Creating a ${vendor}-specific installation - " `date`; + echo "INFO: Creating a $params[HOST]-specific installation - " `date`; fi echo @@ -183,6 +186,7 @@ done echo '#' > shorewallrc echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc +echo "# rc file: $rcfile" >> shorewallrc echo '#' >> shorewallrc if [ $# -gt 0 ]; then diff --git a/Shorewall-core/configure.pl b/Shorewall-core/configure.pl index 466f35a93..c2ddbd311 100755 --- a/Shorewall-core/configure.pl +++ b/Shorewall-core/configure.pl @@ -81,7 +81,20 @@ unless ( defined $vendor ) { } if ( defined $vendor ) { - $rcfilename = $vendor eq 'linux' ? 'shorewallrc.default' : 'shorewallrc.' . $vendor; + if ( $vendor eq 'debian' && -f '/etc/debian_version' ) { + if ( -l '/sbin/init' ) { + if ( readlink '/sbin/init' =~ /systemd/ ) { + $rcfilename = 'debian.systemd'; + } else { + $rcfilename = 'shorewallrc.debian.sysvinit'; + } + } else { + $rcfilename = 'shorewallrc.debian.sysvinit'; + } + } else { + $rcfilename = $vendor eq 'linux' ? 'shorewallrc.default' : 'shorewallrc.' . $vendor; + } + unless ( -f $rcfilename ) { die qq("ERROR: $vendor" is not a recognized host type); } elsif ( $vendor eq 'default' ) { @@ -90,7 +103,15 @@ if ( defined $vendor ) { } else { if ( -f '/etc/debian_version' ) { $vendor = 'debian'; - $rcfilename = 'shorewallrc.debian.sysvinit'; + if ( -l '/sbin/init' ) { + if ( readlink '/sbin/init' =~ /systemd/ ) { + $rcfilename = 'debian.systemd'; + } else { + $rcfilename = 'shorewallrc.debian.sysvinit'; + } + } else { + $rcfilename = 'shorewallrc.debian.sysvinit'; + } } elsif ( -f '/etc/redhat-release' ){ $vendor = 'redhat'; $rcfilename = 'shorewallrc.redhat';