Bob Mottram 7 anni fa
parent
commit
04e18d65c7

+ 1
- 1
src/freedombone-adduser Vedi File

@@ -229,7 +229,7 @@ do
229 229
 done
230 230
 
231 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 233
         echo "$NEW_USER_PASSWORD" | htpasswd -i -s /etc/nginx/.htpasswd $ADD_USERNAME
234 234
     fi
235 235
 fi

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

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

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

@@ -62,7 +62,7 @@ function change_password_etherpad {
62 62
 
63 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 66
         user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
67 67
         if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
68 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 Vedi File

@@ -544,7 +544,7 @@ function install_irc_server {
544 544
     else
545 545
         sed -i 's|;SSLConnect.*|SSLConnect = no|g'
546 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 548
             sed -i '0,/Ports =/! s/Ports =/;Ports =/' /etc/ngircd/ngircd.conf
549 549
         fi
550 550
     fi

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

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

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

@@ -60,7 +60,7 @@ function mediagoblin_fix_email {
60 60
         echo $'Unable to fix email sending'
61 61
         exit 792532
62 62
     fi
63
-    if ! grep 'import os' $mgfile; then
63
+    if ! grep -q 'import os' $mgfile; then
64 64
         sed -i '/import sys/a import os' $mgfile
65 65
     fi
66 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,7 +481,7 @@ function install_mediagoblin {
481 481
 
482 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 485
         echo '[[[skip_transcode]]]' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
486 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 487
         echo 'container_formats = Matroska, Ogg, ISO MP4/M4A' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini

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

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

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

@@ -90,7 +90,7 @@ function install_interactive_turtl {
90 90
 }
91 91
 
92 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 94
         if [ -f $turtl_users_file ]; then
95 95
             cp $turtl_users_file $TURTL_BASE_DIR/.users.lisp
96 96
             sed -i '/(route (:post "\/users") (req res)/,/(send-json res user))))/{//!d}' $turtl_users_file
@@ -102,7 +102,7 @@ function turtl_disable_registrations {
102 102
 }
103 103
 
104 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 106
         if [ -f $TURTL_BASE_DIR/.users.lisp ]; then
107 107
             cp $TURTL_BASE_DIR/.users.lisp $turtl_users_file
108 108
             rm $TURTL_BASE_DIR/.users.lisp

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

@@ -334,7 +334,7 @@ function update_prosody_modules {
334 334
     fi
335 335
 
336 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 338
         # This strange dance seems to fix occasional breakage of PEP
339 339
         # Is there a better solution?
340 340
         sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua
@@ -343,7 +343,7 @@ function update_prosody_modules {
343 343
         sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua
344 344
         systemctl restart prosody
345 345
     fi
346
-    if ! grep '"vcard"' /etc/prosody/prosody.cfg.lua; then
346
+    if ! grep -q '"vcard"' /etc/prosody/prosody.cfg.lua; then
347 347
         systemctl stop prosody
348 348
         sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua
349 349
         systemctl start prosody

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

@@ -1359,7 +1359,7 @@ function configure_imap {
1359 1359
     fi
1360 1360
 
1361 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 1363
         echo '' >> /etc/dovecot/dovecot.conf
1364 1364
         echo '# logging' >> /etc/dovecot/dovecot.conf
1365 1365
         echo 'log_path = /var/log/dovecot.log' >> /etc/dovecot/dovecot.conf

+ 2
- 2
src/freedombone-controlpanel Vedi File

@@ -1797,14 +1797,14 @@ function email_smtp_proxy {
1797 1797
 
1798 1798
     # change muttrc
1799 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 1801
             echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
1802 1802
         else
1803 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 1804
         fi
1805 1805
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
1806 1806
     else
1807
-        if grep "set smtp_url" $MUTTRC_FILE; then
1807
+        if grep -q "set smtp_url" $MUTTRC_FILE; then
1808 1808
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
1809 1809
         fi
1810 1810
     fi

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

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

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

@@ -1146,14 +1146,14 @@ function image_setup_utils {
1146 1146
     chroot "$rootdir" cd /root/build/tomb && make install
1147 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 1150
         echo '* hard maxsyslogins 10' >> $rootdir/etc/security/limits.conf
1151 1151
     else
1152 1152
         sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' $rootdir/etc/security/limits.conf
1153 1153
     fi
1154 1154
 
1155 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 1157
         echo '* hard maxlogins 2' >> $rootdir/etc/security/limits.conf
1158 1158
     else
1159 1159
         sed -i 's|hard maxlogins.*|hard maxlogins 2|g' $rootdir/etc/security/limits.conf

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

@@ -118,7 +118,7 @@ function create_ram_disk {
118 118
 
119 119
 function make_root_read_only {
120 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 122
             sed -i 's|subvol=@|ro,subvol=@|g' /etc/fstab
123 123
             echo $'Root filesystem set to read only' >> $INSTALL_LOG
124 124
         fi

+ 1
- 1
src/freedombone-rmuser Vedi File

@@ -106,7 +106,7 @@ else
106 106
 fi
107 107
 
108 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 110
         htpasswd -D /etc/nginx/.htpasswd $REMOVE_USERNAME
111 111
     fi
112 112
 fi

+ 3
- 3
src/freedombone-sec Vedi File

@@ -566,7 +566,7 @@ function create_letsencrypt {
566 566
     if [ ! -d /var/www/${new_domain} ]; then
567 567
         domain_found=
568 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 570
                 domain_found=1
571 571
             fi
572 572
         fi
@@ -856,12 +856,12 @@ function remove_tor_bridge {
856 856
             if [ ${#response} -gt 2 ]; then
857 857
                 if [[ "${response}" != *" "* ]]; then
858 858
                     if [[ "${response}" == *"."* ]]; then
859
-                        if grep "Bridge ${response}" /etc/tor/torrc; then
859
+                        if grep -q "Bridge ${response}" /etc/tor/torrc; then
860 860
                             tor_remove_bridge "${response}"
861 861
                             bridge_removed=1
862 862
                         fi
863 863
                     else
864
-                        if grep " $response" /etc/tor/torrc; then
864
+                        if grep -q " $response" /etc/tor/torrc; then
865 865
                             tor_remove_bridge "${response}"
866 866
                             bridge_removed=1
867 867
                         fi

+ 1
- 1
src/freedombone-upgrade Vedi File

@@ -64,7 +64,7 @@ if [ $DEVELOPMENT_BRANCH ]; then
64 64
     fi
65 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 68
     # update to using the password manager
69 69
     sed -i "s|cat /root/dbpass|freedombone-pass -u root -a mariadb|g" /usr/bin/backupdatabases
70 70
 fi

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

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

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

@@ -259,14 +259,14 @@ function enable_email_encryption_at_rest {
259 259
     for d in /home/*/ ; do
260 260
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
261 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 263
                 sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
264 264
                 sed -i 's|#:0 f|:0 f|g' /home/$USERNAME/.procmailrc
265 265
             fi
266 266
         fi
267 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 270
         sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
271 271
         sed -i 's|#:0 f|:0 f|g' /etc/skel/.procmailrc
272 272
     fi
@@ -276,14 +276,14 @@ function disable_email_encryption_at_rest {
276 276
     for d in /home/*/ ; do
277 277
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
278 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 280
                 sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
281 281
                 sed -i 's|:0 f|#:0 f|g' /home/$USERNAME/.procmailrc
282 282
             fi
283 283
         fi
284 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 287
         sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
288 288
         sed -i 's|:0 f|#:0 f|g' /etc/skel/.procmailrc
289 289
     fi

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

@@ -88,7 +88,7 @@ function remove_nodejs {
88 88
         return
89 89
     fi
90 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 92
         apt-get -yq remove --purge nodejs
93 93
 
94 94
         if [ -f /usr/bin/nodejs ]; then
@@ -211,7 +211,7 @@ function install_nodejs {
211 211
     fi
212 212
 
213 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 215
             echo "install_${1}" >> $NODEJS_INSTALLED_APPS_FILE
216 216
         fi
217 217
     fi

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

@@ -299,7 +299,7 @@ function resolve_dns_via_tor {
299 299
     fi
300 300
 
301 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 303
         echo 'DNSPort 53' >> /etc/tor/torrc
304 304
         echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc
305 305
         echo 'AutomapHostsSuffixes .exit,.onion' >> /etc/tor/torrc

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

@@ -139,19 +139,19 @@ function remove_bluetooth {
139 139
     rmmod -f bnep
140 140
     rmmod -f bluetooth
141 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 143
             sed -i 's|BLUETOOTH_ENABLED=.*|BLUETOOTH_ENABLED=0|g' /etc/default/bluetooth
144 144
         else
145 145
             echo "BLUETOOTH_ENABLED=0" >> /etc/default/bluetooth
146 146
         fi
147 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 149
         echo 'blacklist bnep' >> /etc/modprobe.d/bluetooth.conf
150 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 152
         echo 'blacklist btusb' >> /etc/modprobe.d/bluetooth.conf
153 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 155
         echo 'blacklist bluetooth' >> /etc/modprobe.d/bluetooth.conf
156 156
     fi
157 157
     update-initramfs -u -k `uname -r` -v
@@ -430,13 +430,13 @@ function set_shadow_permissions {
430 430
 function set_max_login_tries {
431 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 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 435
     else
436 436
         sed -i "s| deny=.*| deny=$max_tries|g" /etc/pam.d/common-auth
437 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 440
         sed -i '/pam_deny.so/a account required\t\t\tpam_tally.so' /etc/pam.d/common-account
441 441
     else
442 442
         sed -i "s| deny=.*| deny=$max_tries|g" /etc/pam.d/common-account
@@ -445,14 +445,14 @@ function set_max_login_tries {
445 445
 
446 446
 function limit_user_logins {
447 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 449
         echo '* hard maxsyslogins 10' >> /etc/security/limits.conf
450 450
     else
451 451
         sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' /etc/security/limits.conf
452 452
     fi
453 453
 
454 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 456
         echo '* hard maxlogins 2' >> /etc/security/limits.conf
457 457
     else
458 458
         sed -i 's|hard maxlogins.*|hard maxlogins 2|g' /etc/security/limits.conf
@@ -460,7 +460,7 @@ function limit_user_logins {
460 460
 }
461 461
 
462 462
 function remove_serial_logins {
463
-    if grep 'ttyS' /etc/securetty; then
463
+    if grep -q 'ttyS' /etc/securetty; then
464 464
         cp /etc/securetty /etc/securetty_old
465 465
         sed -i '/ttyS/d' /etc/securetty
466 466
     fi
@@ -581,7 +581,7 @@ function lockdown_permissions {
581 581
 }
582 582
 
583 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 585
         echo '* hard core 0' >> /etc/security/limits.conf
586 586
     else
587 587
         sed -i 's|hard core.*|hard core 0|g' /etc/security/limits.conf