diff --git a/docker/init.sh b/docker/init.sh index bc324af35fa43a4b3c7efb80a721e9ee06c142a0..aac1584dd59f6cbaea7396b0097b891a08059c19 100755 --- a/docker/init.sh +++ b/docker/init.sh @@ -6,6 +6,7 @@ # # ---------------------------------------------------------------------- # 2021-11-nn <axel.hahn@iml.unibe.ch> +# 2022-07-19 <axel.hahn@iml.unibe.ch> support multiple dirs for setfacl # ====================================================================== cd $( dirname $0 ) @@ -46,20 +47,27 @@ function _setWritepermissions(){ typeset -i local DOCKER_USER_OUTSIDE=$_user_uid+$DOCKER_USER_UID set -vx - # remove current acl - sudo setfacl -bR "${WRITABLEDIR}" - # default permissions: both the host user and the user with UID 33 (www-data on many systems) are owners with rwx perms - sudo setfacl -dRm u:${DOCKER_USER_OUTSIDE}:rwx,${_user}:rwx "${WRITABLEDIR}" + for mywritedir in ${WRITABLEDIR} + do + + echo "--- ${mywritedir}" + # remove current acl + sudo setfacl -bR "${mywritedir}" + + # default permissions: both the host user and the user with UID 33 (www-data on many systems) are owners with rwx perms + sudo setfacl -dRm u:${DOCKER_USER_OUTSIDE}:rwx,${_user}:rwx "${mywritedir}" + + # permissions: make both the host user and the user with UID 33 owner with rwx perms for all existing files/directories + sudo setfacl -Rm u:${DOCKER_USER_OUTSIDE}:rwx,${_user}:rwx "${mywritedir}" + done - # permissions: make both the host user and the user with UID 33 owner with rwx perms for all existing files/directories - sudo setfacl -Rm u:${DOCKER_USER_OUTSIDE}:rwx,${_user}:rwx "${WRITABLEDIR}" set +vx } # cleanup starterkit git data function _removeGitdata(){ - h2 "Remove git data from starterkit" + h2 "Remove git data of starterkit" echo -n "Current git remote url: " git config --get remote.origin.url git config --get remote.origin.url 2>/dev/null | grep $selfgitrepo >/dev/null @@ -275,12 +283,16 @@ while true; do _wait ;; u) - # docker-compose up -d --remove-orphans - docker-compose up -d --remove-orphans - test ! -z "${APP_ONSTARTUP}" && sleep 2 && docker exec -it appmonitor-server /bin/bash -c "${APP_ONSTARTUP}" - echo "In a web browser:" - echo " $frontendurl" + if docker-compose --verbose up -d --remove-orphans; then + # test ! -z "${APP_ONSTARTUP}" && sleep 2 && docker exec -it appmonitor-server /bin/bash -c "${APP_ONSTARTUP}" + echo "In a web browser:" + echo " $frontendurl" + else + echo "ERROR: docker-compose up failed :-/" + docker-compose logs | tail + fi echo + _wait ;; s)