Browse Source
Merge pull request #123 from Samourai-Wallet/enh_mydojo_install
add controls and confirmations before reinstalls and uninstalls
feat_mydojo_bitcoin_0_19_1
kenshin samourai
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
75 additions and
11 deletions
-
docker/my-dojo/conf/docker-mysql.conf.tpl
-
docker/my-dojo/dojo.sh
-
docker/my-dojo/install/install-scripts.sh
-
docker/my-dojo/install/uninstall-scripts.sh
|
|
@ -3,13 +3,16 @@ |
|
|
|
######################################### |
|
|
|
|
|
|
|
# Password of MySql root account |
|
|
|
# Warning: This option must not be modified after the first installation |
|
|
|
# Type: alphanumeric |
|
|
|
MYSQL_ROOT_PASSWORD=rootpassword |
|
|
|
|
|
|
|
# User account used for db access |
|
|
|
# Warning: This option must not be modified after the first installation |
|
|
|
# Type: alphanumeric |
|
|
|
MYSQL_USER=samourai |
|
|
|
|
|
|
|
# Password of of user account |
|
|
|
# Warning: This option must not be modified after the first installation |
|
|
|
# Type: alphanumeric |
|
|
|
MYSQL_PASSWORD=password |
|
|
@ -152,6 +152,30 @@ install() { |
|
|
|
launchInstall=$? |
|
|
|
fi |
|
|
|
|
|
|
|
# Detection of past install |
|
|
|
if [ $launchInstall -eq 0 ]; then |
|
|
|
pastInstallsfound=$(docker image ls | grep samouraiwallet/dojo-db | wc -l) |
|
|
|
if [ $pastInstallsfound -ne 0 ]; then |
|
|
|
# Past installation found. Ask confirmation forreinstall |
|
|
|
echo -e "\nWarning: Found traces of a previous installation of Dojo on this machine." |
|
|
|
echo "A new installation requires to remove these elements first." |
|
|
|
get_confirmation_reinstall |
|
|
|
launchReinstall=$? |
|
|
|
|
|
|
|
if [ $launchReinstall -eq 0 ]; then |
|
|
|
# Uninstall |
|
|
|
echo "" |
|
|
|
uninstall |
|
|
|
launchReinstall=$? |
|
|
|
fi |
|
|
|
|
|
|
|
if [ $launchReinstall -eq 1 ]; then |
|
|
|
launchInstall=1 |
|
|
|
echo -e "\nInstallation was cancelled." |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
# Installation |
|
|
|
if [ $launchInstall -eq 0 ]; then |
|
|
|
# Initialize the config files |
|
|
@ -167,6 +191,12 @@ install() { |
|
|
|
|
|
|
|
# Delete everything |
|
|
|
uninstall() { |
|
|
|
source "$DIR/install/uninstall-scripts.sh" |
|
|
|
|
|
|
|
get_confirmation |
|
|
|
launchUninstall=$? |
|
|
|
|
|
|
|
if [ $launchUninstall -eq 0 ]; then |
|
|
|
docker-compose rm |
|
|
|
|
|
|
|
yamlFiles=$(select_yaml_files) |
|
|
@ -181,6 +211,10 @@ uninstall() { |
|
|
|
docker image rm samouraiwallet/dojo-indexer:"$DOJO_INDEXER_VERSION_TAG" |
|
|
|
|
|
|
|
docker volume prune |
|
|
|
return 0 |
|
|
|
else |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
# Clean-up (remove old docker images) |
|
|
|
|
|
@ -31,6 +31,18 @@ get_confirmation() { |
|
|
|
done |
|
|
|
} |
|
|
|
|
|
|
|
# Confirm reinstallation |
|
|
|
get_confirmation_reinstall() { |
|
|
|
while true; do |
|
|
|
read -p "Do you really wish to reinstall Dojo on your computer? [y/n]" yn |
|
|
|
case $yn in |
|
|
|
[Yy]* ) return 0;; |
|
|
|
[Nn]* ) echo "Reinstallation was cancelled."; return 1;; |
|
|
|
* ) echo "Please answer yes or no.";; |
|
|
|
esac |
|
|
|
done |
|
|
|
} |
|
|
|
|
|
|
|
# Initialize configuration files from templates |
|
|
|
init_config_files() { |
|
|
|
# Initialize db scripts |
|
|
|
|
|
@ -0,0 +1,15 @@ |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
# Confirm uninstallation |
|
|
|
get_confirmation() { |
|
|
|
while true; do |
|
|
|
echo "This operation is going to uninstall Dojo from your computer." |
|
|
|
echo "Warning: This will delete from disk all the data stored by your Dojo (blockchain data, Dojo db, etc)." |
|
|
|
read -p "Do you wish to continue? [y/n]" yn |
|
|
|
case $yn in |
|
|
|
[Yy]* ) return 0;; |
|
|
|
[Nn]* ) echo "Uninstallation was cancelled."; return 1;; |
|
|
|
* ) echo "Please answer yes or no.";; |
|
|
|
esac |
|
|
|
done |
|
|
|
} |