+UNAME="$(uname -r)"
+PN="$(basename $0)"
+[ -n "$WORKING_DIR" -a -d "$WORKING_DIR" ] || WORKING_DIR=$(pwd)
+VERSION='***UNRELEASED***'
+
+# data collection should not be affected by user locale
+export LANG=C
+export LC_ALL=C
+
+TIMESTAMP='+%F--%H-%M-%S-%Z'
+DATE="$(date $TIMESTAMP)"
+
+echo "$PN ${VERSION} - collect hardware information"
+
+# defaults
+GENERATE_FILE='1'
+GENERATE_DIRECTORY=''
+_opt_output_directory=false
+_opt_output_file=false
+
+usage() {
+ echo "
+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. By
+default, a file named grml-hwinfo-TIMESTAMP.tar.bz2 storing all collected
+information will be created in the current working directory. Alternatively,
+you can have it create a directory with all information.
+
+Options:
+
+ -b, --both Create directory + file grml-hwinfo-TIMESTAMP.tar.bz2
+ -d, --directory Create grml-hwinfo-TIMESTAMP as a directory (no file)
+ -f, --file Create grml-hwinfo-TIMESTAMP.tar.bz2 [default action]
+ -h, --help Display this help message
+ --output-directory <dir> Store output files in specified directory
+ --output-file <file> Store output in specified filename (tar.bz2 format)
+"
+}
+
+CMDLINE_OPTS=output-directory:,output-file:,both,directory,file,help
+_opt_temp=$(getopt --name grml-hwinfo -o +bdfh --long $CMDLINE_OPTS -- "$@")
+if [ $? -ne 0 ]; then
+ echo "Try 'grml-hwinfo --help' for more information." >&2
+ exit 1