Skip to content

Commit

Permalink
new script who dis
Browse files Browse the repository at this point in the history
  • Loading branch information
master-hax committed Oct 31, 2024
1 parent bc68575 commit 6f1c6ae
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 18 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DEVICE_TEMP_DIRECTORY := /data/local/tmp

ALL_SCRIPTS := \
scripts/mount_ext4.sh \
scripts/mount_folder.sh \
scripts/remount_vfat.sh \
scripts/unmount.sh \
scripts/find_device.sh \
scripts/show_devices.sh \
Expand All @@ -30,10 +30,10 @@ mobile-install: pixel-backup-gang-$(PBG_VERSION).tar.gz
# copy the tarball containing scripts
$(HOST_ADB_COMMAND) push ./pixel-backup-gang-$(PBG_VERSION).tar.gz $(DEVICE_TEMP_DIRECTORY)
# extract the scripts
$(HOST_ADB_COMMAND) shell /sbin/su --command 'tar -xvf $(DEVICE_TEMP_DIRECTORY)/pixel-backup-gang-$(PBG_VERSION).tar.gz -C $(DEVICE_INSTALL_DIRECTORY)'
$(HOST_ADB_COMMAND) shell su --command 'tar -xvf $(DEVICE_TEMP_DIRECTORY)/pixel-backup-gang-$(PBG_VERSION).tar.gz -C $(DEVICE_INSTALL_DIRECTORY)'
# make the scripts executable
$(HOST_ADB_COMMAND) shell /sbin/su --command 'chmod +x $(DEVICE_INSTALL_DIRECTORY)/pixel-backup-gang-$(PBG_VERSION)/*.sh'
# done, installed scripts to $(DEVICE_INSTALL_DIRECTORY)/pixel-backup-gang-$(PBG_VERSION)
$(HOST_ADB_COMMAND) shell su --command 'chmod +x $(DEVICE_INSTALL_DIRECTORY)/pixel-backup-gang/*.sh'
# done, installed scripts to $(DEVICE_INSTALL_DIRECTORY)/pixel-backup-gang

.PHONY: clean
clean:
Expand Down
14 changes: 0 additions & 14 deletions scripts/mount_folder.sh

This file was deleted.

46 changes: 46 additions & 0 deletions scripts/remount_vfat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh -e

################################################################################
# Description: remounts /the_binding in the specified mounted vfat folder to the internal storage
# Author: Vivek Revankar <[email protected]>
# Usage: ./remount_vfat.sh <DIRECTORY_PATH>
# Example: ./remount_vfat.sh /mnt/media_rw/2IDK-11F4
################################################################################


if [ "$(readlink /proc/self/ns/mnt)" != "$(readlink /proc/1/ns/mnt)" ]; then
echo "not running in global mount namespace, try elevating first"
exit 1
fi

if [ "$#" -ne 1 ]; then
echo "Usage: $0 /mnt/media_rw/<label>" >&2
exit 1
fi

mounted_drive_path=$1
if [ ! -e "$mounted_drive_path" ]; then
echo "directory was not found"
exit 1
fi
if [ ! -d "$mounted_drive_path" ]; then
echo "path was not a directory"
exit 1
fi

fs_type=$(stat -f -c %T $mounted_drive_path)
if [ "$fs_type" != "msdos" ]; then
echo "detected filesystem type was not 'msdos', found $fs_type"
exit 1
fi

drive_binding_dir="$mounted_drive_path/the_binding"
internal_binding_dir="/mnt/runtime/write/emulated/0/the_binding"
mkdir -p -v "$drive_binding_dir"
mkdir -p -v "$internal_binding_dir"
mount \
-t sdcardfs \
-o nosuid,nodev,noexec,noatime,gid=9997 \
"$drive_binding_dir" "$internal_binding_dir"

echo "vfat drive remounted succesfully"

0 comments on commit 6f1c6ae

Please sign in to comment.