@@ -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
@@ -255,18 +266,44 @@ function canonical_port() {
255
266
echo " $PORT "
256
267
}
257
268
269
+ function has_acl() {
270
+ local FILESYSTEM=' '
271
+ FILESYSTEM=" $( get_filesystem_for_work_directory) "
272
+ case " $FILESYSTEM " in
273
+ fuse.osx)
274
+ return 1
275
+ ;;
276
+ * )
277
+ return 0
278
+ ;;
279
+ esac
280
+ }
281
+
282
+ function permission_mode() {
283
+ if [ " $IS_CHOWN_FORBIDDEN " == " true" ]; then
284
+ echo " chmod"
285
+ elif has_acl; then
286
+ echo " facl"
287
+ else
288
+ echo " stickybit"
289
+ fi
290
+ }
291
+
258
292
function set_path_permissions() {
259
293
local -r READABLE_USERS=($1 )
260
294
local -r WRITEABLE_USERS=($2 )
261
295
local -r PATHS=(" ${@: 3} " )
262
296
263
297
case " $PERMISSION_MODE " in
264
298
facl)
265
- setfacl -R $( printf -- ' -m user:%s:rwX ' " ${WRITEABLE_USERS[@]} " ) \
266
- $( printf -- ' -m default:user:%s:rwX ' " ${WRITEABLE_USERS[@]} " ) \
267
- $( printf -- ' -m user:%s:rX ' " ${READABLE_USERS[@]} " ) \
268
- $( printf -- ' -m default:user:%s:rX ' " ${READABLE_USERS[@]} " ) \
269
- " ${PATHS[@]} "
299
+ PERMISSIONS=()
300
+ for user in " ${WRITEABLE_USERS[@]} " ; do
301
+ PERMISSIONS+=(-m " $( printf -- ' user:%s:rwX' " $user " ) " -m " $( printf -- ' default:user:%s:rwX' " $user " ) " )
302
+ done
303
+ for user in " ${READABLE_USERS[@]} " ; do
304
+ PERMISSIONS+=(-m " $( printf -- ' user:%s:rX' " $user " ) " -m " $( printf -- ' default:user:%s:rX' " $user " ) " )
305
+ done
306
+ setfacl -R ${PERMISSIONS[@]} " ${PATHS[@]} "
270
307
chmod -R ug+rw,o-rwx " ${PATHS[@]} "
271
308
;;
272
309
stickybit)
@@ -346,17 +383,3 @@ function do_list_functions() {
346
383
function do_shell() {
347
384
bash " $@ "
348
385
}
349
-
350
- function has_acl() {
351
- return 0
352
- }
353
-
354
- function permission_mode() {
355
- if [ " $IS_CHOWN_FORBIDDEN " == " true" ]; then
356
- echo " chmod"
357
- elif has_acl; then
358
- echo " facl"
359
- else
360
- echo " stickybit"
361
- fi
362
- }
0 commit comments