2021-11-14 12:14:41 +01:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
|
2023-01-08 16:59:05 +01:00
|
|
|
#---
|
2021-11-14 12:14:41 +01:00
|
|
|
# Help screen
|
2023-01-08 16:59:05 +01:00
|
|
|
#---
|
2023-12-01 18:30:01 +01:00
|
|
|
|
|
|
|
function help()
|
2021-11-14 12:14:41 +01:00
|
|
|
{
|
2023-12-01 18:30:01 +01:00
|
|
|
cat << EOF
|
2021-11-16 17:43:29 +01:00
|
|
|
Script for the uninstallation of the Vhex kernel's binutils.
|
2021-11-14 12:14:41 +01:00
|
|
|
|
|
|
|
Usage $0 [options...]
|
|
|
|
|
|
|
|
Configurations:
|
|
|
|
-h, --help Display this help
|
2023-12-01 18:30:01 +01:00
|
|
|
EOF
|
2021-11-14 12:14:41 +01:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2023-01-08 16:59:05 +01:00
|
|
|
#---
|
2021-11-16 17:43:29 +01:00
|
|
|
# Parse arguments
|
2023-01-08 16:59:05 +01:00
|
|
|
#---
|
2021-11-14 12:14:41 +01:00
|
|
|
|
2023-12-01 18:30:01 +01:00
|
|
|
for arg
|
|
|
|
do case "$arg" in
|
|
|
|
--help | -h) help;;
|
|
|
|
*)
|
|
|
|
echo "error: unreconized argument '$arg', giving up." >&2
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
done
|
2021-11-14 12:14:41 +01:00
|
|
|
|
|
|
|
|
2023-01-08 16:59:05 +01:00
|
|
|
#---
|
2021-11-14 12:14:41 +01:00
|
|
|
# Unistall step
|
2023-01-08 16:59:05 +01:00
|
|
|
#---
|
|
|
|
|
2023-12-01 18:30:01 +01:00
|
|
|
source ../scripts/_utils.sh
|
2021-11-14 12:14:41 +01:00
|
|
|
|
2023-01-08 16:59:05 +01:00
|
|
|
TAG='<sh-elf-vhex>'
|
2023-12-01 18:30:01 +01:00
|
|
|
PREFIX=$(utils_get_env 'VHEX_PREFIX_INSTALL' 'install')
|
|
|
|
SYSROOT=$(utils_get_env 'VHEX_PREFIX_SYSROOT' 'sysroot')
|
2021-11-14 12:14:41 +01:00
|
|
|
|
2023-01-08 16:59:05 +01:00
|
|
|
# Check that all tools has been generated
|
2021-11-15 17:04:56 +01:00
|
|
|
|
2023-12-01 18:30:01 +01:00
|
|
|
if [[ ! -f "$SYSROOT/bin/sh-elf-vhex-gcc" ]]
|
|
|
|
then
|
|
|
|
echo 'error: Are you sure to have built sh-elf-vhex ? it seems that' >&2
|
|
|
|
echo ' Missing '\''gcc'\'' tool...' >&2
|
2021-11-16 17:43:29 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-11-15 17:04:56 +01:00
|
|
|
|
2023-01-08 16:59:05 +01:00
|
|
|
#---
|
2021-11-14 12:14:41 +01:00
|
|
|
# Remove symlinks
|
2023-01-08 16:59:05 +01:00
|
|
|
#---
|
|
|
|
|
2021-11-14 12:14:41 +01:00
|
|
|
echo "$TAG Removing symlinks to binaries..."
|
2023-12-01 18:30:01 +01:00
|
|
|
for x in "$SYSROOT"/bin/*; do
|
2023-01-08 16:59:05 +01:00
|
|
|
unlink "$PREFIX/$x"
|
2021-11-14 12:14:41 +01:00
|
|
|
done
|
|
|
|
|
2023-01-08 16:59:05 +01:00
|
|
|
#---
|
|
|
|
# Remove sysroot
|
|
|
|
#---
|
2021-11-16 17:43:29 +01:00
|
|
|
|
2021-11-14 12:14:41 +01:00
|
|
|
echo "$TAG Removing installed files..."
|
2023-12-01 18:30:01 +01:00
|
|
|
rmdir "$SYSROOT"
|