poky/scripts/contrib/dialog-power-control
Richard Purdie ffae400179 meta/lib+scripts: Convert to SPDX license headers
This adds SPDX license headers in place of the wide assortment of things
currently in our script headers. We default to GPL-2.0-only except for the
oeqa code where it was clearly submitted and marked as MIT on the most part
or some scripts which had the "or later" GPL versioning.

The patch also drops other obsolete bits of file headers where they were
encoountered such as editor modelines, obsolete maintainer information or
the phrase "All rights reserved" which is now obsolete and not required in
copyright headers (in this case its actually confusing for licensing as all
rights were not reserved).

More work is needed for OE-Core but this takes care of the bulk of the scripts
and meta/lib directories.

The top level LICENSE files are tweaked to match the new structure and the
SPDX naming.

(From OE-Core rev: f8c9c511b5f1b7dbd45b77f345cb6c048ae6763e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-09 16:31:55 +01:00

1.6 KiB
Executable File

#!/bin/sh

SPDX-License-Identifier: GPL-2.0-only

Simple script to show a manual power prompt for when you want to use

automated hardware testing with testimage.bbclass but you don't have a

web-enabled power strip or similar to do the power on/off/cycle.

You can enable it by enabling testimage (see the Yocto Project

Development manual "Performing Automated Runtime Testing" section)

and setting the following in your local.conf:

TEST_POWERCONTROL_CMD = "${COREBASE}/scripts/contrib/dialog-power-control"

PROMPT="" while true; do case $1 in on) PROMPT="Please turn device power on";; off) PROMPT="Please turn device power off";; cycle) PROMPT="Please click Done, then turn the device power off then on";; "") break;; esac shift done

if [ "$PROMPT" = "" ] ; then echo "ERROR: no power action specified on command line" exit 2 fi

if [ "which kdialog 2>/dev/null" != "" ] ; then DIALOGUTIL="kdialog" elif [ "which zenity 2>/dev/null" != "" ] ; then DIALOGUTIL="zenity" else echo "ERROR: couldn't find program to display a message, install kdialog or zenity" exit 3 fi

if [ "$DIALOGUTIL" = "kdialog" ] ; then kdialog --yesno "$PROMPT" --title "TestImage Power Control" --yes-label "Done" --no-label "Cancel test" elif [ "$DIALOGUTIL" = "zenity" ] ; then zenity --question --text="$PROMPT" --title="TestImage Power Control" --ok-label="Done" --cancel-label="Cancel test" fi

if [ "$?" != "0" ] ; then echo "User cancelled test at power prompt" exit 1 fi