diff --git a/scripts/install.sh b/scripts/install.sh index 1bcf80e..3e9a3b1 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -13,7 +13,7 @@ Usage: $0 [options...] Options: -h, --help display this help -y, --yes do not display validation step - --verbose display more information during operations + -v, --verbose display more information during operations --prefix-sysroot sysroot (install) prefix path Notes: diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh new file mode 100755 index 0000000..df3030e --- /dev/null +++ b/scripts/uninstall.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +#--- +# Help screen +#--- + +function help() { + cat << EOF +Uninstallation script for vxOpenLibm project (for of OpenLibm) + +Usage: $0 [options...] + +Options: + -h, --help display this help + -y, --yes do not display validation step + -v, --verbose display more information during operations + +Notes: + This project is a dependency of "sh-elf-vhex" compiler, manual + uninstallation can break all the toolchain. +EOF + exit 0 +} + +#--- +# Parse arguments +#--- + +verbose=false +skip_input=false +for arg; do + case "$arg" in + -h | --help) help;; + -y | --yes) skip_input=true;; + -v | --verbose) verbose=true;; + *) + echo "error: unreconized argument '$arg', giving up." >&2 + exit 1 + esac +done + +#--- +# Preliminary check +#--- + +_src=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +cd "$_src" || exit 1 +source ./_utils.sh + +if ! test -f '../openlibm/_build-vhex/install_manifest.txt' +then + echo 'vxOpenLibm not installed, nothing to do' + exit 0 +fi + +if [[ "$skip_input" != 'true' ]] +then + echo 'This script will remove the vxOpenLibm from the builded sysroot' + read -p 'Perform operation [yN] ? ' -r valid + if [[ "$valid" != 'y' ]] + then + echo 'Operation aborded' >&2 + exit 1 + fi +fi + +#--- +# Manual uninstall +#--- + +echo "$TAG removing installed files..." +while IFS='' read -r line || [[ -n "$line" ]] + do + ! test -f "$line" && continue + [[ "$verbose" == 'true' ]] && echo "rm $line" + rm "$line" + done < '../openlibm/_build-vhex/install_manifest.txt'