Launch pre script if exists 58/244258/1
authorKichan Kwon <k_c.kwon@samsung.com>
Wed, 16 Sep 2020 09:53:36 +0000 (18:53 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 16 Sep 2020 09:53:36 +0000 (18:53 +0900)
Change-Id: Ic90e2ac12e79d36ce6d1c47ca322b1ff6d73bb9a
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/system-recovery.c
src/system-recovery.h.in

index a14e08a..748ab9e 100644 (file)
@@ -212,6 +212,11 @@ static int mount_recovery_image(void)
        return SUCCEED;
 }
 
+static int run_pre_script(void)
+{
+       return try_launch(PRE_SCRIPT_PATH, NULL);
+}
+
 static int read_config_file(struct image **image_list)
 {
        int ret;
@@ -345,6 +350,9 @@ int main(void)
        ret = mount_recovery_image();
        ASSERT_RETV(ret == SUCCEED, ret, "Failed to mount recovery image (%d)", ret);
 
+       ret = run_pre_script();
+       ASSERT_RETV(ret == SUCCEED, ret, "Failed to run pre script (%d)", ret);
+
        ret = read_config_file(&image_list);
        ASSERT_RETV(ret == SUCCEED, ret, "Failed to read config file (%d)", ret);
 
index 8a75386..0e1a6b1 100644 (file)
@@ -21,6 +21,8 @@ do {  \
 
 #define IMAGE_VERIFIER_PATH "/usr/sbin/img-verifier"
 
+#define PRE_SCRIPT_PATH RECOVERY_IMAGE_MOUNTPOINT "/pre.sh"
+
 #define LOG_FILE_BASENAME "last_recovery.log"
 
 #define PROGRESS_FILE_PATH "/tmp/recovery_progress"