I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
osid 1.93 KiB
#!/bin/sh

# I2P Installer - Installs and pre-configures I2P.
#
# osid
# 2004 The I2P Project
# http://www.i2p2.de/
# This code is public domain.
#
# author: hypercubus
#
# Identifies the host OS by returning the corresponding standardized ID string:
#
#     debian   = Debian
#     fedora   = Fedora
#     freebsd  = FreeBSD
#     gentoo   = Gentoo
#     linux    = unidentified Linux distro
#     mandrake = Mandrake
#     osx      = Mac OS X
#     redhat   = Red Hat
#     solaris  = Solaris
#     suse     = SuSE
#     unknown  = OS could not be determined

HOST_OS=`uname -a`

if [ "X$HOST_OS" = "X" ]; then
    echo unknown
    exit 0
fi

DARWIN=`echo "$HOST_OS" | grep Darwin`
MAC=`echo "$HOST_OS" | grep Mac`
FREEBSD=`echo "$HOST_OS" | grep FreeBSD`
LINUX=`echo "$HOST_OS" | grep Linux`
SOLARIS=`echo "$HOST_OS" | grep Solaris`
SUNOS=`echo "$HOST_OS" | grep SunOS`

if [ ! "X$DARWIN" = "X" -o ! "X$MAC" = "X" ]; then
    echo osx
    exit 0
fi

if [ ! "X$FREEBSD" = "X" ]; then
    echo freebsd
    exit 0
fi

if [ ! "X$LINUX" = "X" ]; then

    LINUX_DISTRO=`cat /proc/version`
    DEBIAN=`echo $LINUX_DISTRO | grep Debian`
    FEDORA=`echo $LINUX_DISTRO | grep Fedora`
    GENTOO=`echo $LINUX_DISTRO | grep Gentoo`
    MANDRAKE=`echo $LINUX_DISTRO | grep Mandrake`
    REDHAT=`echo $LINUX_DISTRO | grep "Red Hat"`
    SUSE=`echo $LINUX_DISTRO | grep Suse`

    if [ ! "X$DEBIAN" = "X" ]; then
        echo debian
        exit 0
    fi

    if [ ! "X$FEDORA" = "X" ]; then
        echo fedora
        exit 0
    fi

    if [ ! "X$GENTOO" = "X" ]; then
        echo gentoo
        exit 0
    fi

    if [ ! "X$MANDRAKE" = "X" ]; then
        echo mandrake
        exit 0
    fi

    if [ ! "X$REDHAT" = "X" ]; then
        echo redhat
        exit 0
    fi

    if [ ! "X$SUSE" = "X" ]; then
        echo suse
        exit 0
    fi

    echo linux
    exit 0
fi

if [ ! "X$SOLARIS" = "X" -o ! "X$SUNOS" = "X" ]; then
    echo solaris
    exit 0
fi

echo unknown
exit 0