Skip to content

Commit

Permalink
fixed #461 uninstall script for jarvis and its dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
alexylem committed Mar 5, 2017
1 parent 1375bee commit 8822a11
Show file tree
Hide file tree
Showing 20 changed files with 135 additions and 6 deletions.
8 changes: 8 additions & 0 deletions docs/api-reference-internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
-----------------

Expand Down
8 changes: 8 additions & 0 deletions docs/api-reference-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
-----------------

Expand Down
12 changes: 8 additions & 4 deletions jarvis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
Usage: ${0##*/} [-$flags]
Jarvis.sh is a lightweight configurable multi-lang jarvis-like bot
Jarvis.sh is a lightweight configurable multi-lang voice assistant
Meant for home automation running on slow computer (ex: Raspberry Pi)
It installs automatically speech recognition & synthesis engines of your choice
Installs automatically speech recognition & synthesis engines of your choice
Highly extendable thanks to a wide catalog of community plugins
Main options are now accessible through the application menu
Expand All @@ -25,6 +26,7 @@ show_help () { cat <<EOF
-n directly start jarvis without menu
-p install plugin, ex: ${0##*/} -p https://github.com/alexylem/time
-q quit jarvis if running in background
-r uninstall jarvis and its dependencies
-s just say something and exit, ex: ${0##*/} -s "hello world"
-u force update Jarvis and plugins (ex: use in cron)
-v troubleshooting mode
Expand Down Expand Up @@ -66,7 +68,7 @@ case "$OSTYPE" in
*) jv_error "ERROR: $OSTYPE is not a supported platform"
exit 1;;
esac
source utils/dialog_$platform.sh # load default & user configuration
source utils/dialog_$platform.sh

# Initiate files & directories
mkdir -p config
Expand Down Expand Up @@ -448,6 +450,8 @@ while getopts ":$flags" o; do
exit;;
q) jv_kill_jarvis
exit $?;;
r) source uninstall.sh
exit $?;;
s) just_say=${OPTARG}
jv_api=true;;
u) jv_check_updates "./" true # force udpate
Expand Down
1 change: 1 addition & 0 deletions stt_engines/bing/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
1 change: 1 addition & 0 deletions stt_engines/google_old/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
1 change: 1 addition & 0 deletions stt_engines/pocketsphinx/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ hash 'pocketsphinx_continuous' 2>/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
Expand Down
14 changes: 14 additions & 0 deletions stt_engines/pocketsphinx/uninstall.sh
Original file line number Diff line number Diff line change
@@ -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 ../
9 changes: 9 additions & 0 deletions stt_engines/snowboy/uninstall.sh
Original file line number Diff line number Diff line change
@@ -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*
1 change: 1 addition & 0 deletions stt_engines/wit/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
2 changes: 2 additions & 0 deletions tts_engines/espeak/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
jv_remove espeak
1 change: 1 addition & 0 deletions tts_engines/google/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
1 change: 1 addition & 0 deletions tts_engines/osx_say/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
2 changes: 2 additions & 0 deletions tts_engines/svox_pico/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
jv_remove libttspico-utils
1 change: 1 addition & 0 deletions tts_engines/voxygen_old/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
53 changes: 53 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -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 [email protected]"

exit 0
7 changes: 7 additions & 0 deletions utils/dialog_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 15 additions & 0 deletions utils/dialog_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions utils/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down
1 change: 0 additions & 1 deletion utils/store.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,4 @@ store_plugin_uninstall () { # $1:plugin_name
cd ../
jv_plugins_order_rebuild
cd plugins/
dialog_msg "Uninstallation Complete"
}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.03.03
17.03.05

0 comments on commit 8822a11

Please sign in to comment.