-#!/bin/bash -
+#!/bin/sh -
# @configure_input@
# Copyright (C) 2008-2011 Red Hat Inc.
#
VERSION="@VERSION@"
-function fail {
+fail() {
echo "virt-what: $1" >&2
exit 1
}
-function usage {
+usage() {
echo "virt-what [options]"
echo "Options:"
echo " --help Display this help"
PATH="${root}@libexecdir@:${root}/sbin:${root}/usr/sbin:${PATH}"
# Check we're running as root.
+EFFUID=$(id -u) || fail "failed to get current user id"
-if [ "x$root" = "x" ] && [ "$EUID" -ne 0 ]; then
+if [ "x$root" = "x" ] && [ "$EFFUID" -ne 0 ]; then
fail "this script must be run as root"
fi
fi
fi
fi
+
+# Check for Docker.
+if [ -f "${root}/.dockerinit" ]; then
+ echo docker
+fi