Verified Commit 8ad32a5e authored by Karel Koci's avatar Karel Koci 🤘
Browse files

Fix issue where reboot wasn't performed because of replan

The replan correctly passed flag to pkgupdate that reboot has to be
performed but if that run did any changes we unconditionally overwrote
it. This fixes that.

The test verifies that fix is really working by forcing installation and
removal of package while at the same time requesting reboot.
parent f92ac353
Pipeline #82630 passed with stages
in 5 minutes and 7 seconds
......@@ -4,11 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Immediate reboot not being performed when combined with replan that actually
performs some changes in the system
## [69.1.1] - 2021-04-15
### Fixed
- error on transaction recovery created by updater before version 69.0.1 about
`upgraded_packages` being nil
## [69.1.0] - 2021-04-15
### Changed
- Package requests solver no longer tries to maximize number of selected requests
......@@ -29,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- usage of `example.org` replaced with `application-test.turris.cz` in tests
## [69.0.0] - 2020-11-24
### Added
- extra argument `pkg_hash_required` for `Repository` command
......@@ -48,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `ROOT_DIR` not being defined for `hook_postinst` and `hook_reboot_required` on
replan execution.
## [68.0.0] - 2020-11-06
### Added
- Queue messages for 'upgrade' and 'downgrade' now also prints current version in
......@@ -65,22 +74,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Queue messages now state 'upgrade', 'downgrade' and 'reinstall' instead of
original generic 'install'.
## [67.0.3] - 2020-10-21
### Changed
- pkgupdate's conf.lua now loads scripts with Full security level instead of Local
- libupdater is now versioned with release version (there is no API compatibility
between versions)
## [67.0.2] - 2020-08-06
### Fixed
- Warning about cycles for packages providing and at the same time conflicting
with some other package
- Configure script now checks if uthash is available
## [67.0.1.1] - 2020-07-01
### Changed
- Lunit submodule now points to new Github repository
## [67.0.1] - 2020-06-25
### Changed
- Package "reinstall" is now performed not only if `Version` field is different
......
......@@ -203,9 +203,11 @@ int main(int argc, char *argv[]) {
trans_ok = results_interpret(interpreter, result_count);
err = interpreter_call(interpreter, "updater.pre_cleanup", NULL, "");
ASSERT_MSG(!err, "%s", err);
bool reboot_delayed;
ASSERT(interpreter_collect_results(interpreter, "bb", &reboot_delayed, &opts.reboot_finished) == -1);
if (reboot_delayed) {
bool reboot_delayed, reboot_finished;
ASSERT(interpreter_collect_results(interpreter, "bb", &reboot_delayed, &reboot_finished) == -1);
if (reboot_finished)
opts.reboot_finished = opts.reboot_finished || reboot_finished;
else if (reboot_delayed) {
const char *hook_path = aprintf("%s%s", root_dir(), hook_reboot_delayed);
setenv("ROOT_DIR", root_dir(), true);
exec_hook(hook_path, "Executing reboot_required hook");
......
......@@ -21,6 +21,7 @@ TESTS += \
%reldir%/provides-replace.sys_update \
%reldir%/provides.sys_update \
%reldir%/reboot.sys_update \
%reldir%/replan-reboot.sys_update \
%reldir%/reinstall-all.sys_update \
%reldir%/replan-no-effect.sys_update \
%reldir%/replan.sys_update \
......
sed -i -e 's/^Installed-Time: .*/Installed-Time: 0/' "$ROOT_DIR"/usr/lib/opkg/status
rm "$ROOT_DIR"/config
rm -r "$ROOT_DIR"/repo
#!/bin/sh
echo Rebooted >> $ROOT_DIR/rebooted
Repository("test", "file://%ROOT_DIR%/repo")
--[[
With first run this adds request to install package but once it is installed the
request goes away. Updater should do replan and remove package while reboot should
happen anyway.
]]
if not installed["package"] then
Install("package")
Package("package", {replan = "finished", reboot = "finished"})
end
Package: package
Version: 1
License: GPL-2.0
Section: none
Architecture: all
Installed-Size: 0
Filename: package.ipk
MD5Sum: 2bead58a5f2728659f48bc028cb4f0a3
SHA256sum: cb2463d1123472dc041d6c624502080a2cfd0b21e822364a2e282eafa557f66a
Description: Example package
#!/bin/sh
echo Rebooted >> $ROOT_DIR/rebooted
file://$ROOT_DIR/config --batch -R "$ROOT_DIR"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment