1. 10 Jan, 2023 3 commits
    • Michal Hrusecky's avatar
      Updater version 70.1.0 · bf36f4d7
      Michal Hrusecky authored
      * Provide function `get_turris_serial` returning serial number to be
        used inside Lua
      bf36f4d7
    • Michal Hrusecky's avatar
      Extra check for serial number · 3f87908e
      Michal Hrusecky authored
      Make sure that serial number is a number and divisible by 11 before
      passing it back to lua.
      3f87908e
    • Michal Hrusecky's avatar
      Include a way how to get a serial number · 171b23cf
      Michal Hrusecky authored
      This is a dependency for staged updates. We need to somehow group
      various routers together and gradually add more and more routers to
      every new release. To do that we need a way how to uniquely identify
      them and serial number is here precisely for that. This way we will be
      able to use it in lua scripts and point right batch of routers to the
      right direction.
      171b23cf
  2. 02 Nov, 2022 2 commits
    • Michal Hrusecky's avatar
      Updater version 70.0.2 · a9427c5d
      Michal Hrusecky authored
      * Use escape sequences only on terminal
      * Do not fail when `--state-log` or `--task-log` is provided. Output a warning and
        ignore them instead for a sake of backward compatibility.
      a9427c5d
    • Michal Hrusecky's avatar
      pkgupdate/arguments: Do not fail on obsolete options · 8d9d2a45
      Michal Hrusecky authored
      Do not fail when `--state-log` or `--task-log` is provided. Output a
      warning and ignore them instead for a sake of backward compatibility. We
      encountered that in some conditions, updater might be run the old way
      during migration from TOS 5.0 to TOS 6.0 and this should prevent
      errors and half-installations in such cases.
      8d9d2a45
  3. 26 Oct, 2022 2 commits
    • Michal Hrusecky's avatar
      logging: Use escape sequences only on terminal · 7ccd33da
      Michal Hrusecky authored
      When redirecting the output, do not use the escape sequences. Those are
      nice and useful when running from console, but they clutter the log when
      redirected somewhere else.
      7ccd33da
    • Michal Hrusecky's avatar
      Updater version 70.0.1 · 922d88c2
      Michal Hrusecky authored
      Fixed
      * Invalid keyword in documentation stating that transaction ends with `STOP` but
        it is signaled by keyword `END` instead
      * Using correct hashing function to detect changes to non-configuration files
      922d88c2
  4. 25 Oct, 2022 1 commit
  5. 21 Oct, 2022 1 commit
    • Michal Hrusecky's avatar
      lib/backend: Use correct hasher even for non-config files · cc4e3681
      Michal Hrusecky authored
      We have a nice code that detects the hash used and chooses the
      appropriate hashing function to use when detecting changes in
      configuration. Let's split it to a separate function and use it to
      detect changes in the rest of the package as well.
      cc4e3681
  6. 14 Feb, 2022 1 commit
    • Karel Koci's avatar
      docs/changelog: fix invalid keyword for transaction end · b022f6f5
      Karel Koci authored
      There was a mismatch between documentation and the implementation where
      documentation stated `STOP` as the keyword for transaction end and the
      code instead was using `END`. In the end it doesn't matter which we
      choose and it is easier for use to just tweak the documentation instead
      changing the code now and thus from now on it is `END` and not `STOP`.
      b022f6f5
  7. 27 Jan, 2022 1 commit
    • Karel Koci's avatar
      lib/backend: add some trace outputs · 37960dd9
      Karel Koci authored
      It turns out that calculating hash can be pretty time consuming
      specially if device the package is installed on is too slow. These trace
      messages should give us a hint that updater is not just stuck that it
      only waits for storage to calculate the hash of the files.
      37960dd9
  8. 26 Jan, 2022 3 commits
    • Karel Koci's avatar
      Updater version 70.0.0 · f1e2d963
      Karel Koci authored
      Added
      * Change log that leaves minimal trace of changes updater performed
        stored in system.
      * Support for `FilesSignature` field in packages. On mismatch it trigger
        reinstall.
      * Support for `files-sha256sum` in packages as hash index
      
      Fixed
      * Subprocess call is now terminated way earlier thanks to `SIGCHLD`
        signal handling. This improves update time for any scripts spawning
        "daemon" processes that do not correctly redirect or close standard
        outputs.
      * Reinstall of packages if some fields were formated differently in
        index than in package (updater no longer detects change by simple
        string comparison)
      
      Changed
      * Internal implementation of base64 replaced with base64c library.
      * Utility opkg-create template and input format
      
      Removed
      * `--state-log` argument
      * `--task-log` argument
      f1e2d963
    • Karel Koci's avatar
      lib: fix reinstall when Depends field has different format · 8950d54c
      Karel Koci authored
      This fixed issues that package is reinstalled if Depends field has a
      different formating (spaces) than what is specified in the package. This
      is caused by OPKG formating it automatically.
      The solution here is to parse the dependency and compare parsed tree
      instead. It is not exactly ideal solution as we have to parse
      dependencies possibly multiple times but it is for now the easiest. The
      ideal way would be to have here already parsed form we could compare
      directly.
      8950d54c
    • Karel Koci's avatar
      lib: update for which file we look for hashes · 6ad34e85
      Karel Koci authored
      The hashes of modified files are now stored in file *.files-sha256sum
      instead of *.files-sha256.
      
      It turns out that we also were not reading the *.files-sha256 and thus
      move of modified files actually did not work.
      6ad34e85
  9. 20 Oct, 2021 1 commit
  10. 04 Oct, 2021 7 commits
    • Karel Koci's avatar
      Improve argp detection · 88b22efe
      Karel Koci authored
      88b22efe
    • Karel Koci's avatar
      Replace base64 implementation with base64c library · b557db3f
      Karel Koci authored
      In reality base64c library is based on this code so it is pretty much
      same code just moved to separate library. The reason for the move is
      that we want to use it in other projects as well and having it as
      dedicated library should give us less code to maintain and fix.
      b557db3f
    • Karel Koci's avatar
      Rework build system and test execution · 9f2268a2
      Karel Koci authored
      This updates C tests to run only as one binary.
      
      The important change is that tests are enabled explicitly and thus in
      default disabled. The same now also applies to linters.
      9f2268a2
    • Karel Koci's avatar
      utils/opkg-create: update code and change the template · 8d771dc9
      Karel Koci authored
      This updates code to be better and in general just more sensible bash.
      This also modifies the template by removing control directory. The files
      that can go to control archive are strictly defined thus we can have
      them in top level directory and just cherry pick them.
      8d771dc9
    • Karel Koci's avatar
      gitlab-ci: fix image URLs · fcf786c1
      Karel Koci authored
      fcf786c1
    • Karel Koci's avatar
      Remove log files · 7b2d0e85
      Karel Koci authored and Karel Koci's avatar Karel Koci committed
      The Changelog replaces previous logs that are right now pretty much no
      longer relevant and in case of state log not even used.
      7b2d0e85
    • Karel Koci's avatar
      Add Changelog · 74b24774
      Karel Koci authored
      This is replacement for task log. It is suppose to server as long term
      log that is easy to parse and thus easy to use in scripts.
      
      The primary use for this is in reporting changes done to system by
      updater.
      74b24774
  11. 03 Aug, 2021 1 commit
    • Karel Koci's avatar
      lib/subprocess: use SIGCHLD to detect child termination early · b4baa429
      Karel Koci authored
      The subprocess now handles SIGCHLD for faster subprocess termination. We
      care about the original child and nothild else. If that dies we consider
      it as termination of subprocess and abandon reading from pipes even when
      there could be still process writing to them.
      
      This should prevent from scripts hanging.
      b4baa429
  12. 22 Jun, 2021 1 commit
  13. 16 Jun, 2021 4 commits
    • Karel Koci's avatar
      Merge branch 'v69.1.3' · 1bb45704
      Karel Koci authored
      1bb45704
    • Karel Koci's avatar
      Version 69.1.3 · e84fce9b
      Karel Koci authored
      Changed
      * Error generated from Lua when URI is being finished now includes error
        message from downloader if it was download failure.
      e84fce9b
    • Karel Koci's avatar
      gitlab-ci: allow failure for linters · d1297737
      Karel Koci authored
      Linters in general sometimes do invalid assumptions and try to rather
      report possible issue over ignoring it. This makes them kind of
      unreliable as tests required for success. The failed tests are still
      manifested with alert but it clearly differentiates between just
      possible error and truly hones error detected in tests.
      d1297737
    • Karel Koci's avatar
      lib/uri_lua: append download error message on download fail · 0e9f9b33
      Karel Koci authored
      The download error reported on URI finish was handled by else branch
      that only printed error that download failed. This reaches to downloader
      for error message in case of download fail. This should expand info
      available to users on download fail.
      0e9f9b33
  14. 11 Jun, 2021 1 commit
    • Karel Koci's avatar
      Add FilesSignature support · 7a82e5b3
      Karel Koci authored
      We need this to cover case when files change in package without anything
      other changing. The issue this tries to cover is conflicts between
      packages because two packages provide same file but in reality that is
      only because local version is older than the one in repository. This
      forces reinstall and thus resolved such collision.
      7a82e5b3
  15. 28 May, 2021 2 commits
    • Karel Koci's avatar
      Version 69.1.2 · e6b3e14a
      Karel Koci authored
      Fixed
      - Immediate reboot not being performed when combined with replan that actually
        performs some changes in the system
      e6b3e14a
    • Karel Koci's avatar
      Fix issue where reboot wasn't performed because of replan · 8ad32a5e
      Karel Koci authored
      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.
      8ad32a5e
  16. 15 Apr, 2021 4 commits
    • Karel Koci's avatar
      Version 69.1.1 · f92ac353
      Karel Koci authored
      Fixed
      * error on transaction recovery created by updater before version 69.0.1
        about `upgraded_packages` being nil
      f92ac353
    • Karel Koci's avatar
      src/lib/lua/transaction: fix upgraded_packages packages being nil · 1273a2b7
      Karel Koci authored
      On update the old transaction created by updater version before 69.0.1
      does not contain this field. We should not expect it. In worst case it
      is going to be reported as not upgrade as it was previously.
      1273a2b7
    • Karel Koci's avatar
      Version 69.1.0 · a293ce66
      Karel Koci authored
      Changed
      * Package requests solver no longer tries to maximize number of selected
        requests but rahter follows strictly rules of requests priority
      * `Install` requests with same priority as `Unistall` are resolved first
      * `Install` and `Unistall` requests without condition as resolved before
        requests with condition given they have same priority specified.
      
      Removed
      * Error reported when request to install and unistall same package was
        specified
      a293ce66
    • Karel Koci's avatar
      Change how requests are resolved to have strict order · 815fd35c
      Karel Koci authored
      The original implementation tries to satisfy maximum number of requests
      in given priority level. This has been seen as ideal solution because
      this way most of the user's requests are satisfied.
      This changes this behavior to rather be strictly defined. This means
      that we do not care about number of requests satisfied. We care only
      about priority of request and satisfy them in order.
      
      This also removes error raised when there was Install and Uninstall
      request for same package with same priority. Now Install request is
      simply preferred.
      
      This was required because of conditions. The demonstration of this issue
      can be done on two packages. Let's have package 'a' and 'b'. There are
      three requests of same priority:
      * To install 'a'
      * To unistall 'b'
      * To install 'b' with condition 'a'
      The intuitive resolution is that user clearly wants to install 'a' and
      not to have 'b'. The third request need not apply as there is more
      accurate request to not have 'b'.
      The original implementation tries to solve this by maximizing number of
      satisfied requests. This has three solution, which is on its own pretty
      problematic. The first solution is the intuitive one. Second solution is
      to install 'a' as well as 'b'. But the third solution is to not install
      any package. This is because third request can be satisfied either by
      installing 'b' or by not installing 'a'. All of these solutions are
      equivalent in solvers conditions as they all result in only one of the
      requests to not be satisfied, thus we have no direct way to hint solver
      what to do. What is even worst we even don't know what should be the
      correct solution without defining additional resolution rules.
      
      Using the new algorithm the solution for problematic request combination
      is simply that we order them using our new defined rules, that is also
      the order they are ordered in example. Now we take and resolve one
      request at the time. We can clearly satisfy installation of 'a' and thus
      first request. We can also satisfy not-installation of 'b' and thus
      second request. The third request now can't be satisfied and thus
      resulting in just 'a' installed.
      
      Full order rules are described in documentation. Reasoning for them is
      also hinted but to be complete there are also alternative orders we
      could choose. The reasoning is as follows:
      * We need to resolve critical packages first to make sure that all of
        them can be satisfied (so we would not close some combination by
        regular requests).
      * The user specified priority has to be abided.
      * The requests without condition are preferred as they clearly state
        what should happen. Conditions can have side effect such as forcing
        some specific combination to satisfy given request. This is of course
        highly undesirable as condition should control only if request is
        satisfied not to influence packages specified in condition. Given the
        nature of satisfiability solver this backward injection is just going
        to happen so we instead simply prioritize requests that have no such
        effect.
      * Another major change buried in these changes is that Install and
        Uninstall requests for same package no longer raise error. We prefer
        Install requests as a choice. The removal of error is because it was
        arbitrary anyway. There are simple ways Install and Unistall requests
        can be in direct collision without specifying same package name, such
        example being if package 'a' depends on 'b' and there is request to
        install 'a' and to unistall 'b'.
      * The last resort order is order of definition is scripts. In the effect
        this is not that important. This affects only requests that have same
        priority, same type (install or uninstall) and both have or not have
        condition. Such requests effectively want the same thing so they
        hopefully should not collide that much in their requests.
      815fd35c
  17. 17 Mar, 2021 3 commits
    • Karel Koci's avatar
      Version 69.0.1 · 4c478bf6
      Karel Koci authored
      Fixed
      * environment variable `PKG_UPGRADE` were always set to `1` for package
        `postinst` script no matter if it was package upgrade or not.
      
      Changed
      * usage of `example.org` replaced with `application-test.turris.cz` in
        tests
      4c478bf6
    • Karel Koci's avatar
      tests/system/simple-upgdate: check if scripts are correctly invoked · e44d3280
      Karel Koci authored
      This simply adds these script to dep-package as well as to test-package.
      It is nice test for this as one package is newly installed and another
      is only upgraded.
      e44d3280
    • Karel Koci's avatar
      lib/lua/transaction: fix postinst configure always reporting upgrade · 15b93504
      Karel Koci authored
      The issue here was that control fields in status were updated in
      pkg_move function but same and thus invalid check was used in
      pkg_scripts later on.
      This adds new table with all upgraded packages. This way we check
      original state before it is removed from status and pass this info to
      subsequent pkg_scripts.
      15b93504
  18. 17 Feb, 2021 2 commits
    • Karel Koci's avatar
      tests/lua/postprocess: remove usage of example.org · 839b7f78
      Karel Koci authored
      Web example.org now responds with valid HTML site on any URL thus we
      have to use different web to get 404 response. We use our own server
      that is used in other tests already.
      
      It also turns out that curl changed error messages so instead of
      matching exact error message this just tries to match the known minimum.
      839b7f78
    • Karel Koci's avatar
      gitlab-ci: drop perl file slurp · 57bbfb6b
      Karel Koci authored
      The usage of this was removed in commit
      6e670a7a.
      57bbfb6b