Retire private id executables
authorSami Kerola <kerolasa@iki.fi>
Thu, 19 Jul 2012 06:29:44 +0000 (08:29 +0200)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 31 Oct 2016 10:13:13 +0000 (06:13 -0400)
The main script is setting PATH to use id executable from rather
strange directory.  That allowed checks to run without root
privilege.  This change will make detection whether test run is
been requested more universal, and to work without super setting
id command.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
RWMJ:
  - Use -ne instead of != to compare integers.

(cherry picked from commit 8aa72773cebbc742d9378fed6b6ac13cb57b0eb3)

15 files changed:
tests/baremetal/sbin/id [deleted file]
tests/esx4.1/sbin/id [deleted file]
tests/hyperv/sbin/id [deleted file]
tests/kvm-explicit-cpu/sbin/id [deleted file]
tests/kvm/sbin/id [deleted file]
tests/linux-vserver/sbin/id [deleted file]
tests/lx86/sbin/id [deleted file]
tests/parallels-desktop/sbin/id [deleted file]
tests/qemu/sbin/id [deleted file]
tests/rhel5-xen-dom0/sbin/id [deleted file]
tests/rhel5-xen-domU-hvm-ia64/sbin/id [deleted file]
tests/rhel5-xen-domU-hvm/sbin/id [deleted file]
tests/rhel5-xen-domU-pv/sbin/id [deleted file]
tests/zvm/sbin/id [deleted file]
virt-what.in

diff --git a/tests/baremetal/sbin/id b/tests/baremetal/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/esx4.1/sbin/id b/tests/esx4.1/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/hyperv/sbin/id b/tests/hyperv/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/kvm-explicit-cpu/sbin/id b/tests/kvm-explicit-cpu/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/kvm/sbin/id b/tests/kvm/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/linux-vserver/sbin/id b/tests/linux-vserver/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/lx86/sbin/id b/tests/lx86/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/parallels-desktop/sbin/id b/tests/parallels-desktop/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/qemu/sbin/id b/tests/qemu/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/rhel5-xen-dom0/sbin/id b/tests/rhel5-xen-dom0/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/rhel5-xen-domU-hvm-ia64/sbin/id b/tests/rhel5-xen-domU-hvm-ia64/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/rhel5-xen-domU-hvm/sbin/id b/tests/rhel5-xen-domU-hvm/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/rhel5-xen-domU-pv/sbin/id b/tests/rhel5-xen-domU-pv/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
diff --git a/tests/zvm/sbin/id b/tests/zvm/sbin/id
deleted file mode 100755 (executable)
index 6c704ac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -
-echo 0
index d62f7c8..cc5c93c 100644 (file)
@@ -75,8 +75,7 @@ PATH=$root@libexecdir@:$root/sbin:$root/usr/sbin:$PATH
 
 # Check we're running as root.
 
-uid=`id -u`
-if [ "$uid" != 0 ]; then
+if [ "x$root" = "x" ] && [ "$EUID" -ne 0 ]; then
     fail "this script must be run as root"
 fi