Skip to content

Conversation

@vfreex
Copy link
Contributor

@vfreex vfreex commented Jun 28, 2017

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.
@vfreex vfreex force-pushed the fix-subdir-copy branch from f2879bd to 8e8f33e Compare June 28, 2017 06:59
Copy link
Member

@tilosp tilosp left a comment

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:master Jun 28, 2017
@tilosp
Copy link
Member

tilosp commented Jun 28, 2017

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

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
Contributor Author

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 free to 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