-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Rework Updating #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Rework Updating #65
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8f2bc6b
add version comparison
tilosp 055f577
use rsync for upgrade
tilosp 87c6513
run occ upgrade
tilosp ae5b15c
show disabled apps
tilosp fc384e6
split app folder
tilosp 07a1082
disable the updater
tilosp 201d934
more specific downgrade message
tilosp d253cc1
strong permissions
tilosp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?php | ||
| $CONFIG = array ( | ||
| "apps_paths" => array ( | ||
| 0 => array ( | ||
| "path" => OC::$SERVERROOT."/apps", | ||
| "url" => "/apps", | ||
| "writable" => false, | ||
| ), | ||
| 1 => array ( | ||
| "path" => OC::$SERVERROOT."/custom_apps", | ||
| "url" => "/custom_apps", | ||
| "writable" => true, | ||
| ), | ||
| ), | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,45 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| if [ ! -e '/var/www/html/version.php' ]; then | ||
| tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - | ||
| # version_greater A B returns whether A > B | ||
| function version_greater() { | ||
| [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; | ||
| } | ||
|
|
||
| installed_version="0.0.0~unknown" | ||
| if [ -f /var/www/html/version.php ]; then | ||
| installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') | ||
| fi | ||
| image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') | ||
|
|
||
| if version_greater "$installed_version" "$image_version"; then | ||
| echo "Downgrade not supported" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably be more specific. Something like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| exit 1 | ||
| fi | ||
|
|
||
| if version_greater "$image_version" "$installed_version"; then | ||
| if [ "$installed_version" != "0.0.0~unknown" ]; then | ||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before | ||
| fi | ||
|
|
||
| rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ | ||
|
|
||
| if [ ! -d /var/www/html/config ]; then | ||
| cp -arT /usr/src/nextcloud/config /var/www/html/config | ||
| fi | ||
|
|
||
| mkdir -p /var/www/html/custom_apps | ||
|
|
||
| chown -R www-data /var/www/html | ||
|
|
||
| if [ "$installed_version" != "0.0.0~unknown" ]; then | ||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' | ||
|
|
||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after | ||
| echo "The following apps have beed disabled:" | ||
| diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 | ||
| rm -f /tmp/list_before /tmp/list_after | ||
| fi | ||
| fi | ||
|
|
||
| exec "$@" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?php | ||
| $CONFIG = array ( | ||
| "apps_paths" => array ( | ||
| 0 => array ( | ||
| "path" => OC::$SERVERROOT."/apps", | ||
| "url" => "/apps", | ||
| "writable" => false, | ||
| ), | ||
| 1 => array ( | ||
| "path" => OC::$SERVERROOT."/custom_apps", | ||
| "url" => "/custom_apps", | ||
| "writable" => true, | ||
| ), | ||
| ), | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,45 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| if [ ! -e '/var/www/html/version.php' ]; then | ||
| tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - | ||
| # version_greater A B returns whether A > B | ||
| function version_greater() { | ||
| [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; | ||
| } | ||
|
|
||
| installed_version="0.0.0~unknown" | ||
| if [ -f /var/www/html/version.php ]; then | ||
| installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') | ||
| fi | ||
| image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') | ||
|
|
||
| if version_greater "$installed_version" "$image_version"; then | ||
| echo "Downgrade not supported" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if version_greater "$image_version" "$installed_version"; then | ||
| if [ "$installed_version" != "0.0.0~unknown" ]; then | ||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before | ||
| fi | ||
|
|
||
| rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ | ||
|
|
||
| if [ ! -d /var/www/html/config ]; then | ||
| cp -arT /usr/src/nextcloud/config /var/www/html/config | ||
| fi | ||
|
|
||
| mkdir -p /var/www/html/custom_apps | ||
|
|
||
| chown -R www-data /var/www/html | ||
|
|
||
| if [ "$installed_version" != "0.0.0~unknown" ]; then | ||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' | ||
|
|
||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after | ||
| echo "The following apps have beed disabled:" | ||
| diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 | ||
| rm -f /tmp/list_before /tmp/list_after | ||
| fi | ||
| fi | ||
|
|
||
| exec "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?php | ||
| $CONFIG = array ( | ||
| "apps_paths" => array ( | ||
| 0 => array ( | ||
| "path" => OC::$SERVERROOT."/apps", | ||
| "url" => "/apps", | ||
| "writable" => false, | ||
| ), | ||
| 1 => array ( | ||
| "path" => OC::$SERVERROOT."/custom_apps", | ||
| "url" => "/custom_apps", | ||
| "writable" => true, | ||
| ), | ||
| ), | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,45 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| if [ ! -e '/var/www/html/version.php' ]; then | ||
| tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - | ||
| # version_greater A B returns whether A > B | ||
| function version_greater() { | ||
| [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; | ||
| } | ||
|
|
||
| installed_version="0.0.0~unknown" | ||
| if [ -f /var/www/html/version.php ]; then | ||
| installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') | ||
| fi | ||
| image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') | ||
|
|
||
| if version_greater "$installed_version" "$image_version"; then | ||
| echo "Downgrade not supported" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if version_greater "$image_version" "$installed_version"; then | ||
| if [ "$installed_version" != "0.0.0~unknown" ]; then | ||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before | ||
| fi | ||
|
|
||
| rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ | ||
|
|
||
| if [ ! -d /var/www/html/config ]; then | ||
| cp -arT /usr/src/nextcloud/config /var/www/html/config | ||
| fi | ||
|
|
||
| mkdir -p /var/www/html/custom_apps | ||
|
|
||
| chown -R www-data /var/www/html | ||
|
|
||
| if [ "$installed_version" != "0.0.0~unknown" ]; then | ||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' | ||
|
|
||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after | ||
| echo "The following apps have beed disabled:" | ||
| diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 | ||
| rm -f /tmp/list_before /tmp/list_after | ||
| fi | ||
| fi | ||
|
|
||
| exec "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?php | ||
| $CONFIG = array ( | ||
| "apps_paths" => array ( | ||
| 0 => array ( | ||
| "path" => OC::$SERVERROOT."/apps", | ||
| "url" => "/apps", | ||
| "writable" => false, | ||
| ), | ||
| 1 => array ( | ||
| "path" => OC::$SERVERROOT."/custom_apps", | ||
| "url" => "/custom_apps", | ||
| "writable" => true, | ||
| ), | ||
| ), | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,45 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| if [ ! -e '/var/www/html/version.php' ]; then | ||
| tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - | ||
| # version_greater A B returns whether A > B | ||
| function version_greater() { | ||
| [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; | ||
| } | ||
|
|
||
| installed_version="0.0.0~unknown" | ||
| if [ -f /var/www/html/version.php ]; then | ||
| installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') | ||
| fi | ||
| image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') | ||
|
|
||
| if version_greater "$installed_version" "$image_version"; then | ||
| echo "Downgrade not supported" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if version_greater "$image_version" "$installed_version"; then | ||
| if [ "$installed_version" != "0.0.0~unknown" ]; then | ||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before | ||
| fi | ||
|
|
||
| rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ | ||
|
|
||
| if [ ! -d /var/www/html/config ]; then | ||
| cp -arT /usr/src/nextcloud/config /var/www/html/config | ||
| fi | ||
|
|
||
| mkdir -p /var/www/html/custom_apps | ||
|
|
||
| chown -R www-data /var/www/html | ||
|
|
||
| if [ "$installed_version" != "0.0.0~unknown" ]; then | ||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' | ||
|
|
||
| su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after | ||
| echo "The following apps have beed disabled:" | ||
| diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 | ||
| rm -f /tmp/list_before /tmp/list_after | ||
| fi | ||
| fi | ||
|
|
||
| exec "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?php | ||
| $CONFIG = array ( | ||
| "apps_paths" => array ( | ||
| 0 => array ( | ||
| "path" => OC::$SERVERROOT."/apps", | ||
| "url" => "/apps", | ||
| "writable" => false, | ||
| ), | ||
| 1 => array ( | ||
| "path" => OC::$SERVERROOT."/custom_apps", | ||
| "url" => "/custom_apps", | ||
| "writable" => true, | ||
| ), | ||
| ), | ||
| ); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried this on an alpine box, and the busybox sort is complaining about the
-V...I ended up using this:
https://github.com/pierreozoux/docker-alpine/blob/03573c088fc71bc9bd6a6e0b4af262935289621c/builder/scripts/apk-install#L4-L6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's because
sort -Vis a GNU coreutils thing. I really am not a fan of that script you linked, GNU's version checking is much more sophisticated. Are we basing our images onalpine? I feel like we shouldn't because of the other issues that Alpine container images have...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we can install coreutils in alpine too.
https://wiki.alpinelinux.org/wiki/How_to_get_regular_stuff_working
What are the other issues?
I really like alpine, and as free software advocates, I believe it is our mission to make this IT world a better place. Alpine is a lot more ecological, that's it.