Skip to content

Copy config, data, custom_apps, and themes to volume when empty - #115

Merged
tilosp merged 1 commit into
nextcloud:masterfrom
vfreex:fix-subdir-copy
Jun 28, 2017
Merged

Copy config, data, custom_apps, and themes to volume when empty#115
tilosp merged 1 commit into
nextcloud:masterfrom
vfreex:fix-subdir-copy

Conversation

@vfreex

Copy link
Copy Markdown
Contributor

When Nextcloud performs an upgrade or clean installation,
it will check whether /var/www/html/{config,data,custom_apps,themes} exist.
If not, it will copy
/usr/src/nextcloud/{config,data,custom_apps,themes} to /var/www/html.

This leads to a problem: If those subdirectories are existent but
empty, it will not do the copy. This situation is common when you mount
volumes to those subdirectories, like:

version: "2.1"
services:
app:
image: nextcloud:12-apache
volumes:
- nextcloud:/var/www/html:Z
- nextcloud-custom_apps:/var/www/html/custom_apps:Z
- nextcloud-config:/var/www/html/config:Z
- nextcloud-data:/var/www/html/data:Z
- nextcloud-themes:/var/www/html/themes:Z
ports:
- 8080:80/tcp
db:
image: mariadb
volumes:
- db:/var/lib/mysql:Z
environment:
MYSQL_USER: nextcloud
MYSQL_DATABASE: nextcloud
MYSQL_PASSWORD: nextcloud
MYSQL_ROOT_PASSWORD: nextcloud
volumes:
nextcloud:
nextcloud-custom_apps:
nextcloud-config:
nextcloud-data:
nextcloud-themes:
db:

This patch will fix this issue by checking whether those subdirectories
are empty.

When Nextcloud performs an upgrade or clean installation,
it will check whether /var/www/html/{config,data,custom_apps,themes} exist.
If not, it will copy
/usr/src/nextcloud/{config,data,custom_apps,themes} to /var/www/html.
This leads to a problem: If those subdirectories are existent but
empty, it will not do the copy. This situation is common when you mount
volumes to those subdirectories, like:
```
version: "2.1"
services:
app:
image: nextcloud:12-apache
volumes:
- nextcloud:/var/www/html:Z
- nextcloud-custom_apps:/var/www/html/custom_apps:Z
- nextcloud-config:/var/www/html/config:Z
- nextcloud-data:/var/www/html/data:Z
- nextcloud-themes:/var/www/html/themes:Z
ports:
- 8080:80/tcp
db:
image: mariadb
volumes:
- db:/var/lib/mysql:Z
environment:
MYSQL_USER: nextcloud
MYSQL_DATABASE: nextcloud
MYSQL_PASSWORD: nextcloud
MYSQL_ROOT_PASSWORD: nextcloud
volumes:
nextcloud:
nextcloud-custom_apps:
nextcloud-config:
nextcloud-data:
nextcloud-themes:
db:
```
This patch will fix this issue by copying to those subdirectories when they
are empty.

@tilosptilosp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tilosp
tilosp merged commit 16a36a4 into nextcloud:masterJun 28, 2017
@tilosp

Copy link
Copy Markdown
Member

Thanks a lot for your work!

@vfreex
vfreex deleted the fix-subdir-copy branch June 28, 2017 12:20

if [ ! -d /var/www/html/custom_apps ]; then
cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps
cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request breaks this line: if /var/www/html/config exists but /var/www/html/custom_apps doesn't, config/apps.config.php don't get copied

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I'll fix that.

vfreex added a commit to vfreex/nextcloud-docker that referenced this pull request Jun 29, 2017
PR nextcloud#115 breaks the logic that config/apps.config.php is get copied
after custom_apps: nextcloud#115 (comment).
This patch is going to copy that file if it doesn't exist.
vfreex added a commit to vfreex/nextcloud-docker that referenced this pull request Jun 29, 2017
PR nextcloud#115 breaks the logic that config/apps.config.php get copied
after custom_apps: nextcloud#115 (comment).
This patch is going to copy that file if it doesn't exist.
Craeckie pushed a commit to Craeckie/nextcloud-docker-full that referenced this pull request Mar 30, 2022
PR #115 breaks the logic that config/apps.config.php get copied
after custom_apps: nextcloud/docker#115 (comment).
This patch is going to copy that file if it doesn't exist.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@vfreex@tilosp@menghan