20 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
67451248eb
upgrades: Fix premature adding of buster-backports sources
It is incorrect to check for backports availability, FreedomBox systems got
added buster-backports sources prematurely. This will lead to apt update
failures resulting in FreedomBox becoming unable to install new apps.

Fix this by removing old sources and adding new sources only after
performing (this time correct) backports URL check.

Closes: #1496.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 19:36:03 -05:00
Sunil Mohan Adapa
e2f2d337c7
upgrades: Fix priority for buster-backports version
If we release version 50 into testing and version 49 into buster-backports and
assuming version 45 is in stable, then for stable users, version 49 is selected
properly and upgraded due non-availability of 50 for them and high
prioritization of buster-backports over buster/stable. This is as expected.

For the case of testing user, this does not work as expected, however.
buster-backports will be given 800 priority, testing will be given 500
priority (default) and version 49 will be picked instead of the expected 50.

Setting priority to 500 fixes the problem. It will equate the buster-backports
to all other repositories and will let the system pick the highest version
available.

Closes: #1498.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 19:36:00 -05:00
Sunil Mohan Adapa
5a159f7d39
upgrades: Improve handling of backports
- Merge backports functionality into upgrades module.

- No need to enable systemd timer as dh_installsystemd automatically enables
  this during package installation and upgrade.

- Use https:// and deb.debian.org for repository checking. When using Tor for
  package installations request the URL via Tor.

- Make daily checking service more generic for all kind of future apt repository
  updates.

- Force removal of repository file during purge to avoid failures.

- Don't add contrib/non-free as backports is intended to be enabled for just the
  freedombox package and it is free. When the need arises, we can introduce
  contrib/non-free. This also eliminates an issue that adding these components
  doesn't work without the usage of tor.

- Allow generate apt preferences file to avoid lintian complaining about its
  presence. Remove on purge.

- Add unattended upgrades origin pattern to allow it to upgrade from backports
  repositories.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-05 14:58:55 -08:00
Joseph Nuthalapati
37d84c0f50
upgrades: Add functional tests
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-10-29 23:22:05 -04:00
James Valleroy
d37ba6217e
upgrades: Keep config file when disabling
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-09-27 12:42:26 +05:30
James Valleroy
5df13f7147
upgrades: Don't change origins pattern list
unattended-upgrades installs upgrades from ${distro_codename},
label=Debian by default.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-09-27 12:42:11 +05:30
Sunil Mohan Adapa
dea4af17fb
Rename Plinth to FreedomBox in license headers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:09 -05:00
Johannes Keyser
76a63d102b
setup: Disable install/upgrade when dpkg/apt is running
Show a warning message that a package manager is running. This prevents users
from getting an installation error just because another installation/upgrade is
running.

Closes: #625.
2017-04-19 16:50:00 +05:30
Johannes Keyser
634afef1c9
actions: Make subparsers mandatory, fixes calls without arguments
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2017-04-10 11:54:23 +05:30
Sunil Mohan Adapa
7b68dd55f2
upgrades: Run status operations as non-root
Current check whether the package manager is busy and getting the
unattended upgrades log requires root.  This will not allow Plinth to
run as non-root.  Fix this by moving the operations to actions script.
2016-08-16 18:51:37 -04:00
Sunil Mohan Adapa
afb00f98ab
upgrades: Make manual upgrade a background process
- Closes #366 and closes #304 (all sub-tasks).

- Start new process group with setsid() by sending
  start_new_session=True

- Detach from parent process fds by closing all FDs and attaching stdin,
  stdou and stderr to /dev/null.

- Don't wait for the process to complete.

- This allows for upgrading Plinth while upgrades are trigged from
  Plinth itself.

- Show log of upgrade exection instead of output and error log of the
  process which can no longer be collected.  This has the advantage of
  showing automatic executions also.

- Rewrite the mechanism to detect whether upgrades can be run.  It is
  now based on whether the package manager is busy.  This has the
  advantage of working properly if other apt processes are running,
  automatic upgrades are running, etc.

- Busy status works even if Plinth is restarted while upgrades are in
  progress.

- More descriptive messages showing that upgrades don't have to be
  triggered manually.

- Warn that other packages can't be installed while upgrades are
  running, which may take a long time.

- Warn the users of potential temporary unavailability of
  Plinth/Apache2.
2016-01-20 21:13:18 -05:00
Sunil Mohan Adapa
921f7c8767 upgrades: Make sure error output shows up 2015-11-26 11:05:26 +05:30
Sunil Mohan Adapa
1f43be95a0 upgrades: Handle action errors using error codes
- This is more reliable than string parsing in the output.

- We will be using pythonic try/catches instead of if conditions.
2015-02-22 17:48:35 -05:00
Sunil Mohan Adapa
82fbbe1fec upgrades: Handle upgrade interval other than 1 day properly
- We must assume that apart from Plinth there will be user or user-agent
  changes to the configuration files.  In this case the value may be set
  something other than '1' day.
2015-02-22 17:48:35 -05:00
Sunil Mohan Adapa
d33e60c74a upgrades: Minor styling fixes
- Remove emacs mode line as emacs automatically detect Python files
  based on the #! line.

- End comments with a '.'.

- Use single quotes instead of double quotes for string for consistensy.

- Update message to say that it take more than a minute to finish
  upgrades.  Some times it takes a lot more than that.
2015-02-22 17:48:34 -05:00
fonfon
4a19dcc807 Minor improvement of auto-update check
Instead of relying on /etc/apt/apt.conf.d/20auto-upgrades having the
according entries we now verify the auto-upgrade entries via apt-config
2015-01-28 19:50:27 +00:00
James Valleroy
cd057994d3 Include { in Origins-Pattern regex pattern. 2015-01-28 19:50:27 +00:00
James Valleroy
6292b47e54 Use regexs to match more valid configs for unattended-upgrades. 2015-01-28 19:50:27 +00:00
James Valleroy
304e2aea62 Add form for enabling automatic upgrades. 2015-01-28 19:50:26 +00:00
James Valleroy
80eff7fd6e Add upgrades module that can run unattended-upgrades. 2015-01-28 19:50:26 +00:00