Skip to content

Commit

Permalink
Merge pull request #525 from ceetav/rhel_detection
Browse files Browse the repository at this point in the history
simplify distro detection for RHEL-derivatives
  • Loading branch information
Seth Thomas committed Jan 25, 2016
2 parents ccbedc8 + 9c191bb commit 080a635
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions scripts/centos/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#!/bin/sh -eux

if [ -s /etc/oracle-release ]; then
distro='oracle'
elif [ -s /etc/enterprise-release ]; then
distro='oracle'
elif [ -s /etc/redhat-release ]; then
# should ouput 'centos' OR 'red hat'
distro=`cat /etc/redhat-release | sed 's/^\(CentOS\|Red Hat\).*/\1/i' | tr '[:upper:]' '[:lower:]'`
fi

# should output one of 'redhat' 'centos' 'oraclelinux'
distro="`rpm -qf --queryformat '%{NAME}' /etc/redhat-release | cut -f 1 -d '-'`"

# Remove development and kernel source packages
yum -y remove gcc cpp kernel-devel kernel-headers perl;

if [ "$distro" != 'red hat' ]; then
if [ "$distro" != 'redhat' ]; then
yum -y clean all;
fi

Expand Down

0 comments on commit 080a635

Please sign in to comment.