summaryrefslogtreecommitdiff
path: root/src/ostree/ot-remote-builtin-add.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Run clang-formatColin Walters2023-05-021-69/+73
| | | | | This is a one-time tree wide reformatting to ensure consistency going forward.
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-071-3/+1
|
* Add support for "custom remotes"Colin Walters2021-09-081-7/+24
| | | | | | | | | | This will be helpful for the "ostree native container" work in https://github.com/ostreedev/ostree-rs-ext/ Basically in order to reuse GPG/signapi verification, we need to support adding a remote, even though it can't be used via `ostree pull`. (At least, not until we merge ostree-rs-ext into ostree, but even then I think the principle stands)
* Avoid shadowing local variablesavoid-shadowsPhaedrus Leeds2020-09-131-2/+1
| | | | | | This should help with code readability. Fixes https://github.com/ostreedev/ostree/issues/2194
* remote-add: Default to explicit sign-verify backendsColin Walters2020-05-281-8/+19
| | | | | | | | | | | | In https://github.com/ostreedev/ostree/pull/2092/commits/588f42e8c64183dfa1fbaa08cc92c46b691b23c4 we added a way to add keys for sign types when doing a `remote add`, and in https://github.com/ostreedev/ostree/pull/2105 we extended `sign-verify` to support *limiting* to an explicit set. This PR changes the *default* for `remote add` to combine the two - when providing an explicit `--sign-verify=type`, we now limit the accepted types to only those.
* remote-add: Add --sign-verify=KEYTYPE=[inline|file]:PUBKEYREFColin Walters2020-05-091-2/+55
| | | | | | | | | | | | | | Per https://github.com/ostreedev/ostree/issues/2080#issuecomment-623614483 A huge benefit of ed25519 (and ECC in general) is that keys are very short - short enough that it's completely reasonable to inline them into a command line argument. And I think that's a good model; it makes the keys very visible. For example, someone could easily copy-paste a commandline argument from a webpage (secured via TLS) that says to run `ostree remote add --sign-verify=ed25519=inline:KEY`.
* bin/remote-add: added "--no-sign-verify" optionDenis Pynkin2020-03-251-1/+9
| | | | | | | Option "--no-sign-verify" disable the signature verification while adding remote. Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
* gpg: conditionally build GPG-related code for sign/verificationDenis Pynkin2019-08-011-0/+4
| | | | | | | | | | | | Do not build the code related to GPG sign and verification if GPGME support is disabled. Public functions return error 'G_IO_ERROR_NOT_SUPPORTED' in case if gpg-related check is rquested. Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com> Closes: #1889 Approved by: cgwalters
* lib/util: Drop unneeded ot-tool-util.h includesRobert Fairley2019-06-211-1/+0
| | | | | | | | | With `ot-tool-util.h` made visible in `otutil.h` (in be2572bf68090a5e277338d2613d3c7d53b0c9e8), drop previous includes of `ot-tool-util.h` elsewhere. Closes: #1876 Approved by: zonggen
* remote-add: Add --force option to add or replace remoteDan Nicholson2019-02-081-3/+18
| | | | | | | | | This uses the OSTREE_REPO_REMOTE_CHANGE_REPLACE operation to add a remote or replace an existing one. This is roughly the opposite of --if-not-exists and will raise an error if both options are passed. Closes: #1166 Approved by: cgwalters
* Make P2P API public (no longer experimental)Matthew Leeds2018-06-041-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the API that allows P2P operations (e.g. pulling an ostree ref from a LAN or USB source) is hidden behind the configure flag --enable-experimental-api. This commit makes the API public and makes that flag essentially a no-op (leaving it in place in case we want to use it again in the future). The P2P API has been tested over the last several months and proven to work. This means that since we're no longer using the "experimental" feature flag, P2P builds of Flatpak will fail when using versions of OSTree from this commit onwards, until Flatpak is patched in the near future. If you want to build Flatpak < 0.11.8 with P2P enabled and link against OSTree 2018.6, you'll have to patch Flatpak. However, since Flatpak won't yet have a hard dependency on OSTree 2018.6, it needs a new way to determine if the P2P API in OSTree is available, so this commit adds a "p2p" feature flag. This way the feature set is more semantically correct than if we had continued to use the "experimental" feature flag. In addition to making the P2P API public, this commit makes the P2P unit tests run by default, removes the f27-experimental CI instance that's no longer needed, changes a few man pages to reflect the changes, and updates the bash completion script to accept the new commands and options. Closes: #1596 Approved by: cgwalters
* Add SPDX-License-Identifier to source filesMarcus Folkesson2018-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | SPDX License List is a list of (common) open source licenses that can be referred to by a “short identifier”. It has several advantages compared to the common "license header texts" usually found in source files. Some of the advantages: * It is precise; there is no ambiguity due to variations in license header text * It is language neutral * It is easy to machine process * It is concise * It is simple and can be used without much cost in interpreted environments like java Script, etc. * An SPDX license identifier is immutable. * It provides simple guidance for developers who want to make sure the license for their code is respected See http://spdx.org for further reading. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Closes: #1439 Approved by: cgwalters
* ostree: provide command description in a better placeRuixin Bao2017-10-201-1/+1
| | | | | | | | | | | | | | | | | | | This is similar idea as https://github.com/projectatomic/rpm-ostree/pull/916/commits/5c0bf889155573feec108501ce849ac09a0c9567, The duplicated description is now removed, and the description of the command is now displayed beneath the Usage. For example: ostree cat -h will output the following: "Usage: ostree cat [OPTION?] COMMIT PATH... Concatenate contents of files" Closes: #1267 Approved by: cgwalters
* ostree: move flags into command struct, pass down through builtinsRuixin Bao2017-10-201-2/+2
| | | | | | | | | | | | | | | | | | | | This is a similar approach as https://github.com/projectatomic/rpm-ostree/commit/12c34bb2491a07079c911ef26401fee939e5573c. One thing to note is when we parse the admin related functions, we still keep the old admin related flags, and added a new parameter to represent the command struct. This allows us to identify the caller of the function, making it easier for us to possibly deduplicate the subcommand handling in the future. A similar approach is done in rpm-ostree: https://github.com/projectatomic/rpm-ostree/commit/83aeb018c1012c7a43783c09b74ec71bc9c45826 This also makes it easier for us to change the prototype of the function. If we want to add something new in the future, we won't need to touch every prototype. Closes: #1267 Approved by: cgwalters
* tree-wide: Remove Emacs modelinesColin Walters2017-09-211-2/+1
| | | | | | | | | We added a `.dir-locals.el` in commit: 9a77017d87b74c5e2895cdd64ad098018929403f There's no need to have it per-file, with that people might think to add other editors, which is the wrong direction. Closes: #1206 Approved by: jlebon
* ostree: Add naggy comments to help keep options in syncMatthew Barnes2017-08-151-0/+5
| | | | | | | | | | /* ATTENTION: * Please remember to update the bash-completion script (bash/ostree) and * man page (man/ostree-$COMMANDNAME.xml) when changing the option list. */ Closes: #1080 Approved by: cgwalters
* Add a notion of "physical" sysroot, use for remote writingColin Walters2017-07-181-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Note this PR was reverted in <https://github.com/ostreedev/ostree/pull/902>; this version should be better) Using `${sysroot}` to mean the physical storage root: We don't want to write to `${sysroot}/etc/ostree/remotes.d`, since nothing will read it, and really `${sysroot}` should just have `/ostree` (ideally). Today the Anaconda rpmostree code ends up writing there. Fix this by adding a notion of "physical" sysroot. We determine whether the path is physical by checking for `/sysroot`, which exists in deployment roots (and there shouldn't be a `${sysroot}/sysroot`). In order to unit test this, I added a `--sysroot` argument to `remote add`. However, doing this better would require reworking the command line parsing for the `remote` argument to support specifying `--repo` or `--sysroot`, and I didn't quite want to do that yet in this patch. This second iteration of this patch fixes the bug we hit the first time; embarassingly enough I broke `ostree remote list` finding system remotes. The fix is to have `ostree_repo_open()` figure out whether it's the same as `/ostree/repo` for now. Down the line...we might consider having the `ostree remote` command line itself instatiate an `OstreeSysroot` by default, but this maximizes compatibility; we just have to pay a small cost that `ostree` usage outside of that case like `ostree static-delta` in a releng Jenkins job or whatever will do this `stat()` too. Closes: https://github.com/ostreedev/ostree/issues/892 Closes: #1008 Approved by: mbarnes
* remote-add: Add a --collection-id argument to the built-in add commandPhilip Withnall2017-06-261-0/+13
| | | | | | | | | | | This allows newly configured remotes to have their collection ID specified, so that refs from them can be downloaded from peers as well as the upstream collection, using the remote’s configuration. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #924 Approved by: cgwalters
* Revert "Add a notion of "physical" sysroot, use for remote writing"Colin Walters2017-06-021-17/+0
| | | | | | | | | | | | | | | | This reverts commit 1eff3e83436b6129c0dc350dbbda52ba330e3834. There are a few issues with it. It's not a critical thing for now, so let's ugly up the git history and revisit when we have time to debug it and add more tests. Besides the below issue, I noticed that the simple `ostree remote add` now writes to `/ostree/repo/config` because we *aren't* using the `--sysroot` argument. Closes: https://github.com/ostreedev/ostree/issues/901 Closes: #902 Approved by: mike-nguyen
* Add a notion of "physical" sysroot, use for remote writingColin Walters2017-06-011-0/+17
| | | | | | | | | | | | | | | | | | | Using `${sysroot}` to mean the physical storage root: We don't want to write to `${sysroot}/etc/ostree/remotes.d`, since nothing will read it, and really `${sysroot}` should just have `/ostree` (ideally). Today the Anaconda rpmostree code ends up writing there. Fix this by adding a notion of "physical" sysroot. We determine whether the path is physical by checking for `/sysroot`, which exists in deployment roots (and there shouldn't be a `${sysroot}/sysroot`). In order to unit test this, I added a `--sysroot` argument to `remote add`. However, doing this better would require reworking the command line parsing for the `remote` argument to support specifying `--repo` or `--sysroot`, and I didn't quite want to do that yet in this patch. Closes: https://github.com/ostreedev/ostree/issues/892 Closes: #896 Approved by: jlebon
* build: Expose autocleanups unconditionally, start using themColin Walters2017-03-281-1/+1
| | | | | | | | | | | | | | | | | I'd like to do this in rpm-ostree at least. Originally I was looking at porting to `G_DECLARE_FINAL_TYPE` but eh, this is easier for now and won't bump our GLib dependency which might matter for our embedded users. For now I just did a few replacements in the `remote` command line. A full port can come as we do other code cleanups. This will actually break the flatpak build right now, but that's easy to fix. And we concluded in e.g. https://bugs.freedesktop.org/show_bug.cgi?id=95065#c5 it's a bug for downstream projects to do that. Closes: #756 Approved by: jlebon
* tree-wide: Switch to autoptr for GOptionContextColin Walters2016-12-081-3/+1
| | | | | | | | | | We were leaking in a few places that I noticed in an ASAN run. Also, this was one of the last non-autoptr cleanup sections we have in `out:` cleanup sections, making us a lot closer to a potential full-tree rewrite to `return FALSE`. Closes: #624 Approved by: jlebon
* Fix some leaks of floating GVariantsSimon McVittie2016-10-301-1/+4
| | | | | | | | | | | | | ostree_repo_pull_with_options() and ostree_repo_remote_change() don't sink floating GVariant arguments, and doing so now would be an ABI change; so don't rely on them to do so. Leak found with valgrind memcheck. Signed-off-by: Simon McVittie <smcv@debian.org> Closes: #556 Approved by: cgwalters
* tree-wide: Remove unused variables detected by CLangColin Walters2016-10-271-2/+0
| | | | | | | | | | CLang finds these, whereas GCC treats having `__attribute__((cleanup))` as a use. This obsoletes https://github.com/ostreedev/ostree/pull/411 Closes: #548 Approved by: jlebon
* pull: add mirrorlist supportJonathan Lebon2016-08-311-1/+1
| | | | | | | | | | | | | This commit adds mirrorlist support to the fetcher. Users can now prepend url or/and contenturl by mirrorlist= to interpret the link as a mirrorlist. If an object is not found, the fetcher will automatically try the next mirror in the order given in the list (assuming the order returned by the server is significant). Closes: #469 Approved by: cgwalters
* pull code: support contenturl settingJonathan Lebon2016-08-311-0/+10
| | | | | | | | | | | | | | | Allow users to pass a --contenturl during `remote add` and store it in the remote config. Fish out the contenturl setting from the remote config and use it when downloading static deltas and objects (except for commit signatures). The idea here is that items in the trust chain (summary & sigs) can be fetched from a more secure e.g. TLS-pinned location, while objects themselves are fetched from another location. Once mirrorlist support is added, this use-case will become even more advantageous. Closes: #469 Approved by: cgwalters
* ostree: Add --gpg-import to the "remote add" commandMatthew Barnes2015-05-131-0/+29
| | | | Convenience option imports GPG keys for a newly-created remote.
* Use g_autoptr() for GIO object typesMatthew Barnes2015-05-061-1/+1
| | | | | GLib 2.44 supplies all the necessary autocleanup macros for GIO types, and libglnx backports the relevant macros for ostree.
* Juggling libglnx.h includesMatthew Barnes2015-05-061-2/+0
|
* ostree: Split up "remote" subcommandsMatthew Barnes2015-05-011-0/+117
To make room for "remote gpg-import", which will be non-trivial. ot-builtin-remote.c was already a little too crowded anyway. Also while we're at it, port this bit of code away from libgsystem.