From fb73c7e2e9ec3984e52bd211d5d007c8aef9ee53 Mon Sep 17 00:00:00 2001 From: TheBrokenRail <17478432+TheBrokenRail@users.noreply.github.com> Date: Tue, 9 Feb 2021 16:53:44 -0500 Subject: [PATCH] Auto-Calculate Darling Prefix in tools/uninstall (#829) * Auto-Calculate Darling Prefix in tools/uninstall Also switched the shebang to ```/bin/sh``` since the script seemed ```sh``` compatible, and there are faster ```sh``` implementations than ```bash``` like ```dash```. * Improve Readability --- tools/uninstall | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/uninstall b/tools/uninstall index 12445d9ce..b75acc37a 100755 --- a/tools/uninstall +++ b/tools/uninstall @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set +e if [ "$(whoami)" != "root" ] @@ -8,15 +8,17 @@ then exit fi +INSTALL_PREFIX="$(dirname "$(dirname "$(which darling)")")" + if command -v darling then darling shutdown fi -if [ -d /usr/local/libexec ] +if [ -d "${INSTALL_PREFIX}/libexec" ] then - rm -rf /usr/local/libexec/darling - rmdir --ignore-fail-on-non-empty /usr/local/libexec + rm -rf "${INSTALL_PREFIX}/libexec/darling" + rmdir --ignore-fail-on-non-empty "${INSTALL_PREFIX}/libexec" fi -rm -f /usr/local/bin/darling +rm -f "${INSTALL_PREFIX}/bin/darling" find /lib/modules -name darling-mach.ko -delete echo "Uninstall complete" -- 2.51.2