From 0f0d5991d3976f10546f06a3436ae229a41c20b3 Mon Sep 17 00:00:00 2001 From: ukkopahis <95980324+ukkopahis@users.noreply.github.com> Date: Fri, 29 Apr 2022 15:32:16 +0300 Subject: [PATCH] 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. --- .gitignore | 1 - menu.sh | 2 ++ volumes/.gitignore | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 volumes/.gitignore diff --git a/.gitignore b/.gitignore index 19fb83c23..31d6599e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ #ignore data folders for containers /services/ -/volumes/ /backups/ /.tmp/* __pycache__ diff --git a/menu.sh b/menu.sh index 55e19ae6f..83757bba3 100755 --- a/menu.sh +++ b/menu.sh @@ -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() { diff --git a/volumes/.gitignore b/volumes/.gitignore new file mode 100644 index 000000000..316d68ad4 --- /dev/null +++ b/volumes/.gitignore @@ -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'. +*