devlib: don't use sudo/su if you are root

Most invocations of target.execute() pass as_root=self.is_rooted .
However, is_rooted is not what you want to do here.  as_root tells the
connection to wrap the command around sudo/su to execute the command as
root.  is_rooted returns True if the device can run commands as
root (for example, if we are connected as root).  If you are already
connected as root, there is no need to wrap the command around sudo, you
are already root.  In that case, as_root should always be false.

Define a new property for the target called needs_su that returns true
if the target needs to run a command to get superuser privileges.
1 file changed
tree: a00c600c70b03bed08f553e07cfee0e4657caefb
  1. devlib/
  2. doc/
  3. src/
  4. .gitignore
  5. README.rst
  6. setup.py