diff --git a/scripts/kicad-install.sh b/scripts/kicad-install.sh index 955dc3aa7d..69041adf79 100755 --- a/scripts/kicad-install.sh +++ b/scripts/kicad-install.sh @@ -19,8 +19,9 @@ usage() echo "" echo "./kicad-install.sh " echo " where is one of:" - echo " --install-or-update (does full installation or update.)" - echo " --remove-sources (removes source trees for another attempt.)" + echo " --install-or-update (does full installation or update.)" + echo " --remove-sources (removes source trees for another attempt.)" + echo " --uninstall-libraries (removes KiCad supplied libraries.)" echo "" echo "example:" echo ' $ ./kicad-install.sh --install-or-update' @@ -85,6 +86,27 @@ rm_build_dir() } +cmake_uninstall() +{ + # assume caller set the CWD, and is only telling us about it in $1 + local dir="$1" + + cwd=`pwd` + if [ "$cwd" != "$dir" ]; then + echo "missing dir $dir" + elif [ ! -e install_manifest.txt ]; then + echo + echo "Missing file $dir/install_manifest.txt." + echo "Libraries may have already been uinstalled, or were not" + echo 'originally installed with an "uninstall" knowledgable CMakeLists.txt file.' + else + echo "uninstalling from $dir" + sudo make uninstall + sudo rm install_manifest.txt + fi +} + + install_or_update() { echo "step 1) installing pre-requisites" @@ -202,4 +224,11 @@ if [ $# -eq 1 -a "$1" == "--install-or-update" ]; then exit fi + +if [ $# -eq 1 -a "$1" == "--uninstall-libraries" ]; then + cd "$WORKING_TREES/kicad-lib.bzr/build" + cmake_uninstall "$WORKING_TREES/kicad-lib.bzr/build" + exit +fi + usage