Skip to content

Commit

Permalink
menu: create volumes with current user
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ukkopahis committed Apr 29, 2022
1 parent 732889a commit 0f0d599
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ignore data folders for containers
/services/
/volumes/
/backups/
/.tmp/*
__pycache__
Expand Down
2 changes: 2 additions & 0 deletions menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ function do_project_checks() {
[ -f .project_outofdate ] && rm .project_outofdate
echo "Project is up to date" >&2
fi
# volumes shouldn't be owned by root, change it to the current user
[[ $(id -u) != "0" ]] && sudo chown $(id -u):$(id -g) volumes
}

function do_env_checks() {
Expand Down
3 changes: 3 additions & 0 deletions volumes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is needed for the volumes-folder to be created with the correct
# ownership as part of the initial 'git clone'.
*

0 comments on commit 0f0d599

Please sign in to comment.