@@ -318,10 +318,12 @@ if [[ -n $mname ]]; then
318318 fi
319319 done
320320 echo
321- # Start the environment. Bitnami image will automatically bootstrap install. Wait to finish.
321+ # Start the environment, automatically bootstrapping install. Wait to finish.
322322 branchver=" $branchver " " $scr_dir /mdl-start.sh" " $mname " -q
323323 moodle_svc=$( container_tool ps --filter " label=com.docker.compose.project=$mname " --format ' {{.Names}}' | grep moodle)
324324 src_vol_name=$( container_tool volume ls -q --filter " label=com.docker.compose.project=$mname " | grep src)
325+ src_path=$( container_tool inspect " $moodle_svc " | jq -r ' .[] .Mounts[] | select(.Name != null and (.Name | contains("src"))) | .Destination' )
326+ data_path=$( container_tool inspect " $moodle_svc " | jq -r ' .[] .Mounts[] | select(.Name != null and (.Name | contains("data"))) | .Destination' )
325327 # Do git install once standard install completes.
326328 function git_cmd() {
327329 container_tool run --rm -t --name " $mname -git-$( uuidgen) " -v " $src_vol_name " :/git " $MDL_GIT_IMAGE " -c safe.directory=/git " $@ "
@@ -359,7 +361,7 @@ if [[ -n $mname ]]; then
359361 }
360362 !skip { print }
361363 '
362- config_file=/bitnami/moodle /config.php
364+ config_file=$src_path /config.php
363365 revised_config_file=$( mktemp)
364366 container_tool exec -it " $moodle_svc " awk " $awk_cmd " " $config_file " > " $revised_config_file "
365367 container_tool cp " $revised_config_file " " $moodle_svc " :" $config_file "
@@ -382,13 +384,13 @@ if [[ -n $mname ]]; then
382384 " $scr_dir /mdl-cli.sh" " $mname " upgrade --non-interactive
383385 # After upgrades, we need to fix permissions.
384386 # Ref: https://docs.moodle.org/4x/sv/Security_recommendations#Running_Moodle_on_a_dedicated_server
385- container_tool exec -it " ${moodle_svc} " bash -c '
386- chown -R daemon:daemon /bitnami/moodle /bitnami/moodledata
387- find /bitnami/moodle -type d -print0 | xargs -0 chmod 755
388- find /bitnami/moodle -type f -print0 | xargs -0 chmod 644
389- find /bitnami/moodledata -type d -print0 | xargs -0 chmod 700
390- find /bitnami/moodledata -type f -print0 | xargs -0 chmod 600
391- '
387+ container_tool exec -it " ${moodle_svc} " bash -c "
388+ chown -R daemon:daemon ' $src_path ' ' $data_path '
389+ find ' $src_path ' -type d -print0 | xargs -0 chmod 755
390+ find ' $src_path ' -type f -print0 | xargs -0 chmod 644
391+ find ' $data_path ' -type d -print0 | xargs -0 chmod 700
392+ find ' $data_path ' -type f -print0 | xargs -0 chmod 600
393+ "
392394 fi
393395 echo 🎉 Done!
394396 else
0 commit comments