forked from debops/ansible-owncloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure fully automated ownCloud security updates by default.
Closes: debops#28 Requires: debops/ansible-unattended_upgrades#6 (Test should pass even without this patch.)
- Loading branch information
Showing
7 changed files
with
155 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,3 @@ | ||
# {{ ansible_managed }} | ||
|
||
DPkg::Post-Invoke {"test -x '{{ owncloud__auto_database_upgrade_hook_script }}' && '{{ owncloud__auto_database_upgrade_hook_script }}' || true";}; |
This file contains 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,34 @@ | ||
#!/bin/bash | ||
# {{ ansible_managed }} | ||
# | ||
# Package manager hook script for auto ownCloud DB upgrades. | ||
# This script is run for each single package being installed or upgraded. | ||
# | ||
# https://unix.stackexchange.com/questions/226993/whats-the-difference-between-dpkgpost-invoke-and-dpkgpost-invoke-success | ||
# https://unix.stackexchange.com/questions/236833/apt-hook-to-check-for-specific-package-changes | ||
|
||
set -e | ||
|
||
## Check if one of the trigger packages was touched by `dpkg`. | ||
## The script might not be executed as `dpkg` hook. | ||
## Unfortunately, checking against `$SUDO_COMMAND` does not work when the upgrade is done by `unattended-upgrades`. | ||
# echo "$SUDO_COMMAND" | egrep -q '\<(:?{{ owncloud__auto_database_upgrade_hook_script_packages_trigger | join("|") }})\>' || exit 0 | ||
|
||
## Check if ownCloud is installed. | ||
test -r '{{ owncloud__deploy_path }}/config/config.php' || exit 0 | ||
grep -q 'installed.*true' '{{ owncloud__deploy_path }}/config/config.php' || exit 0 | ||
|
||
## Performance optimization. Check if ownCloud is in maintenance mode (package upgrades put ownCloud in maintenance mode). | ||
grep -q 'maintenance.*true' '{{ owncloud__deploy_path }}/config/config.php' || exit 0 | ||
|
||
## Check if ownCloud requires an upgrade. | ||
'{{ owncloud__occ_bin_file_path }}' status | egrep -q 'require upgrade' || exit 0 | ||
|
||
## The ownCloud system package puts ownCloud into maintenance mode as of ownCloud 9.0. Ensure it anyway. | ||
'{{ owncloud__occ_bin_file_path }}' maintenance:mode --on | ||
|
||
## Do the upgrade. | ||
'{{ owncloud__occ_bin_file_path }}' upgrade{{ "" if (owncloud__auto_database_upgrade_migration_test | bool) else " --skip-migration-test" }} | ||
|
||
## Turn maintenance mode off. | ||
'{{ owncloud__occ_bin_file_path }}' maintenance:mode --off |