Bob Mottram 7 years ago
parent
commit
04e18d65c7

+ 1
- 1
src/freedombone-adduser View File

229
 done
229
 done
230
 
230
 
231
 if [ -f /etc/nginx/.htpasswd ]; then
231
 if [ -f /etc/nginx/.htpasswd ]; then
232
-    if ! grep "${ADD_USERNAME}:" /etc/nginx/.htpasswd; then
232
+    if ! grep -q "${ADD_USERNAME}:" /etc/nginx/.htpasswd; then
233
         echo "$NEW_USER_PASSWORD" | htpasswd -i -s /etc/nginx/.htpasswd $ADD_USERNAME
233
         echo "$NEW_USER_PASSWORD" | htpasswd -i -s /etc/nginx/.htpasswd $ADD_USERNAME
234
     fi
234
     fi
235
 fi
235
 fi

+ 2
- 2
src/freedombone-app-dokuwiki View File

67
     new_user_password="$2"
67
     new_user_password="$2"
68
 
68
 
69
     DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
69
     DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
70
-    if grep "$curr_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
70
+    if grep -q "$curr_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
71
         HASHED_DOKUWIKI_PASSWORD=$(echo -n "$new_user_password" | md5sum | awk -F ' ' '{print $1}')
71
         HASHED_DOKUWIKI_PASSWORD=$(echo -n "$new_user_password" | md5sum | awk -F ' ' '{print $1}')
72
         existing_user=$(cat /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php | grep "$curr_username:" | hean -n 1)
72
         existing_user=$(cat /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php | grep "$curr_username:" | hean -n 1)
73
         if [[ "$existing_user" == *":admin,"* ]]; then
73
         if [[ "$existing_user" == *":admin,"* ]]; then
99
     remove_username="$1"
99
     remove_username="$1"
100
 
100
 
101
     read_config_param "DOKUWIKI_DOMAIN_NAME"
101
     read_config_param "DOKUWIKI_DOMAIN_NAME"
102
-    if grep "$remove_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
102
+    if grep -q "$remove_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
103
         sed -i "/$remove_username:/d" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
103
         sed -i "/$remove_username:/d" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
104
         sed -i "/$remove_username:/d" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
104
         sed -i "/$remove_username:/d" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
105
         ${PROJECT_NAME}-pass -u "$remove_username" --rmapp dokuwiki
105
         ${PROJECT_NAME}-pass -u "$remove_username" --rmapp dokuwiki

+ 1
- 1
src/freedombone-app-etherpad View File

62
 
62
 
63
     read_config_param ETHERPAD_DOMAIN_NAME
63
     read_config_param ETHERPAD_DOMAIN_NAME
64
 
64
 
65
-    if grep "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
65
+    if grep -q "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
66
         user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
66
         user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
67
         if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
67
         if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
68
             sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"hash\": \"$new_user_password\", \"is_admin\": true }|g" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
68
             sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"hash\": \"$new_user_password\", \"is_admin\": true }|g" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json

+ 1
- 1
src/freedombone-app-irc View File

544
     else
544
     else
545
         sed -i 's|;SSLConnect.*|SSLConnect = no|g'
545
         sed -i 's|;SSLConnect.*|SSLConnect = no|g'
546
         # comment out the second Ports entry
546
         # comment out the second Ports entry
547
-        if ! grep ";Ports =" /etc/ngircd/ngircd.conf; then
547
+        if ! grep -q ";Ports =" /etc/ngircd/ngircd.conf; then
548
             sed -i '0,/Ports =/! s/Ports =/;Ports =/' /etc/ngircd/ngircd.conf
548
             sed -i '0,/Ports =/! s/Ports =/;Ports =/' /etc/ngircd/ngircd.conf
549
         fi
549
         fi
550
     fi
550
     fi

+ 5
- 5
src/freedombone-app-jitsi View File

56
     # an obvious security problem. This should disable it.
56
     # an obvious security problem. This should disable it.
57
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/analytics.js
57
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/analytics.js
58
     sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/analytics.js
58
     sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/analytics.js
59
-    if ! grep '//ga(' /usr/share/jitsi-meet/analytics.js; then
59
+    if ! grep -q '//ga(' /usr/share/jitsi-meet/analytics.js; then
60
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/analytics.js
60
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/analytics.js
61
     fi
61
     fi
62
-    if ! grep '//action +' /usr/share/jitsi-meet/analytics.js; then
62
+    if ! grep -q '//action +' /usr/share/jitsi-meet/analytics.js; then
63
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/analytics.js
63
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/analytics.js
64
     fi
64
     fi
65
 
65
 
66
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/libs/analytics.js
66
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/libs/analytics.js
67
     sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/libs/analytics.js
67
     sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/libs/analytics.js
68
-    if ! grep '//ga(' /usr/share/jitsi-meet/libs/analytics.js; then
68
+    if ! grep -q '//ga(' /usr/share/jitsi-meet/libs/analytics.js; then
69
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/libs/analytics.js
69
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/libs/analytics.js
70
     fi
70
     fi
71
-    if ! grep '//action +' /usr/share/jitsi-meet/libs/analytics.js; then
71
+    if ! grep -q '//action +' /usr/share/jitsi-meet/libs/analytics.js; then
72
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/libs/analytics.js
72
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/libs/analytics.js
73
     fi
73
     fi
74
 }
74
 }
230
         remove_nodejs jitsi
230
         remove_nodejs jitsi
231
         exit 638352
231
         exit 638352
232
     fi
232
     fi
233
-    if ! grep "jitsi" /etc/apt/sources.list; then
233
+    if ! grep -q "jitsi" /etc/apt/sources.list; then
234
         echo "deb http://download.jitsi.org/nightly/deb ${jitsi_deb_repo}/" >> /etc/apt/sources.list
234
         echo "deb http://download.jitsi.org/nightly/deb ${jitsi_deb_repo}/" >> /etc/apt/sources.list
235
     fi
235
     fi
236
     wget -qO - https://download.jitsi.org/nightly/deb/${jitsi_deb_repo}/archive.key | apt-key add -
236
     wget -qO - https://download.jitsi.org/nightly/deb/${jitsi_deb_repo}/archive.key | apt-key add -

+ 2
- 2
src/freedombone-app-mediagoblin View File

60
         echo $'Unable to fix email sending'
60
         echo $'Unable to fix email sending'
61
         exit 792532
61
         exit 792532
62
     fi
62
     fi
63
-    if ! grep 'import os' $mgfile; then
63
+    if ! grep -q 'import os' $mgfile; then
64
         sed -i '/import sys/a import os' $mgfile
64
         sed -i '/import sys/a import os' $mgfile
65
     fi
65
     fi
66
     sed -i "s|return mhost.sendmail(from_addr, to_addrs, message.as_string())|return os.system(\"echo '\" + message_body + \"' \| mail -s '\" + message['Subject'] + \"' \" + message['To'])|g" $mgfile
66
     sed -i "s|return mhost.sendmail(from_addr, to_addrs, message.as_string())|return os.system(\"echo '\" + message_body + \"' \| mail -s '\" + message['Subject'] + \"' \" + message['To'])|g" $mgfile
481
 
481
 
482
     sed -i 's|allow_reporting.*|allow_reporting = false|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
482
     sed -i 's|allow_reporting.*|allow_reporting = false|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
483
 
483
 
484
-    if ! grep '[[[skip_transcode]]]' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini; then
484
+    if ! grep -q '[[[skip_transcode]]]' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini; then
485
         echo '[[[skip_transcode]]]' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
485
         echo '[[[skip_transcode]]]' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
486
         echo 'mime_types = video/webm, video/ogg, video/mp4, audio/ogg, application/ogg, application/x-annodex' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
486
         echo 'mime_types = video/webm, video/ogg, video/mp4, audio/ogg, application/ogg, application/x-annodex' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
487
         echo 'container_formats = Matroska, Ogg, ISO MP4/M4A' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
487
         echo 'container_formats = Matroska, Ogg, ISO MP4/M4A' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini

+ 1
- 1
src/freedombone-app-searx View File

950
     echo '}' >> /etc/nginx/sites-available/searx
950
     echo '}' >> /etc/nginx/sites-available/searx
951
 
951
 
952
     # replace the secret key
952
     # replace the secret key
953
-    if ! grep "searx key" $COMPLETION_FILE; then
953
+    if ! grep -q "searx key" $COMPLETION_FILE; then
954
         SEARX_SECRET_KEY="$(create_password 30)"
954
         SEARX_SECRET_KEY="$(create_password 30)"
955
         set_completion_param "searx key" "${SEARX_SECRET_KEY}"
955
         set_completion_param "searx key" "${SEARX_SECRET_KEY}"
956
     fi
956
     fi

+ 2
- 2
src/freedombone-app-turtl View File

90
 }
90
 }
91
 
91
 
92
 function turtl_disable_registrations {
92
 function turtl_disable_registrations {
93
-    if grep "$TURTL_SIGNUP_STRING" $turtl_users_file; then
93
+    if grep -q "$TURTL_SIGNUP_STRING" $turtl_users_file; then
94
         if [ -f $turtl_users_file ]; then
94
         if [ -f $turtl_users_file ]; then
95
             cp $turtl_users_file $TURTL_BASE_DIR/.users.lisp
95
             cp $turtl_users_file $TURTL_BASE_DIR/.users.lisp
96
             sed -i '/(route (:post "\/users") (req res)/,/(send-json res user))))/{//!d}' $turtl_users_file
96
             sed -i '/(route (:post "\/users") (req res)/,/(send-json res user))))/{//!d}' $turtl_users_file
102
 }
102
 }
103
 
103
 
104
 function turtl_enable_registrations {
104
 function turtl_enable_registrations {
105
-    if ! grep "$TURTL_SIGNUP_STRING" $turtl_users_file; then
105
+    if ! grep -q "$TURTL_SIGNUP_STRING" $turtl_users_file; then
106
         if [ -f $TURTL_BASE_DIR/.users.lisp ]; then
106
         if [ -f $TURTL_BASE_DIR/.users.lisp ]; then
107
             cp $TURTL_BASE_DIR/.users.lisp $turtl_users_file
107
             cp $TURTL_BASE_DIR/.users.lisp $turtl_users_file
108
             rm $TURTL_BASE_DIR/.users.lisp
108
             rm $TURTL_BASE_DIR/.users.lisp

+ 2
- 2
src/freedombone-app-xmpp View File

334
     fi
334
     fi
335
 
335
 
336
     # change to using pep rather than profile modules
336
     # change to using pep rather than profile modules
337
-    if grep '"pep"' /etc/prosody/prosody.cfg.lua; then
337
+    if grep -q '"pep"' /etc/prosody/prosody.cfg.lua; then
338
         # This strange dance seems to fix occasional breakage of PEP
338
         # This strange dance seems to fix occasional breakage of PEP
339
         # Is there a better solution?
339
         # Is there a better solution?
340
         sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua
340
         sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua
343
         sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua
343
         sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua
344
         systemctl restart prosody
344
         systemctl restart prosody
345
     fi
345
     fi
346
-    if ! grep '"vcard"' /etc/prosody/prosody.cfg.lua; then
346
+    if ! grep -q '"vcard"' /etc/prosody/prosody.cfg.lua; then
347
         systemctl stop prosody
347
         systemctl stop prosody
348
         sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua
348
         sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua
349
         systemctl start prosody
349
         systemctl start prosody

+ 1
- 1
src/freedombone-base-email View File

1359
     fi
1359
     fi
1360
 
1360
 
1361
     # Separate logging, otherwise syslog is used
1361
     # Separate logging, otherwise syslog is used
1362
-    if ! grep "# logging" /etc/dovecot/dovecot.conf; then
1362
+    if ! grep -q "# logging" /etc/dovecot/dovecot.conf; then
1363
         echo '' >> /etc/dovecot/dovecot.conf
1363
         echo '' >> /etc/dovecot/dovecot.conf
1364
         echo '# logging' >> /etc/dovecot/dovecot.conf
1364
         echo '# logging' >> /etc/dovecot/dovecot.conf
1365
         echo 'log_path = /var/log/dovecot.log' >> /etc/dovecot/dovecot.conf
1365
         echo 'log_path = /var/log/dovecot.log' >> /etc/dovecot/dovecot.conf

+ 2
- 2
src/freedombone-controlpanel View File

1797
 
1797
 
1798
     # change muttrc
1798
     # change muttrc
1799
     if [ $SMTP_PROXY_ENABLE != $'no' ]; then
1799
     if [ $SMTP_PROXY_ENABLE != $'no' ]; then
1800
-        if ! grep "set smtp_url" $MUTTRC_FILE; then
1800
+        if ! grep -q "set smtp_url" $MUTTRC_FILE; then
1801
             echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
1801
             echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
1802
         else
1802
         else
1803
             sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" $MUTTRC_FILE
1803
             sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" $MUTTRC_FILE
1804
         fi
1804
         fi
1805
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
1805
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
1806
     else
1806
     else
1807
-        if grep "set smtp_url" $MUTTRC_FILE; then
1807
+        if grep -q "set smtp_url" $MUTTRC_FILE; then
1808
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
1808
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
1809
         fi
1809
         fi
1810
     fi
1810
     fi

+ 1
- 1
src/freedombone-controlpanel-user View File

623
         fi
623
         fi
624
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
624
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
625
     else
625
     else
626
-        if grep "set smtp_url" $MUTTRC_FILE; then
626
+        if grep -q "set smtp_url" $MUTTRC_FILE; then
627
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
627
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
628
         fi
628
         fi
629
     fi
629
     fi

+ 2
- 2
src/freedombone-image-customise View File

1146
     chroot "$rootdir" cd /root/build/tomb && make install
1146
     chroot "$rootdir" cd /root/build/tomb && make install
1147
     echo "tomb commit:$TOMB_COMMIT" >> $rootdir/root/freedombone-completed.txt
1147
     echo "tomb commit:$TOMB_COMMIT" >> $rootdir/root/freedombone-completed.txt
1148
 
1148
 
1149
-    if ! grep '* hard maxsyslogins' $rootdir/etc/security/limits.conf; then
1149
+    if ! grep -q '* hard maxsyslogins' $rootdir/etc/security/limits.conf; then
1150
         echo '* hard maxsyslogins 10' >> $rootdir/etc/security/limits.conf
1150
         echo '* hard maxsyslogins 10' >> $rootdir/etc/security/limits.conf
1151
     else
1151
     else
1152
         sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' $rootdir/etc/security/limits.conf
1152
         sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' $rootdir/etc/security/limits.conf
1153
     fi
1153
     fi
1154
 
1154
 
1155
     # Max logins for each user
1155
     # Max logins for each user
1156
-    if ! grep '* hard maxlogins' $rootdir/etc/security/limits.conf; then
1156
+    if ! grep -q '* hard maxlogins' $rootdir/etc/security/limits.conf; then
1157
         echo '* hard maxlogins 2' >> $rootdir/etc/security/limits.conf
1157
         echo '* hard maxlogins 2' >> $rootdir/etc/security/limits.conf
1158
     else
1158
     else
1159
         sed -i 's|hard maxlogins.*|hard maxlogins 2|g' $rootdir/etc/security/limits.conf
1159
         sed -i 's|hard maxlogins.*|hard maxlogins 2|g' $rootdir/etc/security/limits.conf

+ 1
- 1
src/freedombone-image-mesh View File

118
 
118
 
119
 function make_root_read_only {
119
 function make_root_read_only {
120
     if [ ! -d /home/$MY_USERNAME/Desktop ]; then
120
     if [ ! -d /home/$MY_USERNAME/Desktop ]; then
121
-        if ! grep 'ro,subvol=@' /etc/fstab; then
121
+        if ! grep -q 'ro,subvol=@' /etc/fstab; then
122
             sed -i 's|subvol=@|ro,subvol=@|g' /etc/fstab
122
             sed -i 's|subvol=@|ro,subvol=@|g' /etc/fstab
123
             echo $'Root filesystem set to read only' >> $INSTALL_LOG
123
             echo $'Root filesystem set to read only' >> $INSTALL_LOG
124
         fi
124
         fi

+ 1
- 1
src/freedombone-rmuser View File

106
 fi
106
 fi
107
 
107
 
108
 if [ -f /etc/nginx/.htpasswd ]; then
108
 if [ -f /etc/nginx/.htpasswd ]; then
109
-    if grep "${REMOVE_USERNAME}:" /etc/nginx/.htpasswd; then
109
+    if grep -q "${REMOVE_USERNAME}:" /etc/nginx/.htpasswd; then
110
         htpasswd -D /etc/nginx/.htpasswd $REMOVE_USERNAME
110
         htpasswd -D /etc/nginx/.htpasswd $REMOVE_USERNAME
111
     fi
111
     fi
112
 fi
112
 fi

+ 3
- 3
src/freedombone-sec View File

566
     if [ ! -d /var/www/${new_domain} ]; then
566
     if [ ! -d /var/www/${new_domain} ]; then
567
         domain_found=
567
         domain_found=
568
         if [ -f /etc/nginx/sites-available/radicale ]; then
568
         if [ -f /etc/nginx/sites-available/radicale ]; then
569
-            if grep "${new_domain}" /etc/nginx/sites-available/radicale; then
569
+            if grep -q "${new_domain}" /etc/nginx/sites-available/radicale; then
570
                 domain_found=1
570
                 domain_found=1
571
             fi
571
             fi
572
         fi
572
         fi
856
             if [ ${#response} -gt 2 ]; then
856
             if [ ${#response} -gt 2 ]; then
857
                 if [[ "${response}" != *" "* ]]; then
857
                 if [[ "${response}" != *" "* ]]; then
858
                     if [[ "${response}" == *"."* ]]; then
858
                     if [[ "${response}" == *"."* ]]; then
859
-                        if grep "Bridge ${response}" /etc/tor/torrc; then
859
+                        if grep -q "Bridge ${response}" /etc/tor/torrc; then
860
                             tor_remove_bridge "${response}"
860
                             tor_remove_bridge "${response}"
861
                             bridge_removed=1
861
                             bridge_removed=1
862
                         fi
862
                         fi
863
                     else
863
                     else
864
-                        if grep " $response" /etc/tor/torrc; then
864
+                        if grep -q " $response" /etc/tor/torrc; then
865
                             tor_remove_bridge "${response}"
865
                             tor_remove_bridge "${response}"
866
                             bridge_removed=1
866
                             bridge_removed=1
867
                         fi
867
                         fi

+ 1
- 1
src/freedombone-upgrade View File

64
     fi
64
     fi
65
 fi
65
 fi
66
 
66
 
67
-if grep "cat /root/dbpass" /usr/bin/backupdatabases; then
67
+if grep -q "cat /root/dbpass" /usr/bin/backupdatabases; then
68
     # update to using the password manager
68
     # update to using the password manager
69
     sed -i "s|cat /root/dbpass|freedombone-pass -u root -a mariadb|g" /usr/bin/backupdatabases
69
     sed -i "s|cat /root/dbpass|freedombone-pass -u root -a mariadb|g" /usr/bin/backupdatabases
70
 fi
70
 fi

+ 2
- 2
src/freedombone-utils-firewall View File

467
         # Don't try to block email/microblog addresses
467
         # Don't try to block email/microblog addresses
468
         return
468
         return
469
     fi
469
     fi
470
-    if ! grep "$blocked_domain" $FIREWALL_DOMAINS; then
470
+    if ! grep -q "$blocked_domain" $FIREWALL_DOMAINS; then
471
         hexstr=$(domain_to_hex_string $blocked_domain)
471
         hexstr=$(domain_to_hex_string $blocked_domain)
472
         iptables -C INPUT -p udp --dport 53 -m string --hex-string "$hexstr" --algo bm -j DROP
472
         iptables -C INPUT -p udp --dport 53 -m string --hex-string "$hexstr" --algo bm -j DROP
473
         if [ ! "$?" = "0" ]; then
473
         if [ ! "$?" = "0" ]; then
503
 
503
 
504
 function firewall_unblock_domain {
504
 function firewall_unblock_domain {
505
     unblocked_domain="$1"
505
     unblocked_domain="$1"
506
-    if grep "${unblocked_domain}" $FIREWALL_DOMAINS; then
506
+    if grep -q "${unblocked_domain}" $FIREWALL_DOMAINS; then
507
         hexstr=$(domain_to_hex_string $unblocked_domain)
507
         hexstr=$(domain_to_hex_string $unblocked_domain)
508
         iptables -D INPUT -p udp --dport 53 -m string --hex-string "$hexstr" --algo bm -j DROP
508
         iptables -D INPUT -p udp --dport 53 -m string --hex-string "$hexstr" --algo bm -j DROP
509
         iptables -D INPUT -p tcp --dport 53 -m string --hex-string "$hexstr" --algo bm -j DROP
509
         iptables -D INPUT -p tcp --dport 53 -m string --hex-string "$hexstr" --algo bm -j DROP

+ 4
- 4
src/freedombone-utils-gpg View File

259
     for d in /home/*/ ; do
259
     for d in /home/*/ ; do
260
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
260
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
261
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
261
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
262
-            if grep '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
262
+            if grep -q '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
263
                 sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
263
                 sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
264
                 sed -i 's|#:0 f|:0 f|g' /home/$USERNAME/.procmailrc
264
                 sed -i 's|#:0 f|:0 f|g' /home/$USERNAME/.procmailrc
265
             fi
265
             fi
266
         fi
266
         fi
267
     done
267
     done
268
 
268
 
269
-    if grep '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
269
+    if grep -q '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
270
         sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
270
         sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
271
         sed -i 's|#:0 f|:0 f|g' /etc/skel/.procmailrc
271
         sed -i 's|#:0 f|:0 f|g' /etc/skel/.procmailrc
272
     fi
272
     fi
276
     for d in /home/*/ ; do
276
     for d in /home/*/ ; do
277
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
277
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
278
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
278
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
279
-            if ! grep '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
279
+            if ! grep -q '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
280
                 sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
280
                 sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
281
                 sed -i 's|:0 f|#:0 f|g' /home/$USERNAME/.procmailrc
281
                 sed -i 's|:0 f|#:0 f|g' /home/$USERNAME/.procmailrc
282
             fi
282
             fi
283
         fi
283
         fi
284
     done
284
     done
285
 
285
 
286
-    if ! grep '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
286
+    if ! grep -q '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
287
         sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
287
         sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
288
         sed -i 's|:0 f|#:0 f|g' /etc/skel/.procmailrc
288
         sed -i 's|:0 f|#:0 f|g' /etc/skel/.procmailrc
289
     fi
289
     fi

+ 2
- 2
src/freedombone-utils-nodejs View File

88
         return
88
         return
89
     fi
89
     fi
90
     sed -i "/install_${1}/d" $NODEJS_INSTALLED_APPS_FILE
90
     sed -i "/install_${1}/d" $NODEJS_INSTALLED_APPS_FILE
91
-    if ! grep "install_" $NODEJS_INSTALLED_APPS_FILE; then
91
+    if ! grep -q "install_" $NODEJS_INSTALLED_APPS_FILE; then
92
         apt-get -yq remove --purge nodejs
92
         apt-get -yq remove --purge nodejs
93
 
93
 
94
         if [ -f /usr/bin/nodejs ]; then
94
         if [ -f /usr/bin/nodejs ]; then
211
     fi
211
     fi
212
 
212
 
213
     if [ $1 ]; then
213
     if [ $1 ]; then
214
-        if ! grep "install_${1}" $NODEJS_INSTALLED_APPS_FILE; then
214
+        if ! grep -q "install_${1}" $NODEJS_INSTALLED_APPS_FILE; then
215
             echo "install_${1}" >> $NODEJS_INSTALLED_APPS_FILE
215
             echo "install_${1}" >> $NODEJS_INSTALLED_APPS_FILE
216
         fi
216
         fi
217
     fi
217
     fi

+ 1
- 1
src/freedombone-utils-onion View File

299
     fi
299
     fi
300
 
300
 
301
     # resolve DNS via tor
301
     # resolve DNS via tor
302
-    if ! grep 'DNSPort 53' /etc/tor/torrc; then
302
+    if ! grep -q 'DNSPort 53' /etc/tor/torrc; then
303
         echo 'DNSPort 53' >> /etc/tor/torrc
303
         echo 'DNSPort 53' >> /etc/tor/torrc
304
         echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc
304
         echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc
305
         echo 'AutomapHostsSuffixes .exit,.onion' >> /etc/tor/torrc
305
         echo 'AutomapHostsSuffixes .exit,.onion' >> /etc/tor/torrc

+ 10
- 10
src/freedombone-utils-setup View File

139
     rmmod -f bnep
139
     rmmod -f bnep
140
     rmmod -f bluetooth
140
     rmmod -f bluetooth
141
     if [ -f /etc/default/bluetooth ]; then
141
     if [ -f /etc/default/bluetooth ]; then
142
-        if grep "BLUETOOTH_ENABLED=" /etc/default/bluetooth; then
142
+        if grep -q "BLUETOOTH_ENABLED=" /etc/default/bluetooth; then
143
             sed -i 's|BLUETOOTH_ENABLED=.*|BLUETOOTH_ENABLED=0|g' /etc/default/bluetooth
143
             sed -i 's|BLUETOOTH_ENABLED=.*|BLUETOOTH_ENABLED=0|g' /etc/default/bluetooth
144
         else
144
         else
145
             echo "BLUETOOTH_ENABLED=0" >> /etc/default/bluetooth
145
             echo "BLUETOOTH_ENABLED=0" >> /etc/default/bluetooth
146
         fi
146
         fi
147
     fi
147
     fi
148
-    if ! grep 'blacklist bnep' /etc/modprobe.d/bluetooth.conf; then
148
+    if ! grep -q 'blacklist bnep' /etc/modprobe.d/bluetooth.conf; then
149
         echo 'blacklist bnep' >> /etc/modprobe.d/bluetooth.conf
149
         echo 'blacklist bnep' >> /etc/modprobe.d/bluetooth.conf
150
     fi
150
     fi
151
-    if ! grep 'blacklist btusb' /etc/modprobe.d/bluetooth.conf; then
151
+    if ! grep -q 'blacklist btusb' /etc/modprobe.d/bluetooth.conf; then
152
         echo 'blacklist btusb' >> /etc/modprobe.d/bluetooth.conf
152
         echo 'blacklist btusb' >> /etc/modprobe.d/bluetooth.conf
153
     fi
153
     fi
154
-    if ! grep 'blacklist bluetooth' /etc/modprobe.d/bluetooth.conf; then
154
+    if ! grep -q 'blacklist bluetooth' /etc/modprobe.d/bluetooth.conf; then
155
         echo 'blacklist bluetooth' >> /etc/modprobe.d/bluetooth.conf
155
         echo 'blacklist bluetooth' >> /etc/modprobe.d/bluetooth.conf
156
     fi
156
     fi
157
     update-initramfs -u -k `uname -r` -v
157
     update-initramfs -u -k `uname -r` -v
430
 function set_max_login_tries {
430
 function set_max_login_tries {
431
     max_tries=$1
431
     max_tries=$1
432
 
432
 
433
-    if ! grep ' deny=' /etc/pam.d/common-auth; then
433
+    if ! grep -q ' deny=' /etc/pam.d/common-auth; then
434
         sed -i "/pam_deny.so/a auth    required\t\t\tpam_tally.so    onerr=fail no_lock_time per_user deny=$max_tries" /etc/pam.d/common-auth
434
         sed -i "/pam_deny.so/a auth    required\t\t\tpam_tally.so    onerr=fail no_lock_time per_user deny=$max_tries" /etc/pam.d/common-auth
435
     else
435
     else
436
         sed -i "s| deny=.*| deny=$max_tries|g" /etc/pam.d/common-auth
436
         sed -i "s| deny=.*| deny=$max_tries|g" /etc/pam.d/common-auth
437
     fi
437
     fi
438
 
438
 
439
-    if ! grep ' deny=' /etc/pam.d/common-account; then
439
+    if ! grep -q ' deny=' /etc/pam.d/common-account; then
440
         sed -i '/pam_deny.so/a account required\t\t\tpam_tally.so' /etc/pam.d/common-account
440
         sed -i '/pam_deny.so/a account required\t\t\tpam_tally.so' /etc/pam.d/common-account
441
     else
441
     else
442
         sed -i "s| deny=.*| deny=$max_tries|g" /etc/pam.d/common-account
442
         sed -i "s| deny=.*| deny=$max_tries|g" /etc/pam.d/common-account
445
 
445
 
446
 function limit_user_logins {
446
 function limit_user_logins {
447
     # overall max logins
447
     # overall max logins
448
-    if ! grep '* hard maxsyslogins' /etc/security/limits.conf; then
448
+    if ! grep -q '* hard maxsyslogins' /etc/security/limits.conf; then
449
         echo '* hard maxsyslogins 10' >> /etc/security/limits.conf
449
         echo '* hard maxsyslogins 10' >> /etc/security/limits.conf
450
     else
450
     else
451
         sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' /etc/security/limits.conf
451
         sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' /etc/security/limits.conf
452
     fi
452
     fi
453
 
453
 
454
     # Max logins for each user
454
     # Max logins for each user
455
-    if ! grep '* hard maxlogins' /etc/security/limits.conf; then
455
+    if ! grep -q '* hard maxlogins' /etc/security/limits.conf; then
456
         echo '* hard maxlogins 2' >> /etc/security/limits.conf
456
         echo '* hard maxlogins 2' >> /etc/security/limits.conf
457
     else
457
     else
458
         sed -i 's|hard maxlogins.*|hard maxlogins 2|g' /etc/security/limits.conf
458
         sed -i 's|hard maxlogins.*|hard maxlogins 2|g' /etc/security/limits.conf
460
 }
460
 }
461
 
461
 
462
 function remove_serial_logins {
462
 function remove_serial_logins {
463
-    if grep 'ttyS' /etc/securetty; then
463
+    if grep -q 'ttyS' /etc/securetty; then
464
         cp /etc/securetty /etc/securetty_old
464
         cp /etc/securetty /etc/securetty_old
465
         sed -i '/ttyS/d' /etc/securetty
465
         sed -i '/ttyS/d' /etc/securetty
466
     fi
466
     fi
581
 }
581
 }
582
 
582
 
583
 function disable_core_dumps {
583
 function disable_core_dumps {
584
-    if ! grep '* hard core 0' /etc/security/limits.conf; then
584
+    if ! grep -q '* hard core 0' /etc/security/limits.conf; then
585
         echo '* hard core 0' >> /etc/security/limits.conf
585
         echo '* hard core 0' >> /etc/security/limits.conf
586
     else
586
     else
587
         sed -i 's|hard core.*|hard core 0|g' /etc/security/limits.conf
587
         sed -i 's|hard core.*|hard core 0|g' /etc/security/limits.conf