Attempt update

This commit is contained in:
Phapoom Saksri 2025-01-24 20:23:32 +07:00
parent d8eee651cf
commit 57798b5f66
2 changed files with 1577 additions and 6 deletions

View file

@ -32,16 +32,22 @@ install_kernel_su_next() {
if [ -d "KernelSU-Next" ]; then
rm -rf KernelSU-Next
fi
curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next/kernel/setup.sh" | bash -
local version_flag=$1
curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next/kernel/setup.sh" | bash $version_flag
}
patch_susfs() {
local newer_patch=$1
echo "Entering KernelSU-Next directory..."
cd KernelSU-Next || exit 1
if [ $KERNEL_MAJOR -ge 4 ]; then
if [ $KERNEL_MAJOR -gt 4 ] || ([ $KERNEL_MAJOR -eq 4 ] && [ $KERNEL_MINOR -ge 9 ]); then
echo "The kernel does support susfs4ksu!, applying universal SUSFS patch"
curl -LSs "https://raw.githubusercontent.com/galaxybuild-project/tools/refs/heads/main/Patches/0001-Implement-SUSFS-v1.5.3-universal.patch" > susfs.patch
echo "The kernel does support susfs4ksu!, applying SUSFS patch"
local patch_url="https://raw.githubusercontent.com/galaxybuild-project/tools/refs/heads/main/Patches/0001-Implement-SUSFS-v1.5.3-universal.patch"
if [ "$newer_patch" = "true" ]; then
patch_url="https://raw.githubusercontent.com/galaxybuild-project/tools/refs/heads/main/Patches/0001-Implement-SUSFS-v1.5.3-newerfixed.patch"
fi
curl -LSs "$patch_url" > susfs.patch
patch -p1 < susfs.patch
rm -f susfs.patch
else
@ -54,11 +60,48 @@ patch_susfs() {
fi
}
show_help() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -h, --help Show this help message and exit"
echo " -n, --newerpatch Use alternative SUSFS patch to fix compile errors (for GKI 2.0+ or some kernel source, not recommend to use this if you don't have any issues)"
echo " -s <version> Specify KernelSU-Next version to install (e.g., 'next', 'v1.0.3')"
}
# Parse command-line arguments
NEWER_PATCH="false"
KERNELSU_VERSION=""
while [[ $# -gt 0 ]]; do
case "$1" in
-n|--newerpatch)
NEWER_PATCH="true"
shift
;;
-s)
KERNELSU_VERSION="$2"
shift 2
;;
-h|--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done
VERSION_FLAG=""
if [ -n "$KERNELSU_VERSION" ]; then
VERSION_FLAG="-s $KERNELSU_VERSION"
fi
echo "############################################"
echo "KernelSU Next with SuSFS Patches"
echo "Made by @blueskychan-dev, @sidex15, @rifsxd"
echo "Lastest updated: 22 Janurary 2025"
echo "Lastest updated: 24 January 2025"
echo "############################################"
echo "Checking if KernelSU-Next is installed..."
if [ -d "KernelSU-Next" ]; then
@ -68,7 +111,7 @@ else
echo "KernelSU-Next is not installed"
fi
echo "Installing KernelSU-Next..."
install_kernel_su_next
install_kernel_su_next "$VERSION_FLAG"
echo "Patching SuSFS..."
patch_susfs
patch_susfs "$NEWER_PATCH"
echo "Done! Thanks for using my script :3"