+UNAME="$(uname -r)"
+PN="$(basename $0)"
+[ -n "$WORKING_DIR" -a -d "$WORKING_DIR" ] || WORKING_DIR=$(pwd)
+VERSION='0.4.1'
+
+if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
+ echo "$PN - collect hardware information
+
+This tool collects information of the hardware this tool is being executed
+on. It can be executed as normal user to collect some basic information or
+with root permissions to collect as much information as possible. A file
+named info.tar.bz2 storing all collected information will be created in the
+current working directory."
+
+ exit 0
+fi
+
+TMPDIR=$(mktemp -d) || { echo "Error creating a temporary directory, can not continue. Exiting.">&2 ; exit 1; }
+INFODIR="info"
+
+bailout() {
+ [ -d "$TMPDIR" ] && rm -rf "$TMPDIR"
+ [ -n "$1" ] && exit 1 || exit 0
+}
+
+[ -n "$INFOFILE" ] || INFOFILE='info.tar.bz2'
+INFOFILE="${WORKING_DIR}/${INFOFILE}"
+
+if [ "$(id -u)" != "0" ] ; then
+ NOTROOT=1
+ echo "Notice: you are running $PN without root permissions. Not all information will be collected."
+ echo
+fi
+
+# check whether a binary is available and executable
+exectest() {
+if [ -z "$1" ] ; then
+ echo 'Usage: exectest <binary>'>&2
+ return 1
+else
+ test -e "$(which $1)" && return 0 || return 1