jw-pkg/scripts/get_os.sh
2014-12-04 19:11:09 +00:00

86 lines
2.7 KiB
Bash

#!/bin/sh
########################################################################
# #
# generic utiltiy modules #
# (c) 2001 jannet it services #
# contact@jannet.de #
# #
# $Id$
# #
# This program is free software; permission to use, copy, modify, #
# distribute, and sell this software and its documentation under the #
# terms of the GNU Public license as published by the Free Software #
# Foundation, either version 2 or any later version of the license, is #
# hereby granted without fee, provided that (i) the above copyright #
# notices and this permission notice appear in all copies of the #
# software and related documentation, and (ii) the name of JanNet may #
# not be used in any advertising or publicity relating to the software #
# without the specific, prior written permission of JanNet. #
# #
# This program is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- #
# TABILITY 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 this program; if not, write to the Free Software Founda- #
# tion, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #
# #
########################################################################
usage()
{
echo "
usage: $myname [-h]
$myname [-v]
"
[ "$1" ] && exit $1
}
# --- here we go
myname=`basename $0`
release_file=/etc/os-release
set -- `getopt 'hv' $*`
while [ "$1" != -- ] ; do
case "$1" in
-h)
usage 0
;;
-v)
opt_verbose=1;
;;
*)
usage 1
;;
esac
shift
done
shift
if [ -r /etc/os-release ]; then
. /etc/os-release
if [ "$opt_verbose" ]; then
echo $NAME $VERSION
else
echo $ID-$VERSION_ID | sed 's/opensuse/suse/g'
fi
exit
fi
if [ -e /etc/SuSE-release ]; then
if [ "$opt_verbose" ]; then
head -1 /etc/SuSE-release
else
VERSION="`grep VERSION /etc/SuSE-release | sed -e 's/.*=//; s/ //g'`"
echo suse-$VERSION
fi
exit
fi
if [ "$opt_verbose" ]; then
uname -a
else
uname -r
fi