chore: what the fuck

This commit is contained in:
2025-06-19 23:25:30 +07:00
parent fa12cfc815
commit 2ec777f8d5
10 changed files with 98 additions and 3 deletions

23
os/android/backup.sh Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/bash
release_output=$(cat /etc/os-release)
device_model=$(adb shell getprop ro.build.product)
device_brand=$(adb shell getprop ro.product.brand)
backup_date=$(date +'%Y%m%d-%H%M%S')
backup_dir="$device_brand-$device_model/$backup_date"
mkdir -p $backup_dir
echo "Backing up device to: $backup_dir"
declare -a backup_dirs=("Alarms" "DCIM" "Documents" "Download" "Movies" "Music" "Pictures" "Podcasts" "Recordings" "Ringtones" "SwiftBackup")
for v in "${backup_dirs[@]}"
do
if [[ $release_output == *"MSYS2"* ]] || [ -f /git-bash.exe ] || [ -f /msys2.exe ]; then
# We're on Windows, workaround time :)
echo "adb pull /sdcard/$v $backup_dir/$v" > backup.bat
./backup.bat
rm backup.bat
else
adb pull /sdcard/$v $backup_dir/$v
fi
done
echo "Copying restore script to backup directory..."
cp restore.sh $backup_dir

15
os/android/restore.sh Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/bash
release_output=$(cat /etc/os-release)
declare -a backup_dirs=("Alarms" "DCIM" "Documents" "Download" "Movies" "Music" "Pictures" "Podcasts" "Recordings" "Ringtones" "SwiftBackup")
for v in "${backup_dirs[@]}"
do
if [[ $release_output == *"MSYS2"* ]] || [ -f /git-bash.exe ] || [ -f /msys2.exe ]; then
# We're on Windows
echo "adb push $v /sdcard/" > restore.bat
./restore.bat
rm restore.bat
else
adb push $v /sdcard/
fi
done