Skip to content

Instantly share code, notes, and snippets.

@pforai
Created January 23, 2013 09:36
Show Gist options
  • Save pforai/4603671 to your computer and use it in GitHub Desktop.
Save pforai/4603671 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# WE SO COOL. WE WRITE /etc/*-release IN DIFFRENT FORMATS!!11
# welcome to linux.
release=`grep 'SUSE\|ubuntu\|Red Hat\|CentOS' -A10 -B10 /etc/*release | tr '[:upper:]' '[:lower:]'`
case $release in
*suse*version*11*patchlevel*0) RELSTRING=sles-11-sp0 ;;
*suse*version*11*patchlevel*1) RELSTRING=sles-11-sp1 ;;
*suse*version*11*patchlevel*2) RELSTRING=sles-11-sp2 ;;
*suse*version*11*patchlevel*3) RELSTRING=sles-11-sp3 ;;
*suse*version*11*patchlevel*4) RELSTRING=sles-11-sp4 ;;
*ubuntu*12.04*) RELSTRING=ubuntu-12.04 ;;
*red\ hat*6.1*) RELSTRING=rhel-6.1 ;;
*red\ hat*6.2*) RELSTRING=rhel-6.2 ;;
*red\ hat*6.3*) RELSTRING=rhel-6.3 ;;
*red\ hat*6.4*) RELSTRING=rhel-6.4 ;;
*centos*6.2*) RELSTRING=centos-6.2 ;;
*centos*6.3*) RELSTRING=centos-6.3 ;;
*centos*6.4*) RELSTRING=centos-6.4 ;;
*) RELSTRING="unkown distribution" ; exit 1 ;;
esac
export RELSTRING
#EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment