Commit Graph

222 Commits

Author SHA1 Message Date
Fabian Grünbichler
15254c1755 various clippy fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-07-10 11:58:49 +02:00
Stoiko Ivanov
089314eaa7 pool: remove unused imports
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2024-07-10 11:31:08 +02:00
Stoiko Ivanov
24c697e8cd pool: gc: remove empty directories under link_dir
garbage collection currently is quite aggressive in removing all files
under the link_dir, which are not a hard-link to a checksum file.
removing directories that remain empty below the link_dir should thus
not too dangerous.

without this patch, removing a snapshot on a mirror, running gc there,
and syncing everything to a medium, leaves the medium with an
hierarchy of empty directories below the removed snapshot (the files
get cleaned up the directories remain).

using WalkDir::content_first() seems better than to check for
emptiness after each file-removal [0]

[0] https://docs.rs/walkdir/latest/walkdir/struct.WalkDir.html#method.contents_first

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2024-07-10 11:31:08 +02:00
Stoiko Ivanov
2089e5d4b0 pool: unlink_file: fix check for empty directory
path.is_empty() checks for the empty-path, not an empty directory [0].
as the check that the path is below the link_dir happens anyways in
the if we can directly call std::fs::remove_dir (which is even safer
than the std::fs::remove_dir_all call used in pool::remove_dir()).

the oversight seems to have been in place since the intial commit. I
ran across the issue when removing many snapshots of a Debian Bookworm
repository, syncing this to a medium, and still having a vast amount
of empty directories left behind (as debian has one directory per
package), which in turn increases the sync run-time.

[0] https://docs.rs/nix/latest/nix/trait.NixPath.html#tymethod.is_empty

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2024-07-10 11:31:08 +02:00
Stoiko Ivanov
c92573acd1 pool: drop superfluous check for impossible path combination
commit c598cb154e changed the pool
layout to have the pool directory (.pool for a mirror) on the same
level as the link directory (instead of below), to enable pool-sharing
across multiple mirrors.

the condition will never be true, drop the if statement to avoid
confusion in the future.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2024-07-10 11:31:08 +02:00
Stoiko Ivanov
305b9e1b2b bump proxmox-apt to 0.11 and adapt to changes.
The recent changes to proxmox-apt along with the introduction of the
proxmox_apt_apit_types crate led to the following changes.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2024-07-10 11:15:34 +02:00
Stoiko Ivanov
bd85cf4b59 bump proxmox-time to 2.0
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2024-06-25 10:57:01 +02:00
Fabian Grünbichler
3a1277ec00 move .cargo/config to .cargo/config.toml
the old location has been deprecated for a while, and rustc 1.78 will start to warn about it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-06-20 12:28:13 +02:00
Fabian Grünbichler
a5a6d2aed0 build: force debug symbols in release build
they then get stripped into their own package anyway, but without this we don't
get debug symbols at all with rustc >= 1.77

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-06-20 10:04:20 +02:00
Thomas Lamprecht
b2846c2899 bump version to 0.6.6
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-19 09:02:12 +02:00
Thomas Lamprecht
f1ef7f8c42 update proxmox-apt to 0.10.9
To allow repos that have packages without priority field in the index

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-19 09:01:10 +02:00
Thomas Lamprecht
7428e311da bump version to 0.6.5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-02-21 12:52:19 +01:00
Maximiliano Sandoval
373a3ed3e0 verifier: elide explicit lifetime
Fixes the clippy lint:

```
warning: the following explicit lifetimes could be elided: 'msg
  --> src/helpers/verifier.rs:93:32
   |
93 | pub(crate) fn verify_signature<'msg>(
   |                                ^^^^
94 |     msg: &'msg [u8],
   |           ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
93 ~ pub(crate) fn verify_signature(
94 ~     msg: &[u8],
   |
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-02-21 12:13:33 +01:00
Maximiliano Sandoval
a3fe642062 remove needless borrows
Fixes the clippy lint
```
warning: the borrowed expression implements the required traits
   --> src/medium.rs:143:9
    |
143 |         &statefile(base),
    |         ^^^^^^^^^^^^^^^^ help: change this to: `statefile(base)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-02-21 12:13:30 +01:00
Thomas Lamprecht
5d183d04a6 d/rules: export version related environment variables for docs build
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-02-21 12:08:16 +01:00
Thomas Lamprecht
dd15694845 d/control: udpdate build-dependencies
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-02-21 12:02:44 +01:00
Thomas Lamprecht
550e4ccb05 cargo: update proxmox-schema dependency to 3
We have relatively small usage of the schema here, so no code change
required.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-02-12 17:20:42 +01:00
Thomas Lamprecht
94ce586afa docs: update copyright years
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-01-09 11:18:00 +01:00
Fabian Grünbichler
6c3e71ae89 bump version to 0.6.4
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-01-09 09:34:47 +01:00
Fabian Grünbichler
5a72d9fa0d cleanup: replace duplicate code with call to mirror_dir()
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-01-09 09:24:09 +01:00
Maximiliano Sandoval R
edf3cb2d6e mirror: Use PathBuf instead of strings for paths
Joining the strings might results in a double `//` in a path. This was
experienced in a ticket at our customer support in the following error:

    Error: unable to read
    "/var/lib/proxmox-offline-mirror/mirrors//.pool/sha256/<SOME_HASH>"
    - Input/output error (os error 5) after downloading ±60GB of data.

Suggested-by: Stefan Sterz <s.sterz@proxmox.com>
Signed-off-by: Maximiliano Sandoval R <m.sandoval@proxmox.com>
2024-01-09 09:22:10 +01:00
Fabian Grünbichler
f0ca1f3796 set MSRV to 1.70
needed for std::io::IsTerminal

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-01-09 09:17:05 +01:00
Maximiliano Sandoval R
5f7004f8dd use IsTerminal whenever possible
Continuation of https://lists.proxmox.com/pipermail/pbs-devel/2023-November/007078.html.

Signed-off-by: Maximiliano Sandoval R <m.sandoval@proxmox.com>

FG: adapted context

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-01-09 09:16:22 +01:00
Maximiliano Sandoval
971ec747dc docs: offline-media: Use correct config subcommand
There is no `config medium` subcommand.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-01-09 09:12:19 +01:00
Fabian Grünbichler
8fdb6bc67f build: encode minimum proxmox-subscription version
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-01-09 09:09:35 +01:00
Fabian Grünbichler
4f92306615 weak crypto: fix RSA config option
it accidentally re-used the config flag for DSA, instead of its own. seems like
there aren't too many of these repos around anymore (thankfully).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-01-08 09:41:05 +01:00
Stefan Sterz
077c6bfcc2 docs: add an auto dark mode to the docs
this adds the dark mode from the proxmox backup server to the offline
mirror for a more consistent appearance of the documentation across
all products.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2023-12-20 17:18:25 +01:00
Stefan Sterz
0735f868cf offline mirror binary: rustfmt clean up
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-12-01 16:10:53 +01:00
Stefan Sterz
e8fded3311 helper: improve handling of multiple keys when activating them
this commit fixes a behavior where pom would applied any subscription
key that matched the provided product. it did not check whether the
server id of the activated subscription matched the current system.
this commit fixes that and only allows applying subscriptions for the
current system.

it also adds a couple of ux improvements:

- the `offline-key` sub-command now does not require the `--product`
  parameter anymore. if there are multiple keys with different
  products for the same server we will try to activate them all. the
  assumption is that the user added all keys intentionally (e.g. a
  combo pbs+pve system) and would like to activate them all at once.
  since this only makes the api more permissive this shouldn't be a
  breaking change.
- if the `offline-key` sub-command encounters multiple subscription
  keys with the same product and server id, it only activates the one
  with the due date furthest in the future. this makes sense in a
  scenario where a user simply adds new subscription keys to their
  key medium without removing older ones (perhaps older subscriptions
  haven't even expired just yet).
- the interactive `setup` sub-command now only offers keys that have a
  matching server id. it also orders them in such a way that the top
  most key for a given product has the next due date furthest in the
  future.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-12-01 16:10:53 +01:00
Stefan Sterz
bf022cac40 type: move ProductType enum to proxmox-subscription
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-12-01 16:10:53 +01:00
Thomas Lamprecht
580970b956 bump version to 0.6.3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-25 17:22:54 +01:00
Stefan Sterz
e15fdfdbbf add missing subscription setting for ceph enterprise repos
when setting up a ceph enterprise repo we didn't add a subscription
for it. this commit adds a pve subscription so that pom can properly
authenticate itself when mirroring the ceph enterprise repos.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2023-11-25 17:18:23 +01:00
Stefan Sterz
c8739bcf5e add support for ceph reef
since it's the new default ceph release, add support for setting up
the ceph reef repos in the `setup` command.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2023-11-25 17:18:17 +01:00
Fabian Grünbichler
934e3bd4b7 docs: fix copied env variable documentation
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-11-15 11:32:50 +01:00
Thomas Lamprecht
48199c7138 add docs/ and package outputs to gitignore
and sort while at it

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-12 17:09:07 +02:00
Thomas Lamprecht
f70470c2a9 cargo: update dependencies
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-12 17:01:35 +02:00
Fabian Grünbichler
6bd9717ce0 docs: fix bullseye references
the current version of POM is released for Debian 12 "Bookworm", update the
docs accordingly.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-08-04 11:07:16 +02:00
Stefan Sterz
51b86ea95f add non-free-firmware to bookworm default components
this adds the non-free-firmware component introduced with debian
bookworm [1] to the default components for bookworm mirrors. since
this new component is a subset [2] of the previous "non-free"
component add it here too to keep the same set of packages available.

[1]: https://wiki.debian.org/Firmware#Debian_12_.28bookworm.29_and_later
[2]: https://www.debian.org/releases/bookworm/amd64/release-notes/ch-information.en.html#non-free-split

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-07-19 12:23:42 +02:00
Thomas Lamprecht
30a3a3697a bump version to 0.6.2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-29 15:06:50 +02:00
Thomas Lamprecht
7e2faedbb5 bump proxmox-apt dependency to 0.10.3
to get the component fixup for Debian security repo also for the
bookworm suite

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-29 15:03:00 +02:00
Thomas Lamprecht
72f70df2d7 buildsys: fixup update-dcontrol somewhat
still not really doing the right thing, just want a "update
d/control" helper...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-29 15:02:16 +02:00
Thomas Lamprecht
e0663bd83f d/rules: patch out wrongly linked libraries from ELFs
Adapted from proxmox-backup's 198ebc6c ("d/rules: patch out wrongly
linked libraries from ELFs")

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-29 13:10:07 +02:00
Thomas Lamprecht
6346bb5599 bump version to 0.6.1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-16 09:39:17 +02:00
Stefan Sterz
dc91ad488b add support for bookworm enterprise ceph repo
the bookworm release of proxmox ve comes along with a new ceph
enterprise repo. this commit adds support for this new repo for
bookworm-based releases.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-06-16 09:10:26 +02:00
Stefan Sterz
e213dacedd add bookworm to the list of releases
add support for bookworm based proxmox products and debian
repositories/

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-06-16 09:10:26 +02:00
Thomas Lamprecht
a35f55b942 bump version to 0.6.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-30 13:56:26 +02:00
Thomas Lamprecht
1113d14878 buildsys: derive upload dist automatically
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-30 13:56:15 +02:00
Thomas Lamprecht
1859bd3df0 buildsys: introduce accumulative DEBS variable as convenience
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-30 13:55:19 +02:00
Thomas Lamprecht
59870b7d50 buildsys: use correct DEB_HOST_ARCH
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-30 13:54:43 +02:00
Thomas Lamprecht
8f0abd9c42 buildsys: improve DSC target & add sbuild convenience target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-30 13:52:28 +02:00