From 8822a117c5e11bc6d3f9ebd66f57523231d4cc6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20M=C3=A9ly?= Date: Sun, 5 Mar 2017 16:40:34 +0100 Subject: [PATCH] fixed #461 uninstall script for jarvis and its dependencies --- docs/api-reference-internal.md | 8 ++++ docs/api-reference-public.md | 8 ++++ jarvis.sh | 12 ++++-- stt_engines/bing/uninstall.sh | 1 + stt_engines/google_old/uninstall.sh | 1 + stt_engines/pocketsphinx/main.sh | 1 + stt_engines/pocketsphinx/uninstall.sh | 14 +++++++ stt_engines/snowboy/uninstall.sh | 9 +++++ stt_engines/wit/uninstall.sh | 1 + tts_engines/espeak/uninstall.sh | 2 + tts_engines/google/uninstall.sh | 1 + tts_engines/osx_say/uninstall.sh | 1 + tts_engines/svox_pico/uninstall.sh | 2 + tts_engines/voxygen_old/uninstall.sh | 1 + uninstall.sh | 53 +++++++++++++++++++++++++++ utils/dialog_linux.sh | 7 ++++ utils/dialog_osx.sh | 15 ++++++++ utils/menu.sh | 1 + utils/store.sh | 1 - version.txt | 2 +- 20 files changed, 135 insertions(+), 6 deletions(-) create mode 100644 stt_engines/bing/uninstall.sh create mode 100644 stt_engines/google_old/uninstall.sh create mode 100644 stt_engines/pocketsphinx/uninstall.sh create mode 100644 stt_engines/wit/uninstall.sh create mode 100644 tts_engines/espeak/uninstall.sh create mode 100644 tts_engines/google/uninstall.sh create mode 100644 tts_engines/osx_say/uninstall.sh create mode 100644 tts_engines/svox_pico/uninstall.sh create mode 100644 tts_engines/voxygen_old/uninstall.sh create mode 100755 uninstall.sh diff --git a/docs/api-reference-internal.md b/docs/api-reference-internal.md index 66be9c5..37a7a24 100644 --- a/docs/api-reference-internal.md +++ b/docs/api-reference-internal.md @@ -334,6 +334,14 @@ Public: install packages, used for dependencies args: list of packages to install +`jv_remove()` +------------- + +Public: remove packages, used for uninstalls + +args: list of packages to remove + + `jv_browse_url()` ----------------- diff --git a/docs/api-reference-public.md b/docs/api-reference-public.md index 3bcbffe..c3364d4 100644 --- a/docs/api-reference-public.md +++ b/docs/api-reference-public.md @@ -224,6 +224,14 @@ Public: install packages, used for dependencies args: list of packages to install +`jv_remove()` +------------- + +Public: remove packages, used for uninstalls + +args: list of packages to remove + + `jv_browse_url()` ----------------- diff --git a/jarvis.sh b/jarvis.sh index 10167d7..917acc2 100755 --- a/jarvis.sh +++ b/jarvis.sh @@ -3,14 +3,15 @@ # | JARVIS by Alexandre Mély - MIT license | # | http://domotiquefacile.fr/jarvis | # +----------------------------------------+ -flags='bc:ihjklmnp:qs:uvwx:z' +flags='bc:ihjklmnp:qrs:uvwx:z' show_help () { cat </dev/null || { make >/dev/null || exit 1 echo -e "\tInstalling..." sudo make install >/dev/null || exit 1 + cd ../ echo "4/4 Cleanup" echo -e "\tCleaning files..." rm sphinxbase-5prealpha.tar.gz || exit 1 diff --git a/stt_engines/pocketsphinx/uninstall.sh b/stt_engines/pocketsphinx/uninstall.sh new file mode 100644 index 0000000..39d2b43 --- /dev/null +++ b/stt_engines/pocketsphinx/uninstall.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +if [[ "$platform" == "linux" ]]; then + jv_remove bison libasound2-dev python-dev swig +elif [[ "$platform" == "osx" ]]; then + jv_remove wget swig +else + exit 1 +fi +cd sphinxbase-5prealpha +make uninstall +cd ../ +cd pocketsphinx-5prealpha +make uninstall +cd ../ diff --git a/stt_engines/snowboy/uninstall.sh b/stt_engines/snowboy/uninstall.sh index e8338ee..071b703 100755 --- a/stt_engines/snowboy/uninstall.sh +++ b/stt_engines/snowboy/uninstall.sh @@ -1,3 +1,12 @@ #!/bin/bash +if [ "$platform" = "linux" ]; then + jv_remove python-pyaudio python3-pyaudio libatlas-base-dev +elif [[ "$platform" == "osx" ]]; then + jv_remove portaudio +else + exit 1 +fi +jv_remove bzip2 +sudo pip uninstall pyaudio rm -rf resources rm *snowboy* diff --git a/stt_engines/wit/uninstall.sh b/stt_engines/wit/uninstall.sh new file mode 100644 index 0000000..f1f641a --- /dev/null +++ b/stt_engines/wit/uninstall.sh @@ -0,0 +1 @@ +#!/usr/bin/env bash diff --git a/tts_engines/espeak/uninstall.sh b/tts_engines/espeak/uninstall.sh new file mode 100644 index 0000000..1866f57 --- /dev/null +++ b/tts_engines/espeak/uninstall.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +jv_remove espeak diff --git a/tts_engines/google/uninstall.sh b/tts_engines/google/uninstall.sh new file mode 100644 index 0000000..f1f641a --- /dev/null +++ b/tts_engines/google/uninstall.sh @@ -0,0 +1 @@ +#!/usr/bin/env bash diff --git a/tts_engines/osx_say/uninstall.sh b/tts_engines/osx_say/uninstall.sh new file mode 100644 index 0000000..f1f641a --- /dev/null +++ b/tts_engines/osx_say/uninstall.sh @@ -0,0 +1 @@ +#!/usr/bin/env bash diff --git a/tts_engines/svox_pico/uninstall.sh b/tts_engines/svox_pico/uninstall.sh new file mode 100644 index 0000000..a8e7638 --- /dev/null +++ b/tts_engines/svox_pico/uninstall.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +jv_remove libttspico-utils diff --git a/tts_engines/voxygen_old/uninstall.sh b/tts_engines/voxygen_old/uninstall.sh new file mode 100644 index 0000000..f1f641a --- /dev/null +++ b/tts_engines/voxygen_old/uninstall.sh @@ -0,0 +1 @@ +#!/usr/bin/env bash diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..066056e --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +declare -f dialog_msg >/dev/null || { + echo "To uninstall, please run ./jarvis.sh -r" + exit 1 +} + +jv_yesno "Are you sure you want to uninstall Jarvis and all its dependancies?" || exit 1 + +shopt -s nullglob + +jv_warning "Uninstalling plugins" +cd plugins +for plugin in *; do + echo "uninstalling $plugin..." + store_plugin_uninstall $plugin +done +cd ../ + +jv_warning "Uninstalling TTS engines" +cd tts_engines +for tts_engine in *; do + echo "uninstalling $tts_engine..." + cd $tts_engine + uninstall.sh + cd ../ +done +cd ../ + +jv_warning "Uninstalling STT engines" +cd stt_engines +for stt_engine in *; do + echo "uninstalling $stt_engine..." + cd $stt_engine + uninstall.sh + cd ../ +done +cd ../ + +jv_warning "Uninstalling jarvis core dependencies" +jv_remove jq sox mpg123 + +jv_warning "Removing jarvis folder" +if jv_yesno "Do you want to backup your jarvis config?"; then + cp -R config ~/jarvis_backup/ + echo "config/ has been copied into ~/jarvis_backup" +fi +cd ../ +rm -rf jarvis + +jv_success "Jarvis has been uninstalled successfuly" +jv_debug "If you are not happy with Jarvis, please let me know the reasons at alexandre.mely@gmail.com" + +exit 0 diff --git a/utils/dialog_linux.sh b/utils/dialog_linux.sh index 9b31215..c6e478a 100644 --- a/utils/dialog_linux.sh +++ b/utils/dialog_linux.sh @@ -82,6 +82,13 @@ jv_install () { sudo apt-get install -y $@ } +# Public: remove packages, used for uninstalls +# +# args: list of packages to remove +jv_remove () { + sudo apt-get remove $@ +} + # Public: open URL in default browser jv_browse_url () { sensible-browser "$1" diff --git a/utils/dialog_osx.sh b/utils/dialog_osx.sh index 03f9e8d..cd92028 100644 --- a/utils/dialog_osx.sh +++ b/utils/dialog_osx.sh @@ -88,6 +88,21 @@ jv_install () { brew install $@ } +# Public: remove packages, used for uninstalls +# +# args: list of packages to remove +jv_remove () { + # assuming brew is installed + local to_remove="" + for formula in "$@"; do + brew ls --versions "$formula" >/dev/null && to_remove+=" $formula" + done + [ -z "to_remove" ] && return # nothing installed to remove + echo "The following packages will be REMOVED:" + echo "$to_remove" + jv_yesno "Do you want to continue?" && brew uninstall $to_remove +} + # Public: open URL in default browser jv_browse_url () { open "$1" diff --git a/utils/menu.sh b/utils/menu.sh index d4423e6..3b9eb05 100644 --- a/utils/menu.sh +++ b/utils/menu.sh @@ -119,6 +119,7 @@ menu_store () { Uninstall) if dialog_yesno "Are you sure?" true >/dev/null; then store_plugin_uninstall "$plugin" + dialog_msg "Uninstallation Complete" break 2 fi ;; diff --git a/utils/store.sh b/utils/store.sh index 42735cc..0b50cf7 100644 --- a/utils/store.sh +++ b/utils/store.sh @@ -76,5 +76,4 @@ store_plugin_uninstall () { # $1:plugin_name cd ../ jv_plugins_order_rebuild cd plugins/ - dialog_msg "Uninstallation Complete" } diff --git a/version.txt b/version.txt index 42d4c0c..758aa55 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -17.03.03 +17.03.05