2016-02-09 18:38:38 +03:00
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright ( C ) 2015 Colin Walters < walters @ verbum . org >
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation ; either version 2 of the licence or ( at
* your option ) any later version .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library ; if not , write to the
* Free Software Foundation , Inc . , 59 Temple Place , Suite 330 ,
* Boston , MA 02111 - 1307 , USA .
*/
# pragma once
# include <gio/gio.h>
2016-08-03 21:30:17 +03:00
# include <libdnf/libdnf.h>
2016-02-09 18:38:38 +03:00
# include <ostree.h>
# include "libglnx.h"
2017-02-09 01:38:49 +03:00
# define RPMOSTREE_CORE_CACHEDIR " / var / cache / rpm-ostree / "
2016-02-09 21:13:28 +03:00
# define RPMOSTREE_TYPE_CONTEXT (rpmostree_context_get_type ())
G_DECLARE_FINAL_TYPE ( RpmOstreeContext , rpmostree_context , RPMOSTREE , CONTEXT , GObject )
2016-02-09 18:38:38 +03:00
2016-02-10 11:25:58 +03:00
# define RPMOSTREE_TYPE_TREESPEC (rpmostree_treespec_get_type ())
G_DECLARE_FINAL_TYPE ( RpmOstreeTreespec , rpmostree_treespec , RPMOSTREE , TREESPEC , GObject )
2016-02-09 21:13:28 +03:00
# define RPMOSTREE_TYPE_INSTALL (rpmostree_install_get_type ())
G_DECLARE_FINAL_TYPE ( RpmOstreeInstall , rpmostree_install , RPMOSTREE , INSTALL , GObject )
2016-02-09 18:38:38 +03:00
2016-02-09 21:13:28 +03:00
RpmOstreeContext * rpmostree_context_new_system ( GCancellable * cancellable ,
GError * * error ) ;
2016-02-09 18:38:38 +03:00
2016-06-16 15:52:29 +03:00
RpmOstreeContext * rpmostree_context_new_compose ( int basedir_dfd ,
GCancellable * cancellable ,
GError * * error ) ;
2016-02-09 21:13:28 +03:00
RpmOstreeContext * rpmostree_context_new_unprivileged ( int basedir_dfd ,
GCancellable * cancellable ,
GError * * error ) ;
2016-02-09 18:38:38 +03:00
2016-08-03 21:30:17 +03:00
DnfContext * rpmostree_context_get_hif ( RpmOstreeContext * self ) ;
2016-02-09 18:38:38 +03:00
2016-02-10 11:25:58 +03:00
RpmOstreeTreespec * rpmostree_treespec_new_from_keyfile ( GKeyFile * keyfile , GError * * error ) ;
RpmOstreeTreespec * rpmostree_treespec_new_from_path ( const char * path , GError * * error ) ;
RpmOstreeTreespec * rpmostree_treespec_new ( GVariant * variant ) ;
2016-04-28 15:59:20 +03:00
GHashTable * rpmostree_context_get_varsubsts ( RpmOstreeContext * context ) ;
2016-02-10 11:25:58 +03:00
GVariant * rpmostree_treespec_to_variant ( RpmOstreeTreespec * spec ) ;
const char * rpmostree_treespec_get_ref ( RpmOstreeTreespec * spec ) ;
2016-02-09 18:38:38 +03:00
2016-02-09 21:13:28 +03:00
gboolean rpmostree_context_setup ( RpmOstreeContext * self ,
const char * install_root ,
2016-05-20 21:16:38 +03:00
const char * source_root ,
2016-02-10 11:25:58 +03:00
RpmOstreeTreespec * treespec ,
2016-02-09 18:38:38 +03:00
GCancellable * cancellable ,
2016-02-10 11:25:58 +03:00
GError * * error ) ;
2016-02-09 18:38:38 +03:00
2017-01-04 20:29:01 +03:00
void rpmostree_context_set_is_empty ( RpmOstreeContext * self ) ;
2016-08-29 03:47:56 +03:00
void rpmostree_context_set_repos ( RpmOstreeContext * self ,
OstreeRepo * base_repo ,
OstreeRepo * pkgcache_repo ) ;
2016-05-20 21:16:38 +03:00
void rpmostree_context_set_sepolicy ( RpmOstreeContext * self ,
OstreeSePolicy * sepolicy ) ;
passwd_prepare_rpm_layering: account for local entries
On Fedora 25, systemd adds a sysuser config file for multiple users. It
also explicitly creates those same users in its %pre, except for one:
systemd-coredump. This means that the tree's /usr/lib/passwd doesn't
contain systemd-coredump. Of course, on first boot, it gets created and
added to /etc/passwd.
During package layering, we map /usr/lib/passwd to the container's
/etc/passwd. If the %pre calls useradd/groupadd without passing an
explicit uid/gid, it's possible that the allocated id is already in use
by an entry in the deployment's /etc/{passwd,group} (such as
systemd-coredump, but the same holds for any manually-added entry).
We resolve this by taking the switcheroo a step further: we map
/usr/lib/passwd to /usr/etc/passwd, and then also map /etc/passwd to
/usr/lib/passwd. That way, useradd in %pre will account for already
allocated local uids and react accordingly.
Closes: #561
Approved by: cgwalters
2017-01-06 23:15:20 +03:00
void rpmostree_context_set_passwd_dir ( RpmOstreeContext * self ,
const char * passwd_dir ) ;
2016-06-17 22:14:24 +03:00
void rpmostree_context_set_ignore_scripts ( RpmOstreeContext * self ,
GHashTable * ignore_scripts ) ;
2016-03-14 07:16:37 +03:00
2016-08-04 13:53:34 +03:00
void rpmostree_dnf_add_checksum_goal ( GChecksum * checksum , HyGoal goal ) ;
2016-02-10 11:25:58 +03:00
char * rpmostree_context_get_state_sha512 ( RpmOstreeContext * self ) ;
2016-02-09 18:38:38 +03:00
2016-02-09 21:13:28 +03:00
char * rpmostree_get_cache_branch_header ( Header hdr ) ;
2016-08-03 21:30:17 +03:00
char * rpmostree_get_cache_branch_pkg ( DnfPackage * pkg ) ;
2016-02-09 18:38:38 +03:00
2017-03-03 23:42:00 +03:00
gboolean
rpmostree_pkgcache_find_pkg_header ( OstreeRepo * pkgcache ,
const char * nevra ,
const char * expected_sha256 ,
GVariant * * out_header ,
GCancellable * cancellable ,
GError * * error ) ;
2016-02-09 21:13:28 +03:00
gboolean rpmostree_context_download_metadata ( RpmOstreeContext * context ,
GCancellable * cancellable ,
GError * * error ) ;
2016-02-09 18:38:38 +03:00
/* This API allocates an install context, use with one of the later ones */
2016-02-09 21:13:28 +03:00
gboolean rpmostree_context_prepare_install ( RpmOstreeContext * self ,
2016-02-09 21:23:31 +03:00
RpmOstreeInstall * * out_install ,
GCancellable * cancellable ,
GError * * error ) ;
2016-02-09 21:13:28 +03:00
2016-05-20 21:16:38 +03:00
gboolean rpmostree_context_download ( RpmOstreeContext * self ,
RpmOstreeInstall * install ,
GCancellable * cancellable ,
GError * * error ) ;
gboolean rpmostree_context_import ( RpmOstreeContext * self ,
RpmOstreeInstall * install ,
GCancellable * cancellable ,
GError * * error ) ;
gboolean rpmostree_context_relabel ( RpmOstreeContext * self ,
RpmOstreeInstall * install ,
GCancellable * cancellable ,
GError * * error ) ;
2016-11-15 18:17:03 +03:00
typedef enum {
RPMOSTREE_ASSEMBLE_TYPE_SERVER_BASE ,
RPMOSTREE_ASSEMBLE_TYPE_CLIENT_LAYERING
} RpmOstreeAssembleType ;
2016-05-20 21:16:38 +03:00
/* NB: tmprootfs_dfd is allowed to have pre-existing data */
/* devino_cache can be NULL if no previous cache established */
2017-01-04 20:54:01 +03:00
gboolean rpmostree_context_assemble_tmprootfs ( RpmOstreeContext * self ,
int tmprootfs_dfd ,
OstreeRepoDevInoCache * devino_cache ,
RpmOstreeAssembleType assemble_type ,
gboolean noscripts ,
GCancellable * cancellable ,
GError * * error ) ;
gboolean rpmostree_context_commit_tmprootfs ( RpmOstreeContext * self ,
int tmprootfs_dfd ,
OstreeRepoDevInoCache * devino_cache ,
const char * parent ,
RpmOstreeAssembleType assemble_type ,
char * * out_commit ,
GCancellable * cancellable ,
GError * * error ) ;
/* Wrapper for both of the above */
2016-05-20 21:16:38 +03:00
gboolean rpmostree_context_assemble_commit ( RpmOstreeContext * self ,
int tmprootfs_dfd ,
OstreeRepoDevInoCache * devino_cache ,
const char * parent ,
2016-11-15 18:17:03 +03:00
RpmOstreeAssembleType assemble_type ,
2016-06-10 04:08:51 +03:00
gboolean noscripts ,
2016-05-20 21:16:38 +03:00
char * * out_commit ,
GCancellable * cancellable ,
GError * * error ) ;