Bob Mottram 7 年之前
父節點
當前提交
bfd2a37f63
共有 1 個檔案被更改,包括 3 行新增3 行删除
  1. 3
    3
      src/freedombone-app-tahoelafs

+ 3
- 3
src/freedombone-app-tahoelafs 查看文件

@@ -65,7 +65,7 @@ function add_user_tahoelafs {
65 65
     new_username="$1"
66 66
     new_user_password="$2"
67 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 69
         sed -i '/${new_username}:/d' /etc/nginx/.htpasswd-tahoelafs
70 70
     fi
71 71
     echo "${new_user_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${new_username}
@@ -75,7 +75,7 @@ function add_user_tahoelafs {
75 75
 function remove_user_tahoelafs {
76 76
     remove_username="$1"
77 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 79
         sed -i '/${remove_username}:/d' /etc/nginx/.htpasswd-tahoelafs
80 80
     fi
81 81
 }
@@ -84,7 +84,7 @@ function change_password_tahoelafs {
84 84
     change_username="$1"
85 85
     change_password="$2"
86 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 88
         sed -i '/tahoe-${change_username}:/d' /etc/nginx/.htpasswd-tahoelafs
89 89
     fi
90 90
     echo "${change_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${change_username}