Collect the setup commands and print them to stdout at the end of the
script. This allows users to evaluate the standard output to apply
settings.
---
 test/process-context-settings | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/test/process-context-settings b/test/process-context-settings
index 7ffb12b3..ee3f17d3 100755
--- a/test/process-context-settings
+++ b/test/process-context-settings
@@ -1,6 +1,5 @@
 #!/usr/bin/python3
 
-import os
 import sys
 import dbus
 
@@ -11,6 +10,8 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
 
 modems = manager.GetModems()
 
+commands = []
+
 for path, properties in modems:
        if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
                continue
@@ -48,7 +49,7 @@ for path, properties in modems:
 
                        cmd = "ip address add dev " + interface + " " + address
                        cmd += "/32"
-                       os.system(cmd);
+                       commands.append(cmd)
 
                        for i in settings["DomainNameServers"]:
                                print("    Nameserver is %s" % (i),
@@ -56,5 +57,10 @@ for path, properties in modems:
 
                                cmd = "ip route add  " + i
                                cmd +=" dev " + interface
-                               os.system(cmd);
+
+                               commands.append(cmd)
+
                print('', file=sys.stderr)
+
+
+print("\n".join(commands))
-- 
2.22.0

_______________________________________________
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to