Bob Mottram 7 år sedan
förälder
incheckning
bfd2a37f63
1 ändrade filer med 3 tillägg och 3 borttagningar
  1. 3
    3
      src/freedombone-app-tahoelafs

+ 3
- 3
src/freedombone-app-tahoelafs Visa fil

65
     new_username="$1"
65
     new_username="$1"
66
     new_user_password="$2"
66
     new_user_password="$2"
67
     ${PROJECT_NAME}-pass -u $new_username -a tahoelafs -p "$new_user_password"
67
     ${PROJECT_NAME}-pass -u $new_username -a tahoelafs -p "$new_user_password"
68
-    if grep "${new_username}:" /etc/nginx/.htpasswd-tahoelafs; then
68
+    if grep -q "${new_username}:" /etc/nginx/.htpasswd-tahoelafs; then
69
         sed -i '/${new_username}:/d' /etc/nginx/.htpasswd-tahoelafs
69
         sed -i '/${new_username}:/d' /etc/nginx/.htpasswd-tahoelafs
70
     fi
70
     fi
71
     echo "${new_user_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${new_username}
71
     echo "${new_user_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${new_username}
75
 function remove_user_tahoelafs {
75
 function remove_user_tahoelafs {
76
     remove_username="$1"
76
     remove_username="$1"
77
     ${PROJECT_NAME}-pass -u $remove_username --rmapp tahoelafs
77
     ${PROJECT_NAME}-pass -u $remove_username --rmapp tahoelafs
78
-    if grep "${remove_username}:" /etc/nginx/.htpasswd-tahoelafs; then
78
+    if grep -q "${remove_username}:" /etc/nginx/.htpasswd-tahoelafs; then
79
         sed -i '/${remove_username}:/d' /etc/nginx/.htpasswd-tahoelafs
79
         sed -i '/${remove_username}:/d' /etc/nginx/.htpasswd-tahoelafs
80
     fi
80
     fi
81
 }
81
 }
84
     change_username="$1"
84
     change_username="$1"
85
     change_password="$2"
85
     change_password="$2"
86
     ${PROJECT_NAME}-pass -u $change_username -a tahoelafs -p "$change_password"
86
     ${PROJECT_NAME}-pass -u $change_username -a tahoelafs -p "$change_password"
87
-    if grep "${change_username}:" /etc/nginx/.htpasswd-tahoelafs; then
87
+    if grep -q "${change_username}:" /etc/nginx/.htpasswd-tahoelafs; then
88
         sed -i '/tahoe-${change_username}:/d' /etc/nginx/.htpasswd-tahoelafs
88
         sed -i '/tahoe-${change_username}:/d' /etc/nginx/.htpasswd-tahoelafs
89
     fi
89
     fi
90
     echo "${change_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${change_username}
90
     echo "${change_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${change_username}