Function to remove zeronet

This commit is contained in:
Bob Mottram 2016-07-04 20:09:09 +01:00
parent ce9091d34a
commit 7da0bb1e81
2 changed files with 37 additions and 6 deletions

View File

@ -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

View File

@ -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