Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiemKorteweg <Siem.Korteweg@qnh.nl>2015-10-10 14:25:14 +0300
committerSiemKorteweg <Siem.Korteweg@qnh.nl>2015-10-10 14:25:14 +0300
commit0c48fc3880551d862063e56a029ce43082df376a (patch)
treed57f59a582b3d457fccd0dad6f32b3513ebf294f /include/osdetection
parentc0378f38f517e916b141a8bc5049eb742e66d48f (diff)
Optimized use of cat, grep and awk.
Detection of duplicate entries in /etc/hosts is now more robust. On CentOS7 the SERVICE_MANAGER is detected correctly.
Diffstat (limited to 'include/osdetection')
-rw-r--r--include/osdetection28
1 files changed, 14 insertions, 14 deletions
diff --git a/include/osdetection b/include/osdetection
index dbb0d1d8..3aa6af34 100644
--- a/include/osdetection
+++ b/include/osdetection
@@ -114,7 +114,7 @@
FIND=`grep "Amazon" /etc/system-release`
if [ ! "${FIND}" = "" ]; then
OS_REDHAT_OR_CLONE=1
- OS_FULLNAME=`cat /etc/system-release | grep "^Amazon"`
+ OS_FULLNAME=`grep "^Amazon" /etc/system-release`
OS_VERSION=`grep "^Amazon" /etc/system-release | awk '{ if ($4=="release") { print $5 } }'`
LINUX_VERSION="Amazon"
fi
@@ -129,8 +129,8 @@
# Chakra Linux
if [ -e "/etc/chakra-release" ]; then
- OS_FULLNAME=`cat /etc/chakra-release | grep "^Chakra"`
- OS_VERSION=`cat /etc/chakra-release | grep "^Chakra" | awk '{ if ($3=="release") { print $4 }}'`
+ OS_FULLNAME=`grep "^Chakra" /etc/chakra-release`
+ OS_VERSION=`awk '/^Chakra/ { if ($3=="release") { print $4 }}' /etc/chakra-release`
LINUX_VERSION="Chakra Linux"
fi
@@ -162,7 +162,7 @@
OS_FULLNAME="Debian ${OS_VERSION}"
LINUX_VERSION="Debian"
fi
- # Ubuntu test (optional) `cat /proc/version | grep "[Uu]buntu"`
+ # Ubuntu test (optional) `grep "[Uu]buntu" /proc/version`
fi
# E-smith
if [ -e "/etc/e-smith-release" ]; then OS_FULLNAME=`cat /etc/e-smith-release`; fi
@@ -176,7 +176,7 @@
# CentOS
FIND=`grep "CentOS" /etc/redhat-release`
if [ ! "${FIND}" = "" ]; then
- OS_FULLNAME=`cat /etc/redhat-release | grep "CentOS"`
+ OS_FULLNAME=`grep "CentOS" /etc/redhat-release`
LINUX_VERSION="CentOS"
OS_VERSION="${OS_FULLNAME}"
fi
@@ -184,7 +184,7 @@
# ClearOS
FIND=`grep "ClearOS" /etc/redhat-release`
if [ ! "${FIND}" = "" ]; then
- OS_FULLNAME=`cat /etc/redhat-release | grep "ClearOS"`
+ OS_FULLNAME=`grep "ClearOS" /etc/redhat-release`
LINUX_VERSION="ClearOS"
OS_VERSION="${OS_FULLNAME}"
fi
@@ -192,7 +192,7 @@
# Fedora
FIND=`grep "Fedora" /etc/redhat-release`
if [ ! "${FIND}" = "" ]; then
- OS_FULLNAME=`cat /etc/redhat-release | grep "Fedora"`
+ OS_FULLNAME=`grep "Fedora" /etc/redhat-release`
OS_VERSION="${OS_FULLNAME}"
LINUX_VERSION="Fedora"
fi
@@ -200,7 +200,7 @@
# Mageia (has also /etc/megaia-release)
FIND=`grep "Mageia" /etc/redhat-release`
if [ ! "${FIND}" = "" ]; then
- OS_FULLNAME=`cat /etc/redhat-release | grep "^Mageia"`
+ OS_FULLNAME=`grep "^Mageia" /etc/redhat-release`
OS_VERSION=`grep "^Mageia" /etc/redhat-release | awk '{ if ($2=="release") { print $3 } }'`
LINUX_VERSION="Mageia"
fi
@@ -209,7 +209,7 @@
FIND=`grep "Enterprise Linux Enterprise Linux Server" /etc/redhat-release`
if [ ! "${FIND}" = "" ]; then
LINUX_VERSION="Oracle Enterprise Linux";
- OS_FULLNAME=`cat /etc/redhat-release | grep "Enterprise Linux"`;
+ OS_FULLNAME=`grep "Enterprise Linux" /etc/redhat-release`;
OS_VERSION="${OS_FULLNAME}";
fi
@@ -218,7 +218,7 @@
FIND=`grep "Oracle Linux Server" /etc/oracle-release`
if [ ! "${FIND}" = "" ]; then
LINUX_VERSION="Oracle Enterprise Linux";
- OS_FULLNAME=`cat /etc/oracle-release | grep "Oracle Linux"`;
+ OS_FULLNAME=`grep "Oracle Linux" /etc/oracle-release`;
OS_VERSION="${OS_FULLNAME}";
fi
fi
@@ -228,7 +228,7 @@
FIND=`grep "Oracle VM" /etc/ovs-release`
if [ ! "${FIND}" = "" ]; then
LINUX_VERSION="Oracle VM Server";
- OS_FULLNAME=`cat /etc/ovs-release | grep "Oracle VM"`;
+ OS_FULLNAME=`grep "Oracle VM" /etc/ovs-release`;
OS_VERSION="${OS_FULLNAME}";
fi
fi
@@ -236,7 +236,7 @@
# Red Hat
FIND=`grep "Red Hat" /etc/redhat-release`
if [ ! "${FIND}" = "" ]; then
- OS_FULLNAME=`cat /etc/redhat-release | grep "Red Hat"`
+ OS_FULLNAME=`grep "Red Hat" /etc/redhat-release`
OS_VERSION="${OS_FULLNAME}"
LINUX_VERSION="Red Hat"
fi
@@ -244,7 +244,7 @@
# Scientific
FIND=`grep "Scientific" /etc/redhat-release`
if [ ! "${FIND}" = "" ]; then
- OS_FULLNAME=`cat /etc/redhat-release | grep "^Scientific"`
+ OS_FULLNAME=`grep "^Scientific" /etc/redhat-release`
OS_VERSION=`grep "^Scientific" /etc/redhat-release | awk '{ if ($3=="release") { print $4 } }'`
LINUX_VERSION="Scientific"
fi
@@ -273,7 +273,7 @@
fi
if [ -f /etc/SLOX-release ]; then
- OS_FULLNAME=`cat /etc/SLOX-release | grep "SuSE Linux"`
+ OS_FULLNAME=`grep "SuSE Linux" /etc/SLOX-release`
LINUX_VERSION="SuSE"
fi