From 968ee454c03d7e1440bc94f537fd92b0f6a35e73 Mon Sep 17 00:00:00 2001
From: Davide Gardenal <davide.gardenal@huawei.com>
Date: Wed, 27 Jul 2022 08:06:21 +0200
Subject: [PATCH] upgrade_oniro: add --store-backup option

With the --store-backup option the backup is stored
even if the upgrade was successful.

Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
---
 scripts/upgrade_oniro/upgrade_oniro.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/upgrade_oniro/upgrade_oniro.py b/scripts/upgrade_oniro/upgrade_oniro.py
index e4740657..02809f89 100644
--- a/scripts/upgrade_oniro/upgrade_oniro.py
+++ b/scripts/upgrade_oniro/upgrade_oniro.py
@@ -56,6 +56,7 @@ flavour = ""
 image = ""
 conf_directory = pathlib.Path()
 dry_run = False
+store_backup = False
 
 def init_script_options():
     parser = argparse.ArgumentParser(description=script_description)
@@ -79,10 +80,12 @@ def init_script_options():
                         help="Path to the config directory you want to use. If omitted the default configs will be use.")
     parser.add_argument("--dry-run", action="store_true",
                         help="Perform the upgrade on a local copy of the project.")
+    parser.add_argument("--store-backup", action="store_true",
+                        help="Store the backup even if the upgrade was successful.")
     
 
     parsed_args = vars(parser.parse_args())
-    global target_version, build_directory, machine, flavour, image, conf_directory, dry_run
+    global target_version, build_directory, machine, flavour, image, conf_directory, dry_run, store_backup
     target_version = parsed_args["target-version"]
     build_directory = parsed_args["build-directory"]
     machine = parsed_args["machine"]
@@ -90,6 +93,7 @@ def init_script_options():
     image = parsed_args["image"]
     conf_directory = parsed_args["conf_directory"]
     dry_run = parsed_args["dry_run"]
+    store_backup = parsed_args["store_backup"]
 
 def upgrade_tool():
     # TODO
-- 
GitLab