[Rpm-maint] [RFC PATCH 2/2] skip policy installation using --nopolicy option
Steve Lawrence
slawrence at tresys.com
Fri Aug 14 17:27:07 UTC 2009
This patch makes a --nopolicy option available during package
installation. When the option is given, policy installation is skipped.
Also, the --nopolicy option is assumed if SELinux is disabled.
---
lib/poptI.c | 2 ++
lib/rpmts.h | 1 +
lib/transaction.c | 4 ++--
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/poptI.c b/lib/poptI.c
index f460f96..8ead1eb 100644
--- a/lib/poptI.c
+++ b/lib/poptI.c
@@ -205,6 +205,8 @@ struct poptOption rpmInstallPoptTable[] = {
N_("don't verify digest of files (obsolete)"), NULL },
{ "nocontexts", '\0',0, NULL, RPMCLI_POPT_NOCONTEXTS,
N_("don't install file security contexts"), NULL},
+ { "nopolicy", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_NOPOLICY,
+ N_("don't install selinux policy modules"), NULL},
{ "noorder", '\0', POPT_BIT_SET,
&rpmIArgs.installInterfaceFlags, INSTALL_NOORDER,
diff --git a/lib/rpmts.h b/lib/rpmts.h
index 215b28e..cbf11bf 100644
--- a/lib/rpmts.h
+++ b/lib/rpmts.h
@@ -56,6 +56,7 @@ typedef enum rpmtransFlags_e {
RPMTRANS_FLAG_NOPAYLOAD = (1 << 24),
RPMTRANS_FLAG_APPLYONLY = (1 << 25),
+ RPMTRANS_FLAG_NOPOLICY = (1 << 26), /*!< from --nopolicy */
RPMTRANS_FLAG_NOMD5 = (1 << 27), /*!< from --nomd5 */
RPMTRANS_FLAG_NOFILEDIGEST = (1 << 27), /*!< from --nofiledigest (alias to --nomd5) */
RPMTRANS_FLAG_NOSUGGEST = (1 << 28), /*!< from --nosuggest */
diff --git a/lib/transaction.c b/lib/transaction.c
index 172f4de..ac9c3a9 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1038,7 +1038,7 @@ static int rpmtsSetup(rpmts ts, rpmprobFilterFlags ignoreSet)
/* if SELinux isn't enabled or init fails, don't bother... */
if (!rpmtsSELinuxEnabled(ts)) {
- rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_NOCONTEXTS));
+ rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_NOCONTEXTS | RPMTRANS_FLAG_NOPOLICY));
}
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONTEXTS)) {
@@ -1251,7 +1251,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
/* Check package set for problems */
ts->probs = checkProblems(ts);
- if (!((rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_TEST))
+ if (!((rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_NOPOLICY))
|| (rpmpsNumProblems(ts->probs) &&
(okProbs == NULL || rpmpsTrim(ts->probs, okProbs))))) {
if (rpmtsLoadPolicy(ts) != RPMRC_OK) {
--
1.6.0.6
More information about the Rpm-maint
mailing list