@@ -136,19 +136,30 @@ is_hem_project() {
136
136
return " $? "
137
137
}
138
138
139
+ get_filesystem_for_work_directory () (
140
+ set +e
141
+ grep " $WORK_DIRECTORY " /proc/mounts | awk ' { print $3 }'
142
+ )
143
+
139
144
is_app_mountpoint () {
140
- grep -q -E " /app (nfs|vboxsf|fuse\\ .osxfs)" /proc/mounts
145
+ local FILESYSTEM=' '
146
+ FILESYSTEM=" $( get_filesystem_for_work_directory) "
147
+ echo " $FILESYSTEM " | grep -q -E " (nfs|vboxsf|fuse\\ .osxfs)"
141
148
return " $? "
142
149
}
143
150
144
151
is_chown_forbidden () {
145
152
# Determine if the app directory is an NFS mountpoint, which doesn't allow chowning.
146
- grep -q -E " /app (nfs|vboxsf)" /proc/mounts
153
+ local FILESYSTEM=' '
154
+ FILESYSTEM=" $( get_filesystem_for_work_directory) "
155
+ echo " $FILESYSTEM " | grep -q -E " (nfs|vboxsf)"
147
156
return " $? "
148
157
}
149
158
150
159
is_vboxsf_mountpoint () {
151
- grep -q " /app vboxsf" /proc/mounts
160
+ local FILESYSTEM=' '
161
+ FILESYSTEM=" $( get_filesystem_for_work_directory) "
162
+ echo " $FILESYSTEM " | grep -q " vboxsf"
152
163
return " $? "
153
164
}
154
165
@@ -237,18 +248,44 @@ function canonical_port() {
237
248
echo " $PORT "
238
249
}
239
250
251
+ function has_acl() {
252
+ local FILESYSTEM=' '
253
+ FILESYSTEM=" $( get_filesystem_for_work_directory) "
254
+ case " $FILESYSTEM " in
255
+ fuse.osx)
256
+ return 1
257
+ ;;
258
+ * )
259
+ return 0
260
+ ;;
261
+ esac
262
+ }
263
+
264
+ function permission_mode() {
265
+ if [ " $IS_CHOWN_FORBIDDEN " == " true" ]; then
266
+ echo " chmod"
267
+ elif has_acl; then
268
+ echo " facl"
269
+ else
270
+ echo " stickybit"
271
+ fi
272
+ }
273
+
240
274
function set_path_permissions() {
241
275
local -r READABLE_USERS=($1 )
242
276
local -r WRITEABLE_USERS=($2 )
243
277
local -r PATHS=(" ${@: 3} " )
244
278
245
279
case " $PERMISSION_MODE " in
246
280
facl)
247
- setfacl -R $( printf -- ' -m user:%s:rwX ' " ${WRITEABLE_USERS[@]} " ) \
248
- $( printf -- ' -m default:user:%s:rwX ' " ${WRITEABLE_USERS[@]} " ) \
249
- $( printf -- ' -m user:%s:rX ' " ${READABLE_USERS[@]} " ) \
250
- $( printf -- ' -m default:user:%s:rX ' " ${READABLE_USERS[@]} " ) \
251
- " ${PATHS[@]} "
281
+ PERMISSIONS=()
282
+ for user in " ${WRITEABLE_USERS[@]} " ; do
283
+ PERMISSIONS+=(-m " $( printf -- ' user:%s:rwX' " $user " ) " -m " $( printf -- ' default:user:%s:rwX' " $user " ) " )
284
+ done
285
+ for user in " ${READABLE_USERS[@]} " ; do
286
+ PERMISSIONS+=(-m " $( printf -- ' user:%s:rX' " $user " ) " -m " $( printf -- ' default:user:%s:rX' " $user " ) " )
287
+ done
288
+ setfacl -R ${PERMISSIONS[@]} " ${PATHS[@]} "
252
289
chmod -R ug+rw,o-rwx " ${PATHS[@]} "
253
290
;;
254
291
stickybit)
@@ -328,17 +365,3 @@ function do_list_functions() {
328
365
function do_shell() {
329
366
bash " $@ "
330
367
}
331
-
332
- function has_acl() {
333
- return 0
334
- }
335
-
336
- function permission_mode() {
337
- if [ " $IS_CHOWN_FORBIDDEN " == " true" ]; then
338
- echo " chmod"
339
- elif has_acl; then
340
- echo " facl"
341
- else
342
- echo " stickybit"
343
- fi
344
- }
0 commit comments