Add uninstall command and tool

Invoke as 'make uninstall' in CMake build directory
or run as tools/uninstall

Fixes #590
This commit is contained in:
Andrew Hyatt 2020-01-03 22:17:28 -05:00
parent 5756f64a2e
commit 7df5cc8042
No known key found for this signature in database
GPG Key ID: 5456D0F696719C24
2 changed files with 26 additions and 0 deletions

View File

@ -113,3 +113,7 @@ InstallSymlink(/Volumes/SystemRoot/usr/lib64 ${CMAKE_INSTALL_PREFIX}/libexec/dar
InstallSymlink(/Volumes/SystemRoot/usr/share/zoneinfo ${CMAKE_INSTALL_PREFIX}/libexec/darling/usr/share/zoneinfo)
install(CODE "execute_process(COMMAND bash ${DARLING_TOP_DIRECTORY}/tools/shutdown-user.sh)")
add_custom_target(uninstall
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/uninstall
COMMENT "Uninstall Darling and kernel module")

22
tools/uninstall Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
set +e
if [ "$(whoami)" != "root" ]
then
echo "Uninstall must be run as root, invoking sudo"
sudo su -c "$0"
exit
fi
if command -v darling
then
darling shutdown
fi
if [ -d /usr/local/libexec ]
then
rm -rf /usr/local/libexec/darling
rmdir --ignore-fail-on-non-empty /usr/local/libexec
fi
rm -f /usr/local/bin/darling
find /lib/modules -name darling-mach.ko -delete
echo "Uninstall complete"