Skip to content

Instantly share code, notes, and snippets.

@lukasz-golebiewski
Created November 15, 2015 16:55
Show Gist options
  • Save lukasz-golebiewski/34390c0af64fa46eec93 to your computer and use it in GitHub Desktop.
Save lukasz-golebiewski/34390c0af64fa46eec93 to your computer and use it in GitHub Desktop.
detect_distro()
{
if which lsb_release >/dev/null; then
local R=$(lsb_release -d -s)
echo "Distribution discovered: $R"
if [ -z "${R##Ubuntu 14.*}" ]; then
SYSTEMINITDAEMON=upstart
elif [ -z "${R##Ubuntu 15.04*}" ]; then
SYSTEMINITDAEMON=systemd
fi
else
echo "WARNING: Unknown distribution, assuming defaults - this may fail." >&2
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment