Skip to content

Commit 0f0d599

Browse files
committed
menu: create volumes with current user
Most services won't explicitly create ./volumes-folder, hence Docker will create volumes as owned by root. This will later cause problems for build hooks trying to prepare directories. E.g. adding nextcloud later will fail with: Error running PreBuildHook on 'nextcloud' [Errno 13] Permission denied: './volumes/nextcloud' Creating volumes as part of the initial git-clone will ensure it's owned by the correct user. For existing users, also fix it's owner when the menu is started.
1 parent 732889a commit 0f0d599

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#ignore data folders for containers
22
/services/
3-
/volumes/
43
/backups/
54
/.tmp/*
65
__pycache__

menu.sh

+2
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ function do_project_checks() {
339339
[ -f .project_outofdate ] && rm .project_outofdate
340340
echo "Project is up to date" >&2
341341
fi
342+
# volumes shouldn't be owned by root, change it to the current user
343+
[[ $(id -u) != "0" ]] && sudo chown $(id -u):$(id -g) volumes
342344
}
343345

344346
function do_env_checks() {

volumes/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is needed for the volumes-folder to be created with the correct
2+
# ownership as part of the initial 'git clone'.
3+
*

0 commit comments

Comments
 (0)