#!/bin/sh # Returns an "os" attribute to Mender containing the currently running OS. set -e for file in /etc/os-release /usr/lib/os-release; do if [ ! -e $file ]; then continue fi eval "$(egrep '^(PRETTY_NAME|NAME|VERSION)=("[^"]*"|[^" ]*)' $file)" if [ -n "$PRETTY_NAME" ]; then echo "os=$PRETTY_NAME" exit 0 elif [ -n "$NAME" -a -n "$VERSION" ]; then echo "os=$NAME $VERSION" exit 0 fi done for lsb_release in /bin/lsb_release /usr/bin/lsb_release; do if [ -x $lsb_release ]; then OS="$($lsb_release -sd)" if [ -n "$OS" ]; then echo "os=$OS" exit 0 fi fi done if [ -e /etc/issue ]; then OS="$(cat /etc/issue)" if [ -n "$OS" ]; then echo "os=$OS" exit 0 fi fi echo "os=unknown" exit 0