Skip to content

Commit

Permalink
chore: use shell script to cp database
Browse files Browse the repository at this point in the history
  • Loading branch information
ourongxing committed May 6, 2024
1 parent bafa293 commit beba93f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 26 deletions.
Binary file modified bun.lockb
Binary file not shown.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"scripts": {
"dev": "bun run src/index.ts",
"adb": "bun run src/adb.ts"
"adb": "bun scripts/adb.sh"
},
"devDependencies": {
"@types/bun": "^1.1.1",
"@types/single-line-log": "^1.1.2"
},
"dependencies": {
"@cspotcode/zx": "^6.1.2",
"csv-stringify": "^6.4.6",
"single-line-log": "^1.1.2"
}
Expand Down
18 changes: 18 additions & 0 deletions scripts/adb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

databaseFolder=./database

device=$(adb devices | tail -n +2 | cut -f1)

if [ -z "$device" ]; then
echo "请安装 ADB,连接好手机,打开手机上的 USB 调试选项"
exit 1
fi

adb shell su -c "cp -rf /data/data/com.maimemo.android.momo/databases/momo.v*.db /sdcard/maimemo.db"
adb pull /sdcard/maimemo.db "$databaseFolder"
adb shell rm /sdcard/maimemo.db

adb shell su -c "cp -rf /data/data/com.maimemo.android.momo/databases/notepad.db /sdcard/notepad.db"
adb pull /sdcard/notepad.db "$databaseFolder"
adb shell rm /sdcard/notepad.db
24 changes: 0 additions & 24 deletions src/adb.ts

This file was deleted.

0 comments on commit beba93f

Please sign in to comment.