VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/VBoxSysInfo.sh@ 5740

Last change on this file since 5740 was 5740, checked in by vboxsync, 17 years ago

Installer (Linux): added licence information to VBoxSysInfo.sh

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1#!/bin/sh
2
3# @file
4#
5# Installer (Unix-like)
6# Information about the host system/Linux distribution
7
8# Copyright (C) 2006-2007 innotek GmbH
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License as published by the Free Software Foundation,
14# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15# distribution. VirtualBox OSE is distributed in the hope that it will
16# be useful, but WITHOUT ANY WARRANTY of any kind.
17
18# Print information about a Linux system
19# @param distribution name of the distribution
20# @param version version of the distribution
21print_linux_info () {
22 # The following regex is not quite correct for an e-mail address, as
23 # the local part may not start or end with a dot. Please correct if
24 # this upsets you.
25 kern_ver=`cat /proc/version | sed -e 's/ ([a-zA-Z0-9.!#$%*/?^{}\`+=_-]*@[a-zA-Z0-9.-]*)//'`
26 echo "Distribution: $1 | Version: $2 | Kernel: $kern_ver"
27}
28
29# Determine the distribution name and release for a Linux system and print
30# send the information to stdout using the print_linux_info function.
31# For practical reasons (i.e. lack of time), this function only gives
32# information for distribution releases considered "of interest" and reports
33# others as unknown. It can be extended later if other distributions are
34# found to be "of interest".
35get_linux_info () {
36 if [ -r /etc/lsb-release ] && grep Ubuntu /etc/lsb-release >/dev/null 2>&1
37 then
38 # Ubuntu-based system
39 . /etc/lsb-release
40 print_linux_info "Ubuntu" $DISTRIB_RELEASE
41 elif [ -r /etc/debian_version ]
42 then
43 # Debian-based system
44 release=`cat /etc/debian_version`
45 print_linux_info "Debian" $release
46 elif [ -r /etc/mandriva-release ]
47 then
48 # Mandriva-based system
49 release=`cat /etc/mandriva-release | sed -e 's/[A-Za-z ]* release //'`
50 print_linux_info "Mandriva" $release
51 elif [ -r /etc/fedora-release ]
52 then
53 # Fedora-based
54 release=`cat /etc/fedora-release | sed -e 's/[A-Za-z ]* release //'`
55 print_linux_info "Fedora" $release
56 elif [ -r /etc/SuSE-release ]
57 then
58 # SUSE-based.
59 release=`cat /etc/SuSE-release | grep "VERSION" | sed -e 's/VERSION = //'`
60 if grep openSUSE /etc/SuSE-release
61 then
62 # Is it worth distinguishing here? I did it mainly to prevent
63 # confusion with the version number
64 print_linux_info "openSUSE" $release
65 else
66 print_linux_info "SUSE" $release
67 fi
68 elif [ -r /etc/gentoo-release ]
69 then
70 # Gentoo-based
71 release=`cat /etc/gentoo-release | sed -e 's/[A-Za-z ]* release //'`
72 print_linux_info "Gentoo" $release
73 elif [ -r /etc/slackware-version ]
74 then
75 # Slackware
76 release=`cat /etc/slackware-version | sed -e 's/Slackware //'`
77 print_linux_info "Slackware" $release
78 elif [ -r /etc/arch-release ]
79 then
80 # Arch Linux
81 print_linux_info "Arch Linux" "none"
82 elif [ -r /etc/redhat-release ]
83 then
84 # Redhat-based. This should come near the end, as it other
85 # distributions may give false positives.
86 release=`cat /etc/redhat-release | sed -e 's/[A-Za-z ]* release //'`
87 print_linux_info "Redhat" $release
88 else
89 print_linux_info "unknown" "unknown"
90 fi
91}
92
93# Print information about a Solaris system. FIXME.
94get_solaris_info () {
95 kernel=`uname -v`
96 echo "Kernel: $kernel"
97}
98
99# Print information about a MacOS system. FIXME.
100get_macos_info () {
101 machine=`uname -m`
102 kernel=`uname -v`
103 echo "Machine: $machine | Kernel: $kernel"
104}
105
106# Print information about a FreeBSD system. FIXME.
107get_freebsd_info () {
108 kernel=`uname -v`
109 echo "Kernel: $kernel"
110}
111
112system=`uname -s`
113case "$system" in
114Linux|linux)
115 get_linux_info
116 ;;
117SunOS)
118 get_solaris_info
119 ;;
120Darwin)
121 get_macos_info
122 ;;
123FreeBSD)
124 get_freebsd_info
125 ;;
126*)
127 echo "System unknown"
128 exit 1
129 ;;
130esac
131exit 0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette