os_version 1.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/bin/sh
#
# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# All os variables are lower case
#
#

Jonas Weber's avatar
Jonas Weber committed
25
case "$("$__explorer/os")" in
26 27 28
   amazon)
      cat /etc/system-release
   ;;
29 30 31 32
   archlinux)
      # empty, but well...
      cat /etc/arch-release
   ;;
Nico Schottelius's avatar
Nico Schottelius committed
33 34
   debian)
      cat /etc/debian_version
35
   ;;
smwltr's avatar
smwltr committed
36 37 38
   devuan)
      cat /etc/devuan_version
   ;;
Nico Schottelius's avatar
Nico Schottelius committed
39 40
   fedora)
      cat /etc/fedora-release
41
   ;;
Nico Schottelius's avatar
Nico Schottelius committed
42 43
   gentoo)
      cat /etc/gentoo-release
44
   ;;
45 46 47 48
   macosx)
      sw_vers -productVersion
   ;;
   *bsd|solaris)
Nico Schottelius's avatar
Nico Schottelius committed
49
      uname -r
50
   ;;
51 52 53
   openwrt)
      cat /etc/openwrt_version
   ;;
54 55 56
   owl)
      cat /etc/owl-release
   ;;
Stephan Leemburg's avatar
Stephan Leemburg committed
57
   redhat|centos|mitel|scientific)
Nico Schottelius's avatar
Nico Schottelius committed
58 59
      cat /etc/redhat-release
   ;;
60 61 62
   slackware)
      cat /etc/slackware-version
   ;;
Nico Schottelius's avatar
Nico Schottelius committed
63
   suse)
64 65 66 67 68
      if [ -f /etc/os-release ]; then
        cat /etc/os-release
      else
        cat /etc/SuSE-release
      fi
Nico Schottelius's avatar
Nico Schottelius committed
69 70 71
   ;;
   ubuntu)
      lsb_release -sr
72
   ;;
73 74 75 76
   alpine)
       cat /etc/alpine-release
   ;;
esac