From 162121efeeb90d7142f6eaf830cc4de14a7decfe Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Date: Tue, 13 Dec 2016 15:48:59 +0100
Subject: [PATCH] Use ribchesterctl not ribchester-bundle

ribchester-bundle is a python3-gi based application which is capable of
doing some low-level operations in ribchester, ribchesterctl is a
simpler C application installed as part of the ribchester package which
can at the moment only do install and remove (which is exectly what ade
is doing).

Move ade to use ribchestectl so it doesn't need anything not normally
installed on a target device. Also for operation on a target device use
sudo (an ssh user is not allowed to install applications).

While there, also copy bundles to /tmp rather then hardcode the users
home directory (which could change in the future).

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

Differential Revision: https://phabricator.apertis.org/D5261
---
 tools/ade | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/ade b/tools/ade
index 70ab3ee..5cbf034 100755
--- a/tools/ade
+++ b/tools/ade
@@ -181,11 +181,11 @@ class Simulator:
         return r.stdout.read().decode().strip()
 
     def install(self, bundle):
-        self._exec('ribchester-bundle', 'remove', bundle.id)
-        self._exec('ribchester-bundle', 'install-app-bundle', bundle.path)
+        self._exec('ribchesterctl', 'remove', bundle.id)
+        self._exec('ribchesterctl', 'install', bundle.path)
 
     def uninstall(self, bundle_id):
-        self._exec('ribchester-bundle', 'remove', bundle_id)
+        self._exec('ribchester', 'remove', bundle_id)
 
     def run(self, app, *args):
         self._exec('canterbury-exec', app, *args)
@@ -257,18 +257,18 @@ class Device:
         self.version.arch = triplet.arch
 
     def install(self, bundle):
-        self._exec('ribchester-bundle', 'remove', bundle.id)
-        bundledir = '/home/user/bundles'
+        self.uninstall(bundle.id)
+        bundledir = '/tmp/bundles'
         self._exec('mkdir', '-p', bundledir)
         remote_path = os.path.join(bundledir, os.path.basename(bundle.path))
         with closing(self._connect()) as ssh:
             with closing(ssh.open_sftp()) as sftp:
                 sftp.put(bundle.path, remote_path)
-        self._exec('ribchester-bundle', 'install-app-bundle', remote_path)
+        self._exec('sudo', 'ribchesterctl', 'install', remote_path)
         self._exec('rm', remote_path)
 
     def uninstall(self, bundle_id):
-        self._exec('ribchester-bundle', 'remove', bundle_id)
+        self._exec('sudo', 'ribchesterctl', 'remove', bundle_id)
 
     def run(self, app, *args):
         self._exec('canterbury-exec', app, *args)
-- 
GitLab