From 3d1e580c45b007cc1836c9c34e3a27350854093f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Sep 2016 19:34:01 +0100 Subject: [PATCH] Tidying --- src/freedombone-app-babel | 2 +- src/freedombone-app-batman | 2 +- src/freedombone-app-blog | 2 +- src/freedombone-app-cjdns | 2 +- src/freedombone-app-dlna | 2 +- src/freedombone-app-emacs | 2 +- src/freedombone-app-gnusocial | 2 +- src/freedombone-app-gogs | 2 +- src/freedombone-app-hubzilla | 2 +- src/freedombone-app-ipfs | 4 ++-- src/freedombone-app-irc | 2 +- src/freedombone-app-librevault | 2 +- src/freedombone-app-mumble | 6 ++---- src/freedombone-app-rss | 2 +- src/freedombone-app-searx | 2 +- src/freedombone-app-sip | 2 +- src/freedombone-app-tahoelafs | 2 +- src/freedombone-app-tox | 6 +++--- src/freedombone-app-webmail | 2 +- src/freedombone-app-wiki | 2 +- src/freedombone-app-xmpp | 4 ++-- src/freedombone-app-zeronet | 8 ++++---- 22 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/freedombone-app-babel b/src/freedombone-app-babel index 4d81f900..cb670b6b 100755 --- a/src/freedombone-app-babel +++ b/src/freedombone-app-babel @@ -66,7 +66,7 @@ function restore_remote_babel { } function remove_babel { - if ! grep -Fxq "install_babel" $COMPLETION_FILE; then + if [[ $(app_is_installed babel) == "0" ]]; then return fi diff --git a/src/freedombone-app-batman b/src/freedombone-app-batman index b3f65fef..22225508 100755 --- a/src/freedombone-app-batman +++ b/src/freedombone-app-batman @@ -79,7 +79,7 @@ function restore_remote_batman { } function remove_batman { - if ! grep -Fxq "install_batman" $COMPLETION_FILE; then + if [[ $(app_is_installed batman) == "0" ]]; then return fi diff --git a/src/freedombone-app-blog b/src/freedombone-app-blog index 6c139841..9a3916b3 100755 --- a/src/freedombone-app-blog +++ b/src/freedombone-app-blog @@ -311,7 +311,7 @@ function restore_remote_blog { } function remove_blog { - if ! grep -Fxq "install_blog" $COMPLETION_FILE; then + if [[ $(app_is_installed blog) == "0" ]]; then return fi if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME ]; then diff --git a/src/freedombone-app-cjdns b/src/freedombone-app-cjdns index 02b422e9..7b12e1c0 100755 --- a/src/freedombone-app-cjdns +++ b/src/freedombone-app-cjdns @@ -171,7 +171,7 @@ function restore_remote_cjdns { } function remove_cjdns { - if ! grep -Fxq "install_cjdns" $COMPLETION_FILE; then + if [[ $(app_is_installed cjdns) == "0" ]]; then return fi service cjdns stop diff --git a/src/freedombone-app-dlna b/src/freedombone-app-dlna index c8af424c..22015d19 100755 --- a/src/freedombone-app-dlna +++ b/src/freedombone-app-dlna @@ -149,7 +149,7 @@ function restore_remote_dlna { } function remove_dlna { - if ! grep -Fxq "install_dlna" $COMPLETION_FILE; then + if [[ $(app_is_installed dlna) == "0" ]]; then return fi service minidlna stop diff --git a/src/freedombone-app-emacs b/src/freedombone-app-emacs index a3445e02..f71c2780 100755 --- a/src/freedombone-app-emacs +++ b/src/freedombone-app-emacs @@ -99,7 +99,7 @@ function restore_remote_emacs { } function remove_emacs { - if ! grep -Fxq "install_emacs" $COMPLETION_FILE; then + if [[ $(app_is_installed emacs) == "0" ]]; then return fi apt-get -y remove --purge emacs24 diff --git a/src/freedombone-app-gnusocial b/src/freedombone-app-gnusocial index 903aae5c..3a4bd2db 100755 --- a/src/freedombone-app-gnusocial +++ b/src/freedombone-app-gnusocial @@ -337,7 +337,7 @@ function restore_remote_gnusocial { } function remove_gnusocial { - if ! grep -Fxq "install_gnusocial" $COMPLETION_FILE; then + if [[ $(app_is_installed gnusocial) == "0" ]]; then return fi nginx_dissite $MICROBLOG_DOMAIN_NAME diff --git a/src/freedombone-app-gogs b/src/freedombone-app-gogs index e3c9d36d..c95b2b08 100755 --- a/src/freedombone-app-gogs +++ b/src/freedombone-app-gogs @@ -396,7 +396,7 @@ function restore_remote_gogs { } function remove_gogs { - if ! grep -Fxq "install_gogs" $COMPLETION_FILE; then + if [[ $(app_is_installed gogs) == "0" ]]; then return fi diff --git a/src/freedombone-app-hubzilla b/src/freedombone-app-hubzilla index 2246c5f0..602bfbff 100755 --- a/src/freedombone-app-hubzilla +++ b/src/freedombone-app-hubzilla @@ -354,7 +354,7 @@ function restore_remote_hubzilla { } function remove_hubzilla { - if ! grep -Fxq "Hubzilla domain" $COMPLETION_FILE; then + if [[ $(app_is_installed hubzilla) == "0" ]]; then return fi echo $'Removing Hubzilla' diff --git a/src/freedombone-app-ipfs b/src/freedombone-app-ipfs index 7dcde766..7685fb33 100755 --- a/src/freedombone-app-ipfs +++ b/src/freedombone-app-ipfs @@ -151,7 +151,7 @@ function restore_remote_ipfs { } function remove_ipfs_go { - if ! grep -Fxq "install_ipfs_go" $COMPLETION_FILE; then + if [[ $(app_is_installed ipfs_go) == "0" ]]; then return fi systemctl stop ipfs @@ -168,7 +168,7 @@ function remove_ipfs_go { } function remove_ipfs_js { - if ! grep -Fxq "install_ipfs_js" $COMPLETION_FILE; then + if [[ $(app_is_installed ipfs_js) == "0" ]]; then return fi systemctl stop ipfs diff --git a/src/freedombone-app-irc b/src/freedombone-app-irc index 60bd7ec2..c746d9ea 100755 --- a/src/freedombone-app-irc +++ b/src/freedombone-app-irc @@ -141,7 +141,7 @@ function restore_remote_irc { } function remove_irc { - if ! grep -Fxq "install_irc" $COMPLETION_FILE; then + if [[ $(app_is_installed irc) == "0" ]]; then return fi systemctl stop ngircd diff --git a/src/freedombone-app-librevault b/src/freedombone-app-librevault index aa1e73dc..9c15d239 100755 --- a/src/freedombone-app-librevault +++ b/src/freedombone-app-librevault @@ -104,7 +104,7 @@ function restore_remote_librevault { } function remove_librevault { - if ! grep -Fxq "install_librevault" $COMPLETION_FILE; then + if [[ $(app_is_installed librevault) == "0" ]]; then return fi iptables -D INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT diff --git a/src/freedombone-app-mumble b/src/freedombone-app-mumble index b52a2467..bcd2a21f 100755 --- a/src/freedombone-app-mumble +++ b/src/freedombone-app-mumble @@ -145,10 +145,8 @@ function restore_remote_mumble { } function remove_mumble { - if !grep -Fxq "install_mumble" $COMPLETION_FILE; then - if ! grep -Fxq "install_voip" $COMPLETION_FILE; then - return - fi + if [[ $(app_is_installed mumble) == "0" ]]; then + return fi apt-get -y remove --purge mumble-server if [[ $ONION_ONLY == "no" ]]; then diff --git a/src/freedombone-app-rss b/src/freedombone-app-rss index 4a310c9c..66bb82aa 100755 --- a/src/freedombone-app-rss +++ b/src/freedombone-app-rss @@ -253,7 +253,7 @@ function restore_remote_rss { } function remove_rss { - if ! grep -Fxq "install_rss" $COMPLETION_FILE; then + if [[ $(app_is_installed rss) == "0" ]]; then return fi nginx_dissite $RSS_READER_DOMAIN_NAME diff --git a/src/freedombone-app-searx b/src/freedombone-app-searx index b948b7bd..d68b4489 100755 --- a/src/freedombone-app-searx +++ b/src/freedombone-app-searx @@ -92,7 +92,7 @@ function restore_remote_searx { } function remove_searx { - if ! grep -Fxq "install_searx" $COMPLETION_FILE; then + if [[ $(app_is_installed searx) == "0" ]]; then return fi systemctl stop searx diff --git a/src/freedombone-app-sip b/src/freedombone-app-sip index 00506c1a..220a7adc 100755 --- a/src/freedombone-app-sip +++ b/src/freedombone-app-sip @@ -107,7 +107,7 @@ function restore_remote_sip { } function remove_sip { - if ! grep -Fxq "install_sip" $COMPLETION_FILE; then + if [[ $(app_is_installed sip) == "0" ]]; then return fi iptables -D INPUT -p udp --dport $VOIP_TURN_PORT -j ACCEPT diff --git a/src/freedombone-app-tahoelafs b/src/freedombone-app-tahoelafs index f448d1af..b39d9b83 100755 --- a/src/freedombone-app-tahoelafs +++ b/src/freedombone-app-tahoelafs @@ -178,7 +178,7 @@ function restore_remote_tahoelafs { } function remove_tahoelafs { - if ! grep -Fxq "install_tahoelafs" $COMPLETION_FILE; then + if [[ $(app_is_installed tahoelafs) == "0" ]]; then return fi iptables -D INPUT -p udp --dport $TAHOELAFS_PORT -j ACCEPT diff --git a/src/freedombone-app-tox b/src/freedombone-app-tox index 9243b93c..d3d17162 100755 --- a/src/freedombone-app-tox +++ b/src/freedombone-app-tox @@ -189,7 +189,7 @@ function restore_remote_tox { } function remove_tox_node { - if ! grep -Fxq "install_tox_node" $COMPLETION_FILE; then + if [[ $(app_is_installed tox_node) == "0" ]]; then return fi @@ -211,7 +211,7 @@ function remove_tox_node { } function remove_tox_avahi { - if ! grep -Fxq "tox_avahi" $COMPLETION_FILE; then + if [[ $(app_is_installed tox_avahi) == "0" ]]; then return fi cd $INSTALL_DIR/toxid @@ -221,7 +221,7 @@ function remove_tox_avahi { } function remove_tox_client { - if ! grep -Fxq "install_tox_client" $COMPLETION_FILE; then + if [[ $(app_is_installed tox_client) == "0" ]]; then return fi diff --git a/src/freedombone-app-webmail b/src/freedombone-app-webmail index 34554d6b..d873aa24 100755 --- a/src/freedombone-app-webmail +++ b/src/freedombone-app-webmail @@ -119,7 +119,7 @@ function restore_remote_webmail { } function remove_webmail { - if ! grep -Fxq "install_webmail" $COMPLETION_FILE; then + if [[ $(app_is_installed webmail) == "0" ]]; then return fi nginx_dissite webmail diff --git a/src/freedombone-app-wiki b/src/freedombone-app-wiki index 7fbc84c0..ef90d32a 100755 --- a/src/freedombone-app-wiki +++ b/src/freedombone-app-wiki @@ -233,7 +233,7 @@ function restore_remote_wiki { } function remove_wiki { - if ! grep -Fxq "install_wiki" $COMPLETION_FILE; then + if [[ $(app_is_installed wiki) == "0" ]]; then return fi function_check remove_onion_service diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp index bb434332..6e525132 100755 --- a/src/freedombone-app-xmpp +++ b/src/freedombone-app-xmpp @@ -210,7 +210,7 @@ function configure_firewall_for_xmpp { } function remove_xmpp_client { - if ! grep -Fxq "install_xmpp_client" $COMPLETION_FILE; then + if [[ $(app_is_installed xmpp_client) == "0" ]]; then return fi apt-get -y remove --purge profanity @@ -219,7 +219,7 @@ function remove_xmpp_client { function remove_xmpp { remove_xmpp_client - if ! grep -Fxq "install_xmpp" $COMPLETION_FILE; then + if [[ $(app_is_installed xmpp) == "0" ]]; then return fi iptables -D INPUT -p tcp --dport 5222:5223 -j ACCEPT diff --git a/src/freedombone-app-zeronet b/src/freedombone-app-zeronet index bf14880b..b72ba9f3 100755 --- a/src/freedombone-app-zeronet +++ b/src/freedombone-app-zeronet @@ -89,7 +89,7 @@ function restore_remote_zeronet { } function remove_zeronet_blog { - if ! grep -Fxq "install_zeronet_blog" $COMPLETION_FILE; then + if [[ $(app_is_installed zeronet_blog) == "0" ]]; then return fi if [ -d $MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then @@ -100,7 +100,7 @@ function remove_zeronet_blog { } function remove_zeronet_mail { - if ! grep -Fxq "install_zeronet_mail" $COMPLETION_FILE; then + if [[ $(app_is_installed zeronet_mail) == "0" ]]; then return fi if [ -d $MESH_INSTALL_DIR/zeronet/ZeroMail ]; then @@ -111,7 +111,7 @@ function remove_zeronet_mail { } function remove_zeronet_forum { - if ! grep -Fxq "install_zeronet_forum" $COMPLETION_FILE; then + if [[ $(app_is_installed zeronet_forum) == "0" ]]; then return fi if [ -d $MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then @@ -125,7 +125,7 @@ function remove_zeronet { remove_zeronet_blog remove_zeronet_mail remove_zeronet_forum - if ! grep -Fxq "install_zeronet" $COMPLETION_FILE; then + if [[ $(app_is_installed zeronet) == "0" ]]; then return fi iptables -D INPUT -i $WIFI_INTERFACE -p udp --dport $ZERONET_PORT -j ACCEPT