chore: rewrite directory name & feat: add lol sulaunchhelper2.sh

This commit is contained in:
2022-05-30 20:12:39 +07:00
parent a5abc5f35c
commit ec2fa3d16d
18 changed files with 327 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#!/usr/bin/bash
RCLONE_REMOTE="<remote name>"
# Rclone remote will be mounted to /mnt/runtime/write/emulated/0/ which is equal to /sdcard in File Explorer (aka your home directory) and equal to ~/storage/shared in Termux
ROOT_HOME_DIR="/mnt/runtime/write/emulated/0/"
RCLONE_MOUNT_DIR="<mount directory>"
FINAL_DIR="$ROOT_HOME_DIR$RCLONE_MOUNT_DIR"
if [ "$1" = "unmount" ]; then
sudo pkill -f "rclone --vfs-cache-mode writes -v mount \"$RCLONE_REMOTE\": \"$FINAL_DIR\" --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other"
sudo fusermount -u "$FINAL_DIR"
echo "$RCLONE_REMOTE should be unmounted now, if fusermount raises Invalid option then that's OK."
else
sudo mkdir -p "$FINAL_DIR"
sudo nohup rclone --vfs-cache-mode writes -v mount "$RCLONE_REMOTE": "$FINAL_DIR" --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other &
echo "$RCLONE_REMOTE should be mounted now, check $RCLONE_MOUNT_DIR"
fi

View File

@ -0,0 +1,36 @@
#!/bin/bash
RCLONE_PATH="./.rclone-files/"
ARCH=$(uname -m)
RCLONE_URL=""
FUSERMOUNT_URL=""
if [ "$ARCH" == "armv7l" ];then
RCLONE_URL="https://beta.rclone.org/test/testbuilds-latest/rclone-android-16-armv7a.gz"
FUSERMOUNT_URL="https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/raw/master/binary/fusermount-arm"
elif [ "$ARCH" == "aarch64" ];then
RCLONE_URL="https://beta.rclone.org/test/testbuilds-latest/rclone-android-21-armv8a.gz"
FUSERMOUNT_URL="https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/raw/master/binary/fusermount-arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
echo "!!! YOU NEED ROOT TO RUN THIS SCRIPT !!!"
echo "This script was made before I discovered that Termux Rclone can work perfectly too if you mount to /mnt/runtime/write/emulated/0/, using this script may lead to unwanted change in your phone."
read -p "Do you want to continue (Y/n)? " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
echo "Installing dependencies..."
pkg install root-repo tsu wget
echo "Setting up Termux shared storage..."
termux-setup-storage
echo "Downloading rclone..."
mkdir -p $RCLONE_PATH
wget -O - $RCLONE_URL | gunzip -c > "$RCLONE_PATH/rclone"
echo "Downloading fusermount..."
wget -O "$RCLONE_PATH/fusermount" $FUSERMOUNT_URL
sudo chmod -R 0755 ./.rclone-files/
echo "Setup completed, you MUST execute ./rclone-shell before using rclone."