New upstream version 2020.5
This commit is contained in:
commit
deefe62fe4
28 files changed
+444
-255
No files matched your search
@@ -16,3 +16,4 @@
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
add_dracutmodules+=" ostree systemd "
|
||||
reproducible=yes
|
||||
@@ -17,6 +17,13 @@
|
||||
Boston, MA 02111-1307, USA.
|
||||
***/
|
||||
|
||||
LIBOSTREE_2020.5 {
|
||||
global:
|
||||
/* Add symbols here, and uncomment the bits in
|
||||
* Makefile-libostree.am to enable this too.
|
||||
*/
|
||||
} LIBOSTREE_2020.4;
|
||||
|
||||
/* Stub section for the stable release *after* this development one; don't
|
||||
* edit this other than to update the year. This is just a copy/paste
|
||||
* source. Replace $LASTSTABLE with the last stable version, and $NEWVERSION
|
||||
|
||||
@@ -318,6 +318,8 @@ ostree_deployment_unlocked_state_to_string (OstreeDeploymentUnlockedState state)
|
||||
return "hotfix";
|
||||
case OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT:
|
||||
return "development";
|
||||
case OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT:
|
||||
return "transient";
|
||||
}
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
@@ -99,7 +99,8 @@ char *ostree_deployment_get_origin_relpath (OstreeDeployment *self);
|
||||
typedef enum {
|
||||
OSTREE_DEPLOYMENT_UNLOCKED_NONE,
|
||||
OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT,
|
||||
OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX
|
||||
OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX,
|
||||
OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT,
|
||||
} OstreeDeploymentUnlockedState;
|
||||
|
||||
_OSTREE_PUBLIC
|
||||
|
||||
@@ -3273,37 +3273,37 @@ initiate_request (OtPullData *pull_data,
|
||||
* Like ostree_repo_pull(), but supports an extensible set of flags.
|
||||
* The following are currently defined:
|
||||
*
|
||||
* * refs (as): Array of string refs
|
||||
* * collection-refs (a(sss)): Array of (collection ID, ref name, checksum) tuples to pull;
|
||||
* * `refs` (`as`): Array of string refs
|
||||
* * `collection-refs` (`a(sss)`): Array of (collection ID, ref name, checksum) tuples to pull;
|
||||
* mutually exclusive with `refs` and `override-commit-ids`. Checksums may be the empty
|
||||
* string to pull the latest commit for that ref
|
||||
* * flags (i): An instance of #OstreeRepoPullFlags
|
||||
* * subdir (s): Pull just this subdirectory
|
||||
* * subdirs (as): Pull just these subdirectories
|
||||
* * override-remote-name (s): If local, add this remote to refspec
|
||||
* * gpg-verify (b): GPG verify commits
|
||||
* * gpg-verify-summary (b): GPG verify summary
|
||||
* * disable-sign-verify (b): Disable signapi verification of commits
|
||||
* * disable-sign-verify-summary (b): Disable signapi verification of the summary
|
||||
* * depth (i): How far in the history to traverse; default is 0, -1 means infinite
|
||||
* * per-object-fsync (b): Perform disk writes more slowly, avoiding a single large I/O sync
|
||||
* * disable-static-deltas (b): Do not use static deltas
|
||||
* * require-static-deltas (b): Require static deltas
|
||||
* * override-commit-ids (as): Array of specific commit IDs to fetch for refs
|
||||
* * timestamp-check (b): Verify commit timestamps are newer than current (when pulling via ref); Since: 2017.11
|
||||
* * timestamp-check-from-rev (s): Verify that all fetched commit timestamps are newer than timestamp of given rev; Since: 2020.4
|
||||
* * metadata-size-restriction (t): Restrict metadata objects to a maximum number of bytes; 0 to disable. Since: 2018.9
|
||||
* * dry-run (b): Only print information on what will be downloaded (requires static deltas)
|
||||
* * override-url (s): Fetch objects from this URL if remote specifies no metalink in options
|
||||
* * inherit-transaction (b): Don't initiate, finish or abort a transaction, useful to do multiple pulls in one transaction.
|
||||
* * http-headers (a(ss)): Additional headers to add to all HTTP requests
|
||||
* * update-frequency (u): Frequency to call the async progress callback in milliseconds, if any; only values higher than 0 are valid
|
||||
* * localcache-repos (as): File paths for local repos to use as caches when doing remote fetches
|
||||
* * append-user-agent (s): Additional string to append to the user agent
|
||||
* * n-network-retries (u): Number of times to retry each download on receiving
|
||||
* * `flags` (`i`): An instance of #OstreeRepoPullFlags
|
||||
* * `subdir` (`s`): Pull just this subdirectory
|
||||
* * `subdirs` (`as`): Pull just these subdirectories
|
||||
* * `override-remote-name` (`s`): If local, add this remote to refspec
|
||||
* * `gpg-verify` (`b`): GPG verify commits
|
||||
* * `gpg-verify-summary` (`b`): GPG verify summary
|
||||
* * `disable-sign-verify` (`b`): Disable signapi verification of commits
|
||||
* * `disable-sign-verify-summary` (`b`): Disable signapi verification of the summary
|
||||
* * `depth` (`i`): How far in the history to traverse; default is 0, -1 means infinite
|
||||
* * `per-object-fsync` (`b`): Perform disk writes more slowly, avoiding a single large I/O sync
|
||||
* * `disable-static-deltas` (`b`): Do not use static deltas
|
||||
* * `require-static-deltas` (`b`): Require static deltas
|
||||
* * `override-commit-ids` (`as`): Array of specific commit IDs to fetch for refs
|
||||
* * `timestamp-check` (`b`): Verify commit timestamps are newer than current (when pulling via ref); Since: 2017.11
|
||||
* * `timestamp-check-from-rev` (`s`): Verify that all fetched commit timestamps are newer than timestamp of given rev; Since: 2020.4
|
||||
* * `metadata-size-restriction` (`t`): Restrict metadata objects to a maximum number of bytes; 0 to disable. Since: 2018.9
|
||||
* * `dry-run` (`b`): Only print information on what will be downloaded (requires static deltas)
|
||||
* * `override-url` (`s`): Fetch objects from this URL if remote specifies no metalink in options
|
||||
* * `inherit-transaction` (`b`): Don't initiate, finish or abort a transaction, useful to do multiple pulls in one transaction.
|
||||
* * `http-headers` (`a(ss)`): Additional headers to add to all HTTP requests
|
||||
* * `update-frequency` (`u`): Frequency to call the async progress callback in milliseconds, if any; only values higher than 0 are valid
|
||||
* * `localcache-repos` (`as`): File paths for local repos to use as caches when doing remote fetches
|
||||
* * `append-user-agent` (`s`): Additional string to append to the user agent
|
||||
* * `n-network-retries` (`u`): Number of times to retry each download on receiving
|
||||
* a transient network error, such as a socket timeout; default is 5, 0
|
||||
* means return errors without retrying. Since: 2018.6
|
||||
* * ref-keyring-map (a(sss)): Array of (collection ID, ref name, keyring
|
||||
* * `ref-keyring-map` (`a(sss)`): Array of (collection ID, ref name, keyring
|
||||
* remote name) tuples specifying which remote's keyring should be used when
|
||||
* doing GPG verification of each collection-ref. This is useful to prevent a
|
||||
* remote from serving malicious updates to refs which did not originate from
|
||||
@@ -3311,6 +3311,14 @@ initiate_request (OtPullData *pull_data,
|
||||
* not being pulled will be ignored and any ref without a keyring remote
|
||||
* will be verified with the keyring of the remote being pulled from.
|
||||
* Since: 2019.2
|
||||
* * `summary-bytes` (`ay'): Contents of the `summary` file to use. If this is
|
||||
* specified, `summary-sig-bytes` must also be specified. This is
|
||||
* useful if doing multiple pull operations in a transaction, using
|
||||
* ostree_repo_remote_fetch_summary_with_options() beforehand to download
|
||||
* the `summary` and `summary.sig` once for the entire transaction. If not
|
||||
* specified, the `summary` will be downloaded from the remote. Since: 2020.5
|
||||
* * `summary-sig-bytes` (`ay`): Contents of the `summary.sig` file. If this
|
||||
* is specified, `summary-bytes` must also be specified. Since: 2020.5
|
||||
*/
|
||||
gboolean
|
||||
ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
@@ -3356,6 +3364,8 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
int i;
|
||||
g_autofree char **opt_localcache_repos = NULL;
|
||||
g_autoptr(GVariantIter) ref_keyring_map_iter = NULL;
|
||||
g_autoptr(GVariant) summary_bytes_v = NULL;
|
||||
g_autoptr(GVariant) summary_sig_bytes_v = NULL;
|
||||
/* If refs or collection-refs has exactly one value, this will point to that
|
||||
* value, otherwise NULL. Used for logging.
|
||||
*/
|
||||
@@ -3402,6 +3412,8 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
g_variant_lookup (options, "n-network-retries", "u", &pull_data->n_network_retries);
|
||||
opt_ref_keyring_map_set =
|
||||
g_variant_lookup (options, "ref-keyring-map", "a(sss)", &ref_keyring_map_iter);
|
||||
(void) g_variant_lookup (options, "summary-bytes", "@ay", &summary_bytes_v);
|
||||
(void) g_variant_lookup (options, "summary-sig-bytes", "@ay", &summary_sig_bytes_v);
|
||||
|
||||
if (pull_data->remote_refspec_name != NULL)
|
||||
pull_data->remote_name = g_strdup (pull_data->remote_refspec_name);
|
||||
@@ -3439,6 +3451,10 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
*/
|
||||
g_return_val_if_fail (!pull_data->dry_run || pull_data->require_static_deltas, FALSE);
|
||||
|
||||
/* summary-bytes and summary-sig-bytes must both be specified, or neither be
|
||||
* specified, so we know they’re consistent */
|
||||
g_return_val_if_fail ((summary_bytes_v == NULL) == (summary_sig_bytes_v == NULL), FALSE);
|
||||
|
||||
pull_data->is_mirror = (flags & OSTREE_REPO_PULL_FLAGS_MIRROR) > 0;
|
||||
pull_data->is_commit_only = (flags & OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY) > 0;
|
||||
/* See our processing of OSTREE_REPO_PULL_FLAGS_UNTRUSTED below */
|
||||
@@ -3651,6 +3667,10 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
if (!metalink_uri)
|
||||
goto out;
|
||||
|
||||
/* FIXME: Use summary_bytes_v/summary_sig_bytes_v to avoid unnecessary
|
||||
* re-downloads here. Would require additional support for caching the
|
||||
* metalink file or mirror list. */
|
||||
|
||||
metalink = _ostree_metalink_new (pull_data->fetcher, "summary",
|
||||
OSTREE_MAX_METADATA_SIZE, metalink_uri,
|
||||
pull_data->n_network_retries);
|
||||
@@ -3841,7 +3861,25 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
g_autoptr(GVariant) additional_metadata = NULL;
|
||||
gboolean summary_from_cache = FALSE;
|
||||
|
||||
if (!pull_data->summary_data_sig)
|
||||
if (summary_sig_bytes_v)
|
||||
{
|
||||
/* Must both be specified */
|
||||
g_assert (summary_bytes_v);
|
||||
|
||||
bytes_sig = g_variant_get_data_as_bytes (summary_sig_bytes_v);
|
||||
bytes_summary = g_variant_get_data_as_bytes (summary_bytes_v);
|
||||
|
||||
if (!bytes_sig || !bytes_summary)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"summary-bytes or summary-sig-bytes set to invalid value");
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_debug ("Loaded %s summary from options", remote_name_or_baseurl);
|
||||
}
|
||||
|
||||
if (!bytes_sig)
|
||||
{
|
||||
if (!_ostree_fetcher_mirrored_request_to_membuf (pull_data->fetcher,
|
||||
pull_data->meta_mirrorlist,
|
||||
@@ -3854,6 +3892,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
}
|
||||
|
||||
if (bytes_sig &&
|
||||
!bytes_summary &&
|
||||
!pull_data->remote_repo_local &&
|
||||
!_ostree_repo_load_cache_summary_if_same_sig (self,
|
||||
remote_name_or_baseurl,
|
||||
@@ -3863,7 +3902,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
if (bytes_summary)
|
||||
if (bytes_summary && !summary_bytes_v)
|
||||
{
|
||||
g_debug ("Loaded %s summary from cache", remote_name_or_baseurl);
|
||||
summary_from_cache = TRUE;
|
||||
|
||||
@@ -295,9 +295,9 @@ cleanup_old_deployments (OstreeSysroot *self,
|
||||
|
||||
/* Load all active deployments referenced by bootloader configuration. */
|
||||
g_autoptr(GHashTable) active_deployment_dirs =
|
||||
g_hash_table_new_full (g_str_hash, (GEqualFunc)g_str_equal, g_free, NULL);
|
||||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
g_autoptr(GHashTable) active_boot_checksums =
|
||||
g_hash_table_new_full (g_str_hash, (GEqualFunc)g_str_equal, g_free, NULL);
|
||||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
for (guint i = 0; i < self->deployments->len; i++)
|
||||
{
|
||||
OstreeDeployment *deployment = self->deployments->pdata[i];
|
||||
|
||||
@@ -111,7 +111,6 @@ install_into_boot (OstreeRepo *repo,
|
||||
const char *src_subpath,
|
||||
int dest_dfd,
|
||||
const char *dest_subpath,
|
||||
OstreeSysrootDebugFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
@@ -1798,7 +1797,6 @@ install_deployment_kernel (OstreeSysroot *sysroot,
|
||||
{
|
||||
if (!install_into_boot (repo, sepolicy, kernel_layout->boot_dfd, kernel_layout->kernel_srcpath,
|
||||
bootcsum_dfd, kernel_layout->kernel_namever,
|
||||
sysroot->debug_flags,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1815,7 +1813,6 @@ install_deployment_kernel (OstreeSysroot *sysroot,
|
||||
{
|
||||
if (!install_into_boot (repo, sepolicy, kernel_layout->boot_dfd, kernel_layout->initramfs_srcpath,
|
||||
bootcsum_dfd, kernel_layout->initramfs_namever,
|
||||
sysroot->debug_flags,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1832,7 +1829,6 @@ install_deployment_kernel (OstreeSysroot *sysroot,
|
||||
{
|
||||
if (!install_into_boot (repo, sepolicy, kernel_layout->boot_dfd, kernel_layout->devicetree_srcpath,
|
||||
bootcsum_dfd, kernel_layout->devicetree_namever,
|
||||
sysroot->debug_flags,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1853,7 +1849,6 @@ install_deployment_kernel (OstreeSysroot *sysroot,
|
||||
{
|
||||
if (!install_into_boot (repo, sepolicy, kernel_layout->boot_dfd, kernel_layout->kernel_hmac_srcpath,
|
||||
bootcsum_dfd, kernel_layout->kernel_hmac_namever,
|
||||
sysroot->debug_flags,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1935,8 +1930,9 @@ install_deployment_kernel (OstreeSysroot *sysroot,
|
||||
|
||||
if (kernel_layout->initramfs_namever)
|
||||
{
|
||||
g_autofree char * boot_relpath = g_strconcat ("/", bootcsumdir, "/", kernel_layout->initramfs_namever, NULL);
|
||||
ostree_bootconfig_parser_set (bootconfig, "initrd", boot_relpath);
|
||||
g_autofree char * initrd_boot_relpath =
|
||||
g_strconcat ("/", bootcsumdir, "/", kernel_layout->initramfs_namever, NULL);
|
||||
ostree_bootconfig_parser_set (bootconfig, "initrd", initrd_boot_relpath);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2698,10 +2694,8 @@ sysroot_initialize_deployment (OstreeSysroot *self,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
g_autofree char *new_bootcsum = NULL;
|
||||
g_autoptr(OstreeDeployment) new_deployment =
|
||||
ostree_deployment_new (0, osname, revision, new_deployserial,
|
||||
new_bootcsum, -1);
|
||||
ostree_deployment_new (0, osname, revision, new_deployserial, NULL, -1);
|
||||
ostree_deployment_set_origin (new_deployment, origin);
|
||||
|
||||
/* Check out the userspace tree onto the filesystem */
|
||||
@@ -2770,7 +2764,6 @@ get_var_dfd (OstreeSysroot *self,
|
||||
static gboolean
|
||||
sysroot_finalize_deployment (OstreeSysroot *self,
|
||||
OstreeDeployment *deployment,
|
||||
char **override_kernel_argv,
|
||||
OstreeDeployment *merge_deployment,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
@@ -2780,15 +2773,18 @@ sysroot_finalize_deployment (OstreeSysroot *self,
|
||||
if (!glnx_opendirat (self->sysroot_fd, deployment_path, TRUE, &deployment_dfd, error))
|
||||
return FALSE;
|
||||
|
||||
/* Only use the merge if we didn't get an override */
|
||||
if (!override_kernel_argv && merge_deployment)
|
||||
OstreeBootconfigParser *bootconfig = ostree_deployment_get_bootconfig (deployment);
|
||||
|
||||
/* If the kargs weren't set yet, then just pick it up from the merge deployment. In the
|
||||
* deploy path, overrides are set as part of sysroot_initialize_deployment(). In the
|
||||
* finalize-staged path, they're set by OstreeSysroot when reading the staged GVariant. */
|
||||
if (merge_deployment && ostree_bootconfig_parser_get (bootconfig, "options") == NULL)
|
||||
{
|
||||
/* Override the bootloader arguments */
|
||||
OstreeBootconfigParser *merge_bootconfig = ostree_deployment_get_bootconfig (merge_deployment);
|
||||
if (merge_bootconfig)
|
||||
{
|
||||
const char *opts = ostree_bootconfig_parser_get (merge_bootconfig, "options");
|
||||
ostree_bootconfig_parser_set (ostree_deployment_get_bootconfig (deployment), "options", opts);
|
||||
const char *kargs = ostree_bootconfig_parser_get (merge_bootconfig, "options");
|
||||
ostree_bootconfig_parser_set (bootconfig, "options", kargs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2860,8 +2856,8 @@ sysroot_finalize_deployment (OstreeSysroot *self,
|
||||
* Check out deployment tree with revision @revision, performing a 3
|
||||
* way merge with @provided_merge_deployment for configuration.
|
||||
*
|
||||
* While this API is not deprecated, you most likely want to use the
|
||||
* ostree_sysroot_stage_tree() API.
|
||||
* When booted into the sysroot, you should use the
|
||||
* ostree_sysroot_stage_tree() API instead.
|
||||
*/
|
||||
gboolean
|
||||
ostree_sysroot_deploy_tree (OstreeSysroot *self,
|
||||
@@ -2882,8 +2878,7 @@ ostree_sysroot_deploy_tree (OstreeSysroot *self,
|
||||
&deployment, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!sysroot_finalize_deployment (self, deployment, override_kernel_argv,
|
||||
provided_merge_deployment,
|
||||
if (!sysroot_finalize_deployment (self, deployment, provided_merge_deployment,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
@@ -3149,8 +3144,6 @@ _ostree_sysroot_finalize_staged (OstreeSysroot *self,
|
||||
ostree_deployment_get_csum (merge_deployment_stub),
|
||||
ostree_deployment_get_deployserial (merge_deployment_stub));
|
||||
}
|
||||
g_autofree char **kargs = NULL;
|
||||
g_variant_lookup (self->staged_deployment_data, "kargs", "^a&s", &kargs);
|
||||
|
||||
/* Unlink the staged state now; if we're interrupted in the middle,
|
||||
* we don't want e.g. deal with the partially written /etc merge.
|
||||
@@ -3158,7 +3151,7 @@ _ostree_sysroot_finalize_staged (OstreeSysroot *self,
|
||||
if (!glnx_unlinkat (AT_FDCWD, _OSTREE_SYSROOT_RUNSTATE_STAGED, 0, error))
|
||||
return FALSE;
|
||||
|
||||
if (!sysroot_finalize_deployment (self, self->staged_deployment, kargs, merge_deployment,
|
||||
if (!sysroot_finalize_deployment (self, self->staged_deployment, merge_deployment,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ struct OstreeSysroot {
|
||||
#define _OSTREE_SYSROOT_RUNSTATE_STAGED_LOCKED "/run/ostree/staged-deployment-locked"
|
||||
#define _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_DIR "/run/ostree/deployment-state/"
|
||||
#define _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_DEVELOPMENT "unlocked-development"
|
||||
#define _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_TRANSIENT "unlocked-transient"
|
||||
|
||||
gboolean
|
||||
_ostree_sysroot_ensure_writable (OstreeSysroot *self,
|
||||
|
||||
@@ -747,9 +747,13 @@ parse_deployment (OstreeSysroot *self,
|
||||
ret_deployment->unlocked = OSTREE_DEPLOYMENT_UNLOCKED_NONE;
|
||||
g_autofree char *unlocked_development_path =
|
||||
_ostree_sysroot_get_runstate_path (ret_deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_DEVELOPMENT);
|
||||
g_autofree char *unlocked_transient_path =
|
||||
_ostree_sysroot_get_runstate_path (ret_deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_TRANSIENT);
|
||||
struct stat stbuf;
|
||||
if (lstat (unlocked_development_path, &stbuf) == 0)
|
||||
ret_deployment->unlocked = OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT;
|
||||
else if (lstat (unlocked_transient_path, &stbuf) == 0)
|
||||
ret_deployment->unlocked = OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT;
|
||||
else
|
||||
{
|
||||
GKeyFile *origin = ostree_deployment_get_origin (ret_deployment);
|
||||
@@ -1932,6 +1936,8 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
|
||||
|
||||
const char *ovl_options = NULL;
|
||||
static const char hotfix_ovl_options[] = "lowerdir=usr,upperdir=.usr-ovl-upper,workdir=.usr-ovl-work";
|
||||
g_autofree char *unlock_ovldir = NULL;
|
||||
|
||||
switch (unlocked_state)
|
||||
{
|
||||
case OSTREE_DEPLOYMENT_UNLOCKED_NONE:
|
||||
@@ -1951,11 +1957,12 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
|
||||
}
|
||||
break;
|
||||
case OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT:
|
||||
case OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT:
|
||||
{
|
||||
unlock_ovldir = g_strdup ("/var/tmp/ostree-unlock-ovl.XXXXXX");
|
||||
/* We're just doing transient development/hacking? Okay,
|
||||
* stick the overlayfs bits in /var/tmp.
|
||||
*/
|
||||
char *development_ovldir = strdupa ("/var/tmp/ostree-unlock-ovl.XXXXXX");
|
||||
const char *development_ovl_upper;
|
||||
const char *development_ovl_work;
|
||||
|
||||
@@ -1966,14 +1973,14 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
|
||||
"/usr", usr_mode, error))
|
||||
return FALSE;
|
||||
|
||||
if (g_mkdtemp_full (development_ovldir, 0755) == NULL)
|
||||
if (g_mkdtemp_full (unlock_ovldir, 0755) == NULL)
|
||||
return glnx_throw_errno_prefix (error, "mkdtemp");
|
||||
}
|
||||
|
||||
development_ovl_upper = glnx_strjoina (development_ovldir, "/upper");
|
||||
development_ovl_upper = glnx_strjoina (unlock_ovldir, "/upper");
|
||||
if (!mkdir_unmasked (AT_FDCWD, development_ovl_upper, usr_mode, cancellable, error))
|
||||
return FALSE;
|
||||
development_ovl_work = glnx_strjoina (development_ovldir, "/work");
|
||||
development_ovl_work = glnx_strjoina (unlock_ovldir, "/work");
|
||||
if (!mkdir_unmasked (AT_FDCWD, development_ovl_work, usr_mode, cancellable, error))
|
||||
return FALSE;
|
||||
ovl_options = glnx_strjoina ("lowerdir=usr,upperdir=", development_ovl_upper,
|
||||
@@ -1996,6 +2003,9 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
|
||||
return glnx_throw_errno_prefix (error, "fork");
|
||||
else if (mount_child == 0)
|
||||
{
|
||||
int mountflags = 0;
|
||||
if (unlocked_state == OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT)
|
||||
mountflags |= MS_RDONLY;
|
||||
/* Child process. Do NOT use any GLib API here; it's not generally fork() safe.
|
||||
*
|
||||
* TODO: report errors across a pipe (or use the journal?) rather than
|
||||
@@ -2003,7 +2013,7 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
|
||||
*/
|
||||
if (fchdir (deployment_dfd) < 0)
|
||||
err (1, "fchdir");
|
||||
if (mount ("overlay", "/usr", "overlay", 0, ovl_options) < 0)
|
||||
if (mount ("overlay", "/usr", "overlay", mountflags, ovl_options) < 0)
|
||||
err (1, "mount");
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
@@ -2036,15 +2046,19 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
|
||||
return FALSE;
|
||||
break;
|
||||
case OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT:
|
||||
case OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT:
|
||||
{
|
||||
g_autofree char *devpath =
|
||||
_ostree_sysroot_get_runstate_path (deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_DEVELOPMENT);
|
||||
unlocked_state == OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT ?
|
||||
_ostree_sysroot_get_runstate_path (deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_DEVELOPMENT)
|
||||
:
|
||||
_ostree_sysroot_get_runstate_path (deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_TRANSIENT);
|
||||
g_autofree char *devpath_parent = dirname (g_strdup (devpath));
|
||||
|
||||
if (!glnx_shutil_mkdir_p_at (AT_FDCWD, devpath_parent, 0755, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!g_file_set_contents (devpath, "", 0, error))
|
||||
if (!g_file_set_contents (devpath, unlock_ovldir, -1, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_RELEASE_VERSION (4)
|
||||
#define OSTREE_RELEASE_VERSION (5)
|
||||
|
||||
/**
|
||||
* OSTREE_VERSION
|
||||
@@ -52,7 +52,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_VERSION (2020.4)
|
||||
#define OSTREE_VERSION (2020.5)
|
||||
|
||||
/**
|
||||
* OSTREE_VERSION_S:
|
||||
@@ -62,7 +62,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_VERSION_S "2020.4"
|
||||
#define OSTREE_VERSION_S "2020.5"
|
||||
|
||||
#define OSTREE_ENCODE_VERSION(year,release) \
|
||||
((year) << 16 | (release))
|
||||
|
||||
@@ -44,7 +44,7 @@ gboolean
|
||||
ot_admin_builtin_switch (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context =
|
||||
g_option_context_new ("REF");
|
||||
g_option_context_new ("REFSPEC");
|
||||
g_autoptr(OstreeSysroot) sysroot = NULL;
|
||||
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
|
||||
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
|
||||
@@ -53,7 +53,7 @@ ot_admin_builtin_switch (int argc, char **argv, OstreeCommandInvocation *invocat
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
ot_util_usage_error (context, "REF must be specified", error);
|
||||
ot_util_usage_error (context, "REFSPEC must be specified", error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,11 @@
|
||||
#include <err.h>
|
||||
|
||||
static gboolean opt_hotfix;
|
||||
static gboolean opt_transient;
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{ "hotfix", 0, 0, G_OPTION_ARG_NONE, &opt_hotfix, "Retain changes across reboots", NULL },
|
||||
{ "transient", 0, 0, G_OPTION_ARG_NONE, &opt_transient, "Mount overlayfs read-only by default", NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -67,7 +69,17 @@ ot_admin_builtin_unlock (int argc, char **argv, OstreeCommandInvocation *invocat
|
||||
goto out;
|
||||
}
|
||||
|
||||
target_state = opt_hotfix ? OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX : OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT;
|
||||
if (opt_hotfix && opt_transient)
|
||||
{
|
||||
glnx_throw (error, "Cannot specify both --hotfix and --transient");
|
||||
goto out;
|
||||
}
|
||||
else if (opt_hotfix)
|
||||
target_state = OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX;
|
||||
else if (opt_transient)
|
||||
target_state = OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT;
|
||||
else
|
||||
target_state = OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT;
|
||||
|
||||
if (!ostree_sysroot_deployment_unlock (sysroot, booted_deployment,
|
||||
target_state, cancellable, error))
|
||||
@@ -87,6 +99,10 @@ ot_admin_builtin_unlock (int argc, char **argv, OstreeCommandInvocation *invocat
|
||||
g_print ("Development mode enabled. A writable overlayfs is now mounted on /usr.\n"
|
||||
"All changes there will be discarded on reboot.\n");
|
||||
break;
|
||||
case OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT:
|
||||
g_print ("A writable overlayfs is prepared for /usr, but is mounted read-only by default.\n"
|
||||
"All changes there will be discarded on reboot.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
@@ -65,7 +65,7 @@ static OstreeCommand admin_subcommands[] = {
|
||||
"List deployments" },
|
||||
{ "switch", OSTREE_BUILTIN_FLAG_NO_REPO,
|
||||
ot_admin_builtin_switch,
|
||||
"Construct new tree from REF and deploy it" },
|
||||
"Construct new tree from REFSPEC and deploy it" },
|
||||
{ "undeploy", OSTREE_BUILTIN_FLAG_NO_REPO,
|
||||
ot_admin_builtin_undeploy,
|
||||
"Delete deployment INDEX" },
|
||||
|
||||
@@ -94,7 +94,7 @@ parse_fsync_cb (const char *option_name,
|
||||
*/
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{ "parent", 0, 0, G_OPTION_ARG_STRING, &opt_parent, "Parent ref, or \"none\"", "REF" },
|
||||
{ "parent", 0, 0, G_OPTION_ARG_STRING, &opt_parent, "Parent commit checksum, or \"none\"", "COMMIT" },
|
||||
{ "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, "One line subject", "SUBJECT" },
|
||||
{ "body", 'm', 0, G_OPTION_ARG_STRING, &opt_body, "Full description", "BODY" },
|
||||
{ "body-file", 'F', 0, G_OPTION_ARG_FILENAME, &opt_body_file, "Commit message from FILE path", "FILE" },
|
||||
@@ -103,7 +103,7 @@ static GOptionEntry options[] = {
|
||||
{ "orphan", 0, 0, G_OPTION_ARG_NONE, &opt_orphan, "Create a commit without writing a ref", NULL },
|
||||
{ "no-bindings", 0, 0, G_OPTION_ARG_NONE, &opt_no_bindings, "Do not write any ref bindings", NULL },
|
||||
{ "bind-ref", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_bind_refs, "Add a ref to ref binding commit metadata", "BRANCH" },
|
||||
{ "base", 0, 0, G_OPTION_ARG_STRING, &opt_base, "Start from the given commit as a base (no modifiers apply)", "REF" },
|
||||
{ "base", 0, 0, G_OPTION_ARG_STRING, &opt_base, "Start from the given commit as a base (no modifiers apply)", "REV" },
|
||||
{ "tree", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_trees, "Overlay the given argument as a tree", "dir=PATH or tar=TARFILE or ref=COMMIT" },
|
||||
{ "add-metadata-string", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_strings, "Add a key/value pair to metadata", "KEY=VALUE" },
|
||||
{ "add-metadata", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_variants, "Add a key/value pair to metadata, where the KEY is a string, an VALUE is g_variant_parse() formatted", "KEY=VALUE" },
|
||||
|
||||
@@ -95,7 +95,7 @@ ostree_builtin_log (int argc,
|
||||
g_autofree char *checksum = NULL;
|
||||
OstreeDumpFlags flags = OSTREE_DUMP_NONE;
|
||||
|
||||
context = g_option_context_new ("REF");
|
||||
context = g_option_context_new ("REV");
|
||||
|
||||
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
|
||||
goto out;
|
||||
@@ -105,7 +105,7 @@ ostree_builtin_log (int argc,
|
||||
|
||||
if (argc <= 1)
|
||||
{
|
||||
ot_util_usage_error (context, "A ref argument is required", error);
|
||||
ot_util_usage_error (context, "A rev argument is required", error);
|
||||
goto out;
|
||||
}
|
||||
rev = argv[1];
|
||||
|
||||
@@ -114,6 +114,7 @@ dump_commit (GVariant *variant,
|
||||
const gchar *subject;
|
||||
const gchar *body;
|
||||
guint64 timestamp;
|
||||
g_autofree char *parent = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *version = NULL;
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
@@ -129,6 +130,12 @@ dump_commit (GVariant *variant,
|
||||
g_assert (local_error); /* Pacify static analysis */
|
||||
errx (1, "Failed to read commit: %s", local_error->message);
|
||||
}
|
||||
|
||||
if ((parent = ostree_commit_get_parent(variant)))
|
||||
{
|
||||
g_print ("Parent: %s\n", parent);
|
||||
}
|
||||
|
||||
g_autofree char *contents = ostree_commit_get_content_checksum (variant) ?: "<invalid commit>";
|
||||
g_print ("ContentChecksum: %s\n", contents);
|
||||
g_print ("Date: %s\n", str);
|
||||
|
||||
@@ -106,11 +106,11 @@ main(int argc, char *argv[])
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* Handle remounting /sysroot read-only now */
|
||||
if (unlink (_OSTREE_SYSROOT_READONLY_STAMP) == 0)
|
||||
{
|
||||
do_remount ("/sysroot", false);
|
||||
}
|
||||
/* Handle remounting /sysroot; if it's explicitly marked as read-only (opt in)
|
||||
* then ensure it's readonly, otherwise mount writable, the same as /
|
||||
*/
|
||||
bool sysroot_configured_readonly = unlink (_OSTREE_SYSROOT_READONLY_STAMP) == 0;
|
||||
do_remount ("/sysroot", !sysroot_configured_readonly);
|
||||
|
||||
/* If /var was created as as an OSTree default bind mount (instead of being a separate filesystem)
|
||||
* then remounting the root mount read-only also remounted it.
|
||||
|
||||
Reference in new issue
Block a user