Use /etc/os-release to determine build host

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-08-08 17:44:40 -07:00
parent 0f8d9ca491
commit fc5c92cabc
6 changed files with 117 additions and 6 deletions

View File

@ -94,6 +94,29 @@ done
vendor=${params[HOST]}
if [ -z "$vendor" ]; then
if [ -f /etc/os-release ]; then
eval $(cat /etc/os-release | grep ^ID)
case $ID in
fedora)
vendor=redhat
;;
debian)
vendor=debian
;;
opensuse)
vendor=suse
;;
*)
vendor="$ID"
;;
esac
$params[HOST]="
fi
fi
if [ -z "vendor" ]; then
case `uname` in
Darwin)
$params[HOST]=apple

View File

@ -56,6 +56,26 @@ my $vendor = $params{HOST};
my $rcfile;
my $rcfilename;
unless ( defined $vendor ) {
if ( -f /etc/os-release) {
my $id = `cat /etc/os-release | grep ^ID`;
chomp $id;
$id =~ s/ID=//;
if ( $id eq 'fedora' ) {
$vendor = 'redhat';
} elsif ( $id eq 'opensuse' ) {
$vendor = 'suse';
} else {
$vendor = $id;
}
}
$params{HOST} = $vendor;
}
if ( defined $vendor ) {
$rcfilename = $vendor eq 'linux' ? 'shorewallrc.default' : 'shorewallrc.' . $vendor;
die qq("ERROR: $vendor" is not a recognized host type) unless -f $rcfilename;

View File

@ -194,7 +194,24 @@ if [ -z "$BUILD" ]; then
BUILD=apple
;;
*)
if [ -f /etc/debian_version ]; then
if [ -f /etc/os-release ]; then
eval $(cat /etc/os-release | grep ^ID)
case $ID in
fedora)
BUILD=redhat
;;
debian)
BUILD=debian
;;
opensuse)
BUILD=suse
;;
*)
BUILD="$ID"
;;
esac
elif [ -f /etc/debian_version ]; then
BUILD=debian
elif [ -f /etc/redhat-release ]; then
BUILD=redhat

View File

@ -182,7 +182,24 @@ if [ -z "$BUILD" ]; then
BUILD=apple
;;
*)
if [ -f /etc/debian_version ]; then
if [ -f /etc/os-release ]; then
eval $(cat /etc/os-release | grep ^ID)
case $ID in
fedora)
BUILD=redhat
;;
debian)
BUILD=debian
;;
opensuse)
BUILD=suse
;;
*)
BUILD="$ID"
;;
esac
elif [ -f /etc/debian_version ]; then
BUILD=debian
elif [ -f /etc/redhat-release ]; then
BUILD=redhat
@ -222,7 +239,7 @@ case "$HOST" in
debian)
echo "Installing Debian-specific configuration..."
;;
redhat|redhat)
redhat)
echo "Installing Redhat/Fedora-specific configuration..."
;;
slackware)
@ -233,7 +250,7 @@ case "$HOST" in
echo "Shorewall-init is currently not supported on Arch Linux" >&2
exit 1
;;
suse|suse)
suse)
echo "Installing SuSE-specific configuration..."
;;
linux)

View File

@ -200,7 +200,24 @@ if [ -z "$BUILD" ]; then
BUILD=apple
;;
*)
if [ -f ${CONFDIR}/debian_version ]; then
if [ -f /etc/os-release ]; then
eval $(cat /etc/os-release | grep ^ID)
case $ID in
fedora)
BUILD=redhat
;;
debian)
BUILD=debian
;;
opensuse)
BUILD=suse
;;
*)
BUILD="$ID"
;;
esac
elif [ -f ${CONFDIR}/debian_version ]; then
BUILD=debian
elif [ -f ${CONFDIR}/redhat-release ]; then
BUILD=redhat

View File

@ -212,7 +212,24 @@ if [ -z "$BUILD" ]; then
BUILD=apple
;;
*)
if [ -f /etc/debian_version ]; then
if [ -f /etc/os-release ]; then
eval $(cat /etc/os-release | grep ^ID)
case $ID in
fedora)
BUILD=redhat
;;
debian)
BUILD=debian
;;
opensuse)
BUILD=suse
;;
*)
BUILD="$ID"
;;
esac
elif [ -f /etc/debian_version ]; then
BUILD=debian
elif [ -f /etc/redhat-release ]; then
BUILD=redhat