Most recent distributions have a tool called lsb_release. Your /etc/*-release will be using /etc/lsb-release anyway, so if that file is there, running lsb_release should work too.
I think uname to get ARCH is still the best way.
e.g.
OS=$(lsb_release -si)
ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/')
VER=$(lsb_release -sr)
Or you could just source /etc/lsb-release:
. /etc/lsb-release
OS=$DISTRIB_ID
ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/')
VER=$DISTRIB_RELEASE
If you have to be compatible with older distributions, there is no single file you can rely on. Either fall back to the output from uname, e.g.
OS=$(uname -s)
ARCH=$(uname -m)
VER=$(uname -r)
or handle each distribution separately:
if [ -f /etc/debian_version ]; then
OS=Debian # XXX or Ubuntu??
VER=$(cat /etc/debian_version)
elif [ -f /etc/redhat-release ]; then
...
Of course, you can combine all this:
ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/')
if [ -f /etc/lsb-release ]; then
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
OS=Debian # XXX or Ubuntu??
VER=$(cat /etc/debian_version)
elif [ -f /etc/redhat-release ]; then
...