Skip to content

Commit

Permalink
Do not overwrite existing data when creating initial directories.
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Mansfield <[email protected]>

Issue 1925
  • Loading branch information
patman-cp authored and patman committed Sep 9, 2023
1 parent 7bd3b7b commit dd242f1
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 0 deletions.
7 changes: 7 additions & 0 deletions 25/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down
7 changes: 7 additions & 0 deletions 25/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down
7 changes: 7 additions & 0 deletions 25/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down
7 changes: 7 additions & 0 deletions 26/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down
7 changes: 7 additions & 0 deletions 26/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down
7 changes: 7 additions & 0 deletions 26/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down
7 changes: 7 additions & 0 deletions 27/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down
7 changes: 7 additions & 0 deletions 27/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down
7 changes: 7 additions & 0 deletions 27/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down
7 changes: 7 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD"
fi

if [ "$installed_version" = "0.0.0.0" ]; then
if [ -n "$(ls -1 -A /var/www/html | grep -v -w "nextcloud-init-sync.lock")" ]; then
echo "New instance and /var/www/html is not empty, refusing to overwrite existing files."
exit 1
fi
fi

rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
Expand Down

0 comments on commit dd242f1

Please sign in to comment.