Added galaxy-s5-backup and fix-fileshare-permissions.
parent
6e3d143f09
commit
ce5ccb3b48
@ -0,0 +1,8 @@
|
||||
#!/usr/bash
|
||||
|
||||
test_dir='/media/hoard-disk/ebooks'
|
||||
|
||||
sudo chown root:root "$test_dir"
|
||||
sudo chmod 600 "$test_dir"
|
||||
sudo setfacl -Rm 'group:fileshare:r-x' "$test_dir"
|
||||
sudo setfacl -Rm 'group:fileshare-admin:rwx' "$test_dir"
|
||||
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
PARTITION_DIRECTORY="/dev/block/platform/msm_sdcc.1/by-name"
|
||||
|
||||
current_date="$(date +%Y%m%d)"
|
||||
|
||||
function backup_partition {
|
||||
partition_path="$1"
|
||||
partition_name="$(basename "${partition_path}")"
|
||||
echo "Backing up partition ${partition_name}."
|
||||
|
||||
backup_image_name="${partition_name}-${current_date}.img"
|
||||
echo "Copying partition."
|
||||
adb shell "base64 < \"${partition_path}\"" | base64 -di > "$backup_image_name"
|
||||
|
||||
echo "Hashing backup image."
|
||||
sha256sum "$backup_image_name" > "${backup_image_name}.SHA256SUM"
|
||||
backup_hash=$(cut -d ' ' -f 1 < "${backup_image_name}.SHA256SUM")
|
||||
|
||||
echo "Hashing original image."
|
||||
original_hash=$(adb shell "sha256sum ${partition_path}" | cut -d ' ' -f 1)
|
||||
|
||||
if [ "$original_hash" = "$backup_hash" ]; then
|
||||
echo "Backup successful."
|
||||
else
|
||||
echo "Backup of partition ${partition_name} failed."
|
||||
fi
|
||||
}
|
||||
|
||||
# Technically this is a bit fragile, but the partition names don't break it and aren't going
|
||||
# to change anytime soon and this is much easier to read than the super safe solution.
|
||||
for partition_path in $(find "${PARTITION_DIRECTORY}"); do
|
||||
backup_partition "$partition_path"
|
||||
done
|
||||
Loading…
Reference in New Issue