26 Commits

Author SHA1 Message Date
James Valleroy
49fa9a0599
upgrades: Use n= for unattended-upgrades origin pattern
In the Debian bookworm-backports repository, the Suite has changed to
"stable-backports". The Codename is the more specific "bookworm-backports".

Tests:

- Build a freedombox package for bookworm-backports with a smaller version
  number than the package in bookworm-backports. Install it in bookworm vagrant
  box.

- Run a manual update. freedombox is upgraded to the version in
  bookworm-backports.

Closes: #2368.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2023-07-31 11:02:18 -07:00
Sunil Mohan Adapa
4b5d1d3204
upgrades: Use drop-in config component for /etc files
Tests:

- Config files are all symlinks in /etc/
- Running 'apt update' sends a DBus signal to freedombox service
- unattended-upgrade works
- Many service were restart when unattended-upgrade was run

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-06-05 20:29:59 -04:00
Sunil Mohan Adapa
40eecb6446
*: Move modules-enabled files to /usr/share
- This will leave /etc/{plinth,freedombox} empty by default making service more
robust to run across various environments and situations. See systemd's
explanation for more details.

- Use Debian maintainer scripts remove all the existing files in
/etc/plinth/modules-enabled.

- Read from /usr/share/freedombox/modules-enabled then from
/etc/plinth/modules-enabled and finally from /etc/freedombox/modules-enabled.
Later read ones override previously read files. Any file pointing to /dev/null
will mean the module must be ignored.

Tests:

- Clean up /etc/plinth, /etc/freedombox and
/usr/share/freedombox/modules-enabled. Run service and notice that files are
getting loaded from development folder using a debug message.

- Run setup.py and notice that files get installed in
/usr/share/freedombox/modules-enabled/ and in the next run they get loaded from
there.

- Create a override file in /etc/plinth/modules-enabled/transmission and notice
that overriden file gets priority over the one in
/usr/share/freedombox/modules-enabled.

- Link the file /etc/plinth/modules-enabled/transmission to /dev/null and notice
that is not loaded.

- Create another file in /etc/freedombox/modules-enabled/transmission and notice
that it overrides the previous two files.

- All affected modules are loaded.

- Build a new Debian package and ensure that upgrading 23.8 to new version
removes are all configuration files.

- Build developer documentation and test that Tutorial -> Full Code and Tutorial
-> Skeleton sections have been updated with references to
-.../modules-enabled/... paths.

- Install quassel and notice that certificates were copied to /var/lib/quassel
directory. Change domain to another domain and notice that certificates were
copied again to that directory.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-05-13 07:08:43 -04:00
James Valleroy
cd21c7f247
upgrades: Add augeas lens for Deb822 apt sources
Helps #214.

Tests:

- Augeas lens tests passed using augparse.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Fix issue with not being able write back with lens]
[sunil: Parse single/multi field values based on man page]
[sunil: Allow creating multi field values by adding \n at the end of the value]
[sunil: Add documentation and make ready for upstream submission]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2023-01-27 15:13:34 -08:00
Sunil Mohan Adapa
22a58db896
upgrades: Add documentation link upgrades service file
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-11-05 07:20:13 -04:00
Sunil Mohan Adapa
071d61bcc8
*: Move all systemd service files from /lib to /usr
This is now the preferred location in Debian. See:

https://lintian.debian.org/tags/systemd-service-in-odd-location
https://bugs.debian.org/992465
https://bugs.debian.org/987989
d70caa69c6
https://lists.debian.org/debian-devel/2021/08/msg00275.html

Tests:

- Lintian no longer shows errors:
  E: freedombox: systemd-service-in-odd-location lib/.../calibre-server-freedombox.service

- Comparing the old .deb and newly generated .deb with these changes. All the
systemd files show that they are moved from /lib to /usr/lib/systemd.

- After upgrading the deb from older version to a version these changes,
services installed by the package are available (tested after restart with
wordpress and claibre). Services tweaked by the package have the changed
configuration reflected as shown by systemctl show
{service-name}.service (tested after restart with quassel).

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 22:08:50 -04:00
James Valleroy
2ae60802a9
upgrades: Write dist-upgrade service file in /run
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-01-10 20:43:53 -08:00
James Valleroy
a66520f3ff
upgrades: Don't allow needrestart to restart freedombox-dist-upgrade
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-01-10 20:43:46 -08:00
James Valleroy
8934c22ef3
upgrades: Add service for dist upgrade
Only restart plinth if needed.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-01-10 20:43:40 -08:00
James Valleroy
172ffe106b
upgrades: Update apt cache before manual update
Test:
- Run manual update. `journalctl -u freedombox-manual-upgrade` shows
  that apt cache was updated.

Closes: #1708.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Split the update command into ExecStartPre= with return code ignored]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-07-12 20:39:34 -07:00
James Valleroy
2d1ced84cd
upgrades: Use a custom service for manual update
- Do not enable/start service during package install/upgrade
- Configure needrestart to skip restarting service

Closes: #1638.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Provide proper regex string in needrestart configuration with qr()]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-06-15 13:33:31 -07:00
Sunil Mohan Adapa
6ee60647c9
upgrades: Always schedule a reboot at 02:00 local time
Test:

- Downgrade kernel (linux-image-amd64) to earlier version.
- Reboot into the older kernel.
- Remove the newer kernel package.
- Run FreedomBox in develop mode.
- Run unattended-upgrades --debug to upgrade all packages.
- At the end a message is printed that shutdown is scheduled.
- Check /run/systemd/shutdown/scheduled file and see that microseconds since
  epoch is set to tomorrow 02:00 local time.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 14:28:00 -07:00
James Valleroy
7c38dad03d
upgrades: Enable Automatic-Reboot option of unattended-upgrades
Closes #654.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 14:27:52 -07:00
James Valleroy
0b5c195e17
upgrades: Add needrestart to restart services as needed
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 14:27:28 -07:00
Sunil Mohan Adapa
50186eea6a
upgrades: Use internal scheduler instead of systemd timer
- For setting up backports repositories. Using an internal scheduler is easy to
maintain in the long run.

- Run it more frequently when in developer mode.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-03-20 14:00:04 -04:00
Sunil Mohan Adapa
6179d98a07
upgrades: Don't ship apt backport preferences file
- Don't ship the file preferences file as this is a violation of the Debian
policy. Lintian throws a hard error that can't be overridden. Remove the lintian
override. Remove this file using maintainer scripts when upgrading from all
version below 20.5.

- The preferences file is now renamed to 50freedombox4.pref.

- Instead write the file when the app is getting setup (on each new version).

- Don't run the setup code on daily timer, instead run the code when the app
upgrades. This ensures that as soon as freedombox package is upgraded and run,
the new preferences file is created instead of waiting for the daily timer to
run.

- From now on when the preferences change, we will increment the version number
of the upgrades app. Change the setup() for the app so that it does not
re-enable automatic upgrades every time setup() is run.

Closes: #1673.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-03-20 13:59:58 -04:00
Sunil Mohan Adapa
476b0e966c
matrixsynapse: Handle release of matrix-synapse 1.11
- python3-signedjson >= 1.1.0 is needed by matrix-synapse-1.11.

- Force upgrade to version 1.11 is needed.

Closes: #1791.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>

Reviewed-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
2020-03-17 10:07:20 +00:00
Veiko Aasa
b668e62f6f
upgrades: Clean apt cache every week
Closes #973

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-03-04 20:33:15 -08:00
Sunil Mohan Adapa
365c29ba1a
*: Update remaining misc files to use SPDX license identifier
None of the files are installed into /etc/. They will unconditionally override
older versions of themselves. They are not likely to cause any configuration
file prompts.

Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:40:32 +02:00
James Valleroy
abdcbd3f65
security: Drop PrivateUsers=yes from all service files
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-02-09 18:48:22 -08:00
James Valleroy
ddd1abdb8a
upgrades: Add systemd sandboxing features to repository setup service
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-12-29 17:49:13 -08:00
Veiko Aasa
126f0a793e
matrix-synapse: Update requirement from buster-backports
matrix-synapse >= 1.5 requires python3-typing-extensions >= 3.7.4

Closes #1720

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-11-30 07:55:10 -05:00
Sunil Mohan Adapa
68bc333842
updates: Allow matrix-synapse 1.3 to be installed for buster users
- matrix-synapse 1.2 is already unavailable in buster-backports, testing and
  unstable. It is replaced by matrix-synapse 1.3. Allow matrix-synapse 1.3 to
  become available for Buster users.

- Allow upgrades to all future versions of matrix-synapse from buster-backports.
  Since buster-backports does not have security updates except that provided
  by the maintainer, it is best to let users be on the latest version provided
  by the maintainer in buster-backports.

- We don't pick and choose among the versions uploaded to backports. Once we
  allow a package to upgrade to backports version, we should continue to do that
  without any further restriction. Update descriptions accordingly.

- Simplify updating the apt preferences file by providing a simple configuration
  instead of creating the file on the fly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-25 17:41:58 -04:00
Sunil Mohan Adapa
f3ccc416f0
upgrades: Set apt configuration to allow release info change
Helps #1601.

When release information such as 'Version' and 'Suite' change for a distribution
changes, apt requires an explicit confirmation from the user. apt-get(8)
specifies the reason for this prompt as ensuring that the user is prepared for
the change. On a FreedomBox installation, as the system administration agent of
the user, FreedomBox has to make this decision on whether the user is ready for
the change. FreedomBox works to keep the system up-to-date and manages
configuration changes for packages, data migration etc. Hence, accept all
release information changes without a prompt.

Without this, when a stable release is made, if the user was using that
code-name before the release, then the system stop receiving updates and no new
apps can be installed in FreedomBox. This happened in case of Buster release
although Debian itself had some part in this. See:
https://salsa.debian.org/freedombox-team/plinth/issues/1601

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-11 09:30:08 -04:00
Sunil Mohan Adapa
ff247fa5aa
setup: Move app data files into respective apps
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-03-17 16:20:57 -04:00
Sunil Mohan Adapa
fdcbd46513
setup: Move app enabling files to respective apps
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-03-17 16:20:54 -04:00