diff --git a/adb.py b/adb.py index 2a99cc1..ae53ce3 100644 --- a/adb.py +++ b/adb.py @@ -153,12 +153,12 @@ fi''' if remote_type != "na": if remote_type == "directory" and not remote.endswith('/'): remote += '/' - flag = False + merge_flag = False if os.path.exists(local): last = os.path.split(local)[-1] real_dir = local local = os.path.join(defaults['local']['temp'],last) - flag = True + merge_flag = True try: self.adb("pull","-a",remote,local) except subprocess.CalledProcessError as e: @@ -166,7 +166,7 @@ fi''' pass else: raise e - if flag: + if merge_flag: merge(local,real_dir) if os.path.exists(local) and del_duplicates: shutil.rmtree(local) @@ -201,7 +201,7 @@ fi''' while True: infos = get_info() if len(infos) > 0: - self.__dict__.update(get_info()[self.serial]) + self.__dict__.update(infos[self.serial]) break time.sleep(1) @@ -224,6 +224,8 @@ fi''' #twrp def backup(self,*partitions,name = None): + if self.mode != 'recovery': + self.reboot('recovery') backupdir = defaults['local']['TWRP'] options_dict = { "system": "S", @@ -247,11 +249,13 @@ fi''' self.move(phone_dir,filename) def wipe(self,partition): + if self.mode != 'recovery': + self.reboot('recovery') self.shell("twrp","wipe",partition) - - def install(self,name): + if self.mode != 'recovery': + self.reboot('recovery') if os.path.exists(name): local_name = name name = os.path.split(name)[-1]