Created
June 26, 2022 03:52
-
-
Save Hayao0819/53807f4649382e90bc93038c5d18f5e5 to your computer and use it in GitHub Desktop.
Backup your partition on Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
blockdir=/dev/block/bootdevice/by-name | |
output=/sdcard/Download/PartitionBackup | |
exclude="userdata,hoge" | |
if ! [ "$(whoami)" = root ]; then | |
echo "Run as root" >&2 | |
exit 1 | |
fi | |
mkdir -p "$output" | |
for file in "$blockdir/"*; do | |
if echo "$exclude" | tr "," "\n" | grep -qx "$(basename "$file")"; then | |
continue | |
fi | |
#fileはフルパス | |
dd if="$file" of="${output}/$(basename "$file")" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment