From: Sami Kerola Date: Thu, 19 Jul 2012 06:29:44 +0000 (+0200) Subject: Retire private id executables X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=fc634e724fbd236a28a2e32cb43c205db8d713f9;p=virt-what.git Retire private id executables 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 RWMJ: - Use -ne instead of != to compare integers. (cherry picked from commit 8aa72773cebbc742d9378fed6b6ac13cb57b0eb3) --- diff --git a/tests/baremetal/sbin/id b/tests/baremetal/sbin/id deleted file mode 100755 index 6c704ac..0000000 --- a/tests/baremetal/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/esx4.1/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/hyperv/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/kvm-explicit-cpu/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/kvm/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/linux-vserver/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/lx86/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/parallels-desktop/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/qemu/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/rhel5-xen-dom0/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/rhel5-xen-domU-hvm-ia64/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/rhel5-xen-domU-hvm/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/rhel5-xen-domU-pv/sbin/id +++ /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 index 6c704ac..0000000 --- a/tests/zvm/sbin/id +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh - -echo 0 diff --git a/virt-what.in b/virt-what.in index d62f7c8..cc5c93c 100644 --- a/virt-what.in +++ b/virt-what.in @@ -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