diff mbox

[1/2] fwts-collect: make sure we are executing as root or with sudo

Message ID 1346252828-16590-1-git-send-email-vanhoof@canonical.com
State Accepted
Headers show

Commit Message

Chris Van Hoof Aug. 29, 2012, 3:07 p.m. UTC
Signed-off-by: Chris Van Hoof <vanhoof@canonical.com>
---
 scripts/fwts-collect |    8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Colin Ian King Aug. 29, 2012, 6:34 p.m. UTC | #1
On 29/08/12 16:07, Chris Van Hoof wrote:
> Signed-off-by: Chris Van Hoof <vanhoof@canonical.com>
> ---
>   scripts/fwts-collect |    8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/scripts/fwts-collect b/scripts/fwts-collect
> index d6e748f..0b5838a 100755
> --- a/scripts/fwts-collect
> +++ b/scripts/fwts-collect
> @@ -22,6 +22,14 @@ TMPDIR=/tmp/fwts.$$
>   FWTS=`which fwts`
>
>   #
> +# Check if executed as root or with sudo
> +#
> +if [ $EUID -ne 0 ]; then
> +        echo "`basename $0`: must be executed with sudo"
> +        exit 1
> +fi
> +
> +#
>   #  sighandler
>   #
>   on_die()
>
Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung Aug. 31, 2012, 2:18 a.m. UTC | #2
On 08/29/2012 11:07 PM, Chris Van Hoof wrote:
> Signed-off-by: Chris Van Hoof <vanhoof@canonical.com>
> ---
>   scripts/fwts-collect |    8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/scripts/fwts-collect b/scripts/fwts-collect
> index d6e748f..0b5838a 100755
> --- a/scripts/fwts-collect
> +++ b/scripts/fwts-collect
> @@ -22,6 +22,14 @@ TMPDIR=/tmp/fwts.$$
>   FWTS=`which fwts`
>
>   #
> +# Check if executed as root or with sudo
> +#
> +if [ $EUID -ne 0 ]; then
> +        echo "`basename $0`: must be executed with sudo"
> +        exit 1
> +fi
> +
> +#
>   #  sighandler
>   #
>   on_die()
>
Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/scripts/fwts-collect b/scripts/fwts-collect
index d6e748f..0b5838a 100755
--- a/scripts/fwts-collect
+++ b/scripts/fwts-collect
@@ -22,6 +22,14 @@  TMPDIR=/tmp/fwts.$$
 FWTS=`which fwts`
 
 #
+# Check if executed as root or with sudo
+#
+if [ $EUID -ne 0 ]; then
+        echo "`basename $0`: must be executed with sudo"
+        exit 1
+fi
+
+#
 #  sighandler
 #
 on_die()