mywalkb / LSPosed_mod

My changes to LSPosed
GNU General Public License v3.0
2.1k stars 93 forks source link

[Feature Request] backup/restore from CLI #3

Closed mywalkb closed 1 year ago

mywalkb commented 2 years ago

Is your feature request related to a problem?

use CLI interface for backup and restore settings

Describe the solution you'd like

Thanks to idea of @MobNiko cli interface can support backup and restore module settings and scope

mywalkb commented 1 year ago

Build for test are available here Wiki is updated with example how to use.

MobNiko commented 1 year ago

Hi. Thanks for the quick release. I'll check it out and post the result.

MobNiko commented 1 year ago

@mywalkb Hi. I have encountered a problem in testing, do you have time to help? I'd really appreciate it.

I am using A70 phone and wanted to use CLI, but encountered the following problem :

  1. If I try to restore backup.lsp file which I saved manually through menu in LSPosed ( old way ). I get an error

/data/adb/lspd/bin/cli restore -f /storage/6233-3538/Lsposed/A70.lsp /storage/6233-3538/Lsposed/A70.lsp: open failed: ENOENT (No such file or directory)

  1. I decided to check another way and made a backup with :

"/data/adb/lspd/bin/cli backup -f /storage/6233-3538/Lsposed/A70.lsp"

And while trying to restore this backup, encountered the same error :

/data/adb/lspd/bin/cli restore -f /storage/6233-3538/Lsposed/A70.lsp /storage/6233-3538/Lsposed/A70.lsp: open failed: ENOENT (No such file or directory)

Please help me to solve this issue. Thank you

Update :

mywalkb commented 1 year ago

Could you post the output of command ls -lZ /storage/6233-3538/Lsposed/A70.lsp after backup? If the file exist and cli can't open it, maybe selinux block the access.

mywalkb commented 1 year ago

Have you tried to use another path? For example /sdcard Recovery for a specific module which path have you used? I will test with external sd.

MobNiko commented 1 year ago

Could you post the output of command ls -lZ /storage/6233-3538/Lsposed/A70.lsp after backup? If the file exist and cli can't open it, maybe selinux block the access.

Please excuse me, I have made a mistake. Probably need more sleep :)

It's working.

Mac-mini-Niko:Magisk Niko$ adb -s RZ8M----- shell "su" /data/adb/lspd/bin/cli restore -f /sdcard/Download/mybackup.lsp.gz ls -lZ /sdcard/Download/mybackup.lsp.gz -rw-rw---- 1 root everybody u:object_r:fuse:s0 832 2022-07-13 18:22 /sdcard/Download/mybackup.lsp.gz

I have another problem with ADB, can you tell me please? I'm trying to specify commands via the terminal, but I get an error.

I don't know how to write a sh script, please give me a hint. How can I combine CLI command execution with ADB ?

Thanks for your help!

Executing instruction: /data/adb/lspd/bin/cli restore -f /storage/6233-3538/Lsposed/A20.lsp.gz com.android1500.androidfaker thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/adb_utils.rs:34:31 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

mywalkb commented 1 year ago

Try this command adb -s RZ8M shell "su -c \"/data/adb/lspd/bin/cli restore -f /sdcard/Download/mybackup.lsp.gz\""

In this moment I have no a PC for test but should work

MobNiko commented 1 year ago

Try this command adb -s RZ8M shell "su -c \"/data/adb/lspd/bin/cli restore -f /sdcard/Download/mybackup.lsp.gz\""

In this moment I have no a PC for test but should work

Yes, it works. Thank you for your help. I really appreciate it.

mywalkb commented 1 year ago

I receveid a notification from a user which write in this issue but I can't find the message.

with commit cd00875c862cfb81b0d5f36a23d03e64eb30b335 backup / restore support also "automatic add" from gui and cli.

nakcont commented 1 year ago

I receveid a notification from a user which write in this issue but I can't find the message.

with commit cd00875c862cfb81b0d5f36a23d03e64eb30b335 backup / restore support also "automatic add" from gui and cli.

When will this update be available? Thanks you.

mywalkb commented 1 year ago

When will this update be available? Thanks you.

I follow the release of original LSPosed so both projects are syncronized and I don't know when wil be available. You can use this release from actions, after the release 1.8.4 this is the first commit, so no other changes have been introduced.