修改setup.sh
This commit is contained in:
@@ -6,9 +6,9 @@ GKI_ROOT=$(pwd)
|
|||||||
display_usage() {
|
display_usage() {
|
||||||
echo "Usage: $0 [--cleanup | <commit-or-tag>]"
|
echo "Usage: $0 [--cleanup | <commit-or-tag>]"
|
||||||
echo " --cleanup: Cleans up previous modifications made by the script."
|
echo " --cleanup: Cleans up previous modifications made by the script."
|
||||||
echo " <commit-or-tag>: Sets up or updates the SukiSU-Ultra to specified tag or commit."
|
echo " <commit-or-tag>: Sets up or updates the KernelSU to specified tag or commit."
|
||||||
echo " -h, --help: Displays this usage information."
|
echo " -h, --help: Displays this usage information."
|
||||||
echo " (no args): Sets up or updates the SukiSU-Ultra environment to the latest tagged version."
|
echo " (no args): Sets up or updates the KernelSU environment to the latest tagged version."
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize_variables() {
|
initialize_variables() {
|
||||||
@@ -31,16 +31,16 @@ perform_cleanup() {
|
|||||||
[ -L "$DRIVER_DIR/kernelsu" ] && rm "$DRIVER_DIR/kernelsu" && echo "[-] Symlink removed."
|
[ -L "$DRIVER_DIR/kernelsu" ] && rm "$DRIVER_DIR/kernelsu" && echo "[-] Symlink removed."
|
||||||
grep -q "kernelsu" "$DRIVER_MAKEFILE" && sed -i '/kernelsu/d' "$DRIVER_MAKEFILE" && echo "[-] Makefile reverted."
|
grep -q "kernelsu" "$DRIVER_MAKEFILE" && sed -i '/kernelsu/d' "$DRIVER_MAKEFILE" && echo "[-] Makefile reverted."
|
||||||
grep -q "drivers/kernelsu/Kconfig" "$DRIVER_KCONFIG" && sed -i '/drivers\/kernelsu\/Kconfig/d' "$DRIVER_KCONFIG" && echo "[-] Kconfig reverted."
|
grep -q "drivers/kernelsu/Kconfig" "$DRIVER_KCONFIG" && sed -i '/drivers\/kernelsu\/Kconfig/d' "$DRIVER_KCONFIG" && echo "[-] Kconfig reverted."
|
||||||
if [ -d "$GKI_ROOT/SukiSU-Ultra" ]; then
|
if [ -d "$GKI_ROOT/KernelSU" ]; then
|
||||||
rm -rf "$GKI_ROOT/SukiSU-Ultra" && echo "[-] SukiSU-Ultra directory deleted."
|
rm -rf "$GKI_ROOT/KernelSU" && echo "[-] KernelSU directory deleted."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sets up or update SukiSU-Ultra environment
|
# Sets up or update KernelSU environment
|
||||||
setup_kernelsu() {
|
setup_kernelsu() {
|
||||||
echo "[+] Setting up SukiSU-Ultra..."
|
echo "[+] Setting up KernelSU..."
|
||||||
test -d "$GKI_ROOT/SukiSU-Ultra" || git clone https://github.com/ShirkNeko/SukiSU-Ultra && echo "[+] Repository cloned."
|
test -d "$GKI_ROOT/KernelSU" || git clone https://github.com/ShirkNeko/SukiSU-Ultra -o KernelSU && echo "[+] Repository cloned."
|
||||||
cd "$GKI_ROOT/SukiSU-Ultra"
|
cd "$GKI_ROOT/KernelSU"
|
||||||
git stash && echo "[-] Stashed current changes."
|
git stash && echo "[-] Stashed current changes."
|
||||||
if [ "$(git status | grep -Po 'v\d+(\.\d+)*' | head -n1)" ]; then
|
if [ "$(git status | grep -Po 'v\d+(\.\d+)*' | head -n1)" ]; then
|
||||||
git checkout main && echo "[-] Switched to main branch."
|
git checkout main && echo "[-] Switched to main branch."
|
||||||
@@ -52,7 +52,7 @@ setup_kernelsu() {
|
|||||||
git checkout "$1" && echo "[-] Checked out $1." || echo "[-] Checkout default branch"
|
git checkout "$1" && echo "[-] Checked out $1." || echo "[-] Checkout default branch"
|
||||||
fi
|
fi
|
||||||
cd "$DRIVER_DIR"
|
cd "$DRIVER_DIR"
|
||||||
ln -sf "$(realpath --relative-to="$DRIVER_DIR" "$GKI_ROOT/SukiSU-Ultra/kernel")" "kernelsu" && echo "[+] Symlink created."
|
ln -sf "$(realpath --relative-to="$DRIVER_DIR" "$GKI_ROOT/KernelSU/kernel")" "kernelsu" && echo "[+] Symlink created."
|
||||||
|
|
||||||
# Add entries in Makefile and Kconfig if not already existing
|
# Add entries in Makefile and Kconfig if not already existing
|
||||||
grep -q "kernelsu" "$DRIVER_MAKEFILE" || printf "\nobj-\$(CONFIG_KSU) += kernelsu/\n" >> "$DRIVER_MAKEFILE" && echo "[+] Modified Makefile."
|
grep -q "kernelsu" "$DRIVER_MAKEFILE" || printf "\nobj-\$(CONFIG_KSU) += kernelsu/\n" >> "$DRIVER_MAKEFILE" && echo "[+] Modified Makefile."
|
||||||
|
|||||||
Reference in New Issue
Block a user