Skip to content

Commit

Permalink
Add KSU manual input test
Browse files Browse the repository at this point in the history
In this way we can adapt to kernels which ship KSU by default.
  • Loading branch information
silvzr committed May 25, 2024
1 parent 16a58cc commit e3d49ad
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,16 @@ TITLE=$KERNEL_NAME-$KERNEL_VERSION-$KERNEL_BRANCH
cd $KERNEL_DIR

msg "KernelSU"
if [[ $KSU_ENABLED == "true" ]]; then
if [[ $KSU_ENABLED == "true" ]] && [[ -d "$KERNEL_DIR/drivers/kernelsu" ]]; then

echo "CONFIG_KSU=y" >> $DEVICE_DEFCONFIG_FILE

KSU_GIT_VERSION=$(cd $KERNEL_DIR/drivers/kernelsu && git rev-list --count HEAD)
KERNELSU_VERSION=$(($KSU_GIT_VERSION + 10200))
msg "KernelSU Version: $KERNELSU_VERSION"
sed -i "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=\"-$KERNEL_BRANCH-$KERNEL_NAME-KSU\"/" $DEVICE_DEFCONFIG_FILE
elif
[[ $KSU_ENABLED == "true" ]]; then
curl -LSs "https://raw.githubusercontent.com/$KERNELSU_REPO/main/kernel/setup.sh" | bash -s main

echo "CONFIG_KPROBES=y" >> $DEVICE_DEFCONFIG_FILE
Expand All @@ -143,7 +152,8 @@ if [[ $KSU_ENABLED == "true" ]]; then
KERNELSU_VERSION=$(($KSU_GIT_VERSION + 10200))
msg "KernelSU Version: $KERNELSU_VERSION"
sed -i "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=\"-$KERNEL_BRANCH-$KERNEL_NAME-KSU\"/" $DEVICE_DEFCONFIG_FILE
else
fi
if [[ $KSU_ENABLED == "false" ]]; then
echo "KernelSU Disabled"
KERNELSU_VERSION="Disabled"
sed -i "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=\"-$KERNEL_BRANCH-$KERNEL_NAME\"/" $DEVICE_DEFCONFIG_FILE
Expand Down

0 comments on commit e3d49ad

Please sign in to comment.