From 7da0bb1e81cfab8e8974e4acdb66e312f5437528 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 4 Jul 2016 20:09:09 +0100 Subject: [PATCH] Function to remove zeronet --- src/freedombone-app-zeronet | 19 ++++++++++++++----- src/freedombone-mesh-install | 24 +++++++++++++++++++++++- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/freedombone-app-zeronet b/src/freedombone-app-zeronet index a3dddd6c..46eb8960 100755 --- a/src/freedombone-app-zeronet +++ b/src/freedombone-app-zeronet @@ -70,7 +70,7 @@ function install_zeronet_blog { return fi - function_check set_repo_commit + function_check set_repo_commit set_repo_commit $MESH_INSTALL_DIR/zeronet/ZeroBlog "ZeroNet Blog commit" "$ZERONET_BLOG_COMMIT" $ZERONET_BLOG_REPO if grep -Fxq "install_zeronet_blog" $COMPLETION_FILE; then @@ -122,7 +122,7 @@ function install_zeronet_blog { exit 7638 fi - function_check git_clone + function_check git_clone git_clone $ZERONET_BLOG_REPO ZeroBlog if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then echo $'ZeroBlog repo could not be cloned' @@ -176,7 +176,7 @@ function install_zeronet_mail { return fi - function_check set_repo_commit + function_check set_repo_commit set_repo_commit $MESH_INSTALL_DIR/zeronet/ZeroMail "ZeroNet Mail commit" "$ZERONET_MAIL_COMMIT" $ZERONET_MAIL_REPO if grep -Fxq "install_zeronet_mail" $COMPLETION_FILE; then @@ -228,7 +228,7 @@ function install_zeronet_mail { exit 7638 fi - function_check git_clone + function_check git_clone git_clone $ZERONET_MAIL_REPO ZeroMail if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroMail ]; then echo $'ZeroMail repo could not be cloned' @@ -335,7 +335,7 @@ function install_zeronet_forum { exit 7638 fi - function_check git_clone + function_check git_clone git_clone $ZERONET_FORUM_REPO ZeroTalk if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then echo $'ZeroTalk repo could not be cloned' @@ -378,6 +378,15 @@ function install_zeronet_forum { echo 'install_zeronet_forum' >> $COMPLETION_FILE } +function remove_zeronet { + if ! grep -Fxq "install_zeronet" $COMPLETION_FILE; then + return + fi + ${PROJECT_NAME}-mesh-install -f zeronet --remove yes + sed -i '/install_zeronet/d' $COMPLETION_FILE + sed -i '/ZeroNet /d' $COMPLETION_FILE +} + function install_zeronet { if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then return diff --git a/src/freedombone-mesh-install b/src/freedombone-mesh-install index 4085c8a0..7f46caab 100755 --- a/src/freedombone-mesh-install +++ b/src/freedombone-mesh-install @@ -668,6 +668,24 @@ function mesh_tox_client_toxic_from_repo { echo "Toxic Installed." } +function mesh_zeronet_remove { + systemctl stop zeronet + systemctl disable zeronet + systemctl stop tracker + systemctl disable tracker + $CHROOT_PREFIX apt-get -y remove --purge bittornado + if [ -f $rootdir/etc/systemd/system/zeronet.service ]; then + rm $rootdir/etc/systemd/system/zeronet.service + fi + if [ -f $rootdir/etc/systemd/system/tracker.service ]; then + rm $rootdir/etc/systemd/system/tracker.service + fi + if [ -d $rootdir$MESH_INSTALL_DIR/zeronet ]; then + rm -rf $rootdir$MESH_INSTALL_DIR/zeronet + fi + userdel -r zeronet +} + function mesh_zeronet { # obtain commits from the main file if [ -f /usr/local/bin/${PROJECT_NAME} ]; then @@ -1122,7 +1140,11 @@ if [[ $FN == 'tox_client' ]]; then fi fi if [[ $FN == 'zeronet' ]]; then - mesh_zeronet + if [[ $REMOVE != 'yes' ]]; then + mesh_zeronet + else + mesh_zeronet_remove + fi fi if [[ $FN == 'qtox' ]]; then mesh_tox_client_qtox