3 * Popt tables for install modes.
8 #include <rpm/rpmcli.h>
12 struct rpmInstallArguments_s rpmIArgs = {
15 0, /* installInterfaceFlags */
16 0, /* numRelocations */
19 NULL, /* relocations */
23 #define POPT_RELOCATE -1021
24 #define POPT_EXCLUDEPATH -1022
27 static void argerror(const char * desc)
29 fprintf(stderr, _("%s: %s\n"), xgetprogname(), desc);
35 static void installArgCallback( poptContext con,
36 enum poptCallbackReason reason,
37 const struct poptOption * opt, const char * arg,
40 struct rpmInstallArguments_s * ia = &rpmIArgs;
42 /* XXX avoid accidental collisions with POPT_BIT_SET for flags */
47 ia->installInterfaceFlags |= INSTALL_INSTALL;
50 case POPT_EXCLUDEPATH:
51 if (arg == NULL || *arg != '/')
52 argerror(_("exclude paths must begin with a /"));
53 ia->relocations = xrealloc(ia->relocations,
54 sizeof(*ia->relocations) * (ia->numRelocations + 1));
55 ia->relocations[ia->numRelocations].oldPath = xstrdup(arg);
56 ia->relocations[ia->numRelocations].newPath = NULL;
60 { char * oldPath = NULL;
61 char * newPath = NULL;
63 if (arg == NULL || *arg != '/')
64 argerror(_("relocations must begin with a /"));
65 oldPath = xstrdup(arg);
66 if (!(newPath = strchr(oldPath, '=')))
67 argerror(_("relocations must contain a ="));
70 argerror(_("relocations must have a / following the ="));
71 ia->relocations = xrealloc(ia->relocations,
72 sizeof(*ia->relocations) * (ia->numRelocations + 1));
73 ia->relocations[ia->numRelocations].oldPath = oldPath;
74 ia->relocations[ia->numRelocations].newPath = newPath;
78 case RPMCLI_POPT_NODEPS:
82 case RPMCLI_POPT_NOFILEDIGEST:
83 ia->transFlags |= RPMTRANS_FLAG_NOFILEDIGEST;
86 case RPMCLI_POPT_NOCONTEXTS:
87 ia->transFlags |= RPMTRANS_FLAG_NOCONTEXTS;
90 case RPMCLI_POPT_NOCAPS:
91 ia->transFlags |= RPMTRANS_FLAG_NOCAPS;
94 case RPMCLI_POPT_FORCE:
96 ( RPMPROB_FILTER_REPLACEPKG
97 | RPMPROB_FILTER_REPLACEOLDFILES
98 | RPMPROB_FILTER_REPLACENEWFILES
99 | RPMPROB_FILTER_OLDPACKAGE );
102 case RPMCLI_POPT_NOSCRIPTS:
103 ia->transFlags |= (_noTransScripts | _noTransTriggers);
111 struct poptOption rpmInstallPoptTable[] = {
113 { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
114 installArgCallback, 0, NULL, NULL },
116 { "allfiles", '\0', POPT_BIT_SET,
117 &rpmIArgs.transFlags, RPMTRANS_FLAG_ALLFILES,
118 N_("install all files, even configurations which might otherwise be skipped"),
120 { "allmatches", '\0', POPT_BIT_SET,
121 &rpmIArgs.installInterfaceFlags, UNINSTALL_ALLMATCHES,
122 N_("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"),
125 { "badreloc", '\0', POPT_BIT_SET,
126 &rpmIArgs.probFilter, RPMPROB_FILTER_FORCERELOCATE,
127 N_("relocate files in non-relocatable package"), NULL},
129 { "deploops", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
130 &rpmIArgs.transFlags, RPMTRANS_FLAG_DEPLOOPS,
131 N_("print dependency loops as warning"), NULL},
133 { "erase", 'e', POPT_BIT_SET,
134 &rpmIArgs.installInterfaceFlags, INSTALL_ERASE,
135 N_("erase (uninstall) package"), N_("<package>+") },
136 { "excludeconfigs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
137 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOCONFIGS,
138 N_("do not install configuration files"), NULL},
139 { "excludedocs", '\0', POPT_BIT_SET,
140 &rpmIArgs.transFlags, RPMTRANS_FLAG_NODOCS,
141 N_("do not install documentation"), NULL},
142 { "excludepath", '\0', POPT_ARG_STRING, 0, POPT_EXCLUDEPATH,
143 N_("skip files with leading component <path> "),
146 { "force", '\0', 0, NULL, RPMCLI_POPT_FORCE,
147 N_("short hand for --replacepkgs --replacefiles"), NULL},
149 { "freshen", 'F', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags,
150 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL),
151 N_("upgrade package(s) if already installed"),
152 N_("<packagefile>+") },
153 { "hash", 'h', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags, INSTALL_HASH,
154 N_("print hash marks as package installs (good with -v)"), NULL},
155 { "ignorearch", '\0', POPT_BIT_SET,
156 &rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREARCH,
157 N_("don't verify package architecture"), NULL},
158 { "ignoreos", '\0', POPT_BIT_SET,
159 &rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREOS,
160 N_("don't verify package operating system"), NULL},
161 { "ignoresize", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
162 (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES),
163 N_("don't check disk space before installing"), NULL},
164 { "includedocs", '\0', POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.incldocs, 0,
165 N_("install documentation"), NULL},
167 { "install", 'i', 0, NULL, 'i',
168 N_("install package(s)"), N_("<packagefile>+") },
170 { "justdb", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_JUSTDB,
171 N_("update the database, but do not modify the filesystem"), NULL},
173 { "noconfigs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
174 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOCONFIGS,
175 N_("do not install configuration files"), NULL},
176 { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS,
177 N_("do not verify package dependencies"), NULL },
178 { "nodocs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
179 &rpmIArgs.transFlags, RPMTRANS_FLAG_NODOCS,
180 N_("do not install documentation"), NULL},
182 { "nofiledigest", '\0', 0, NULL, RPMCLI_POPT_NOFILEDIGEST,
183 N_("don't verify digest of files"), NULL },
184 { "nomd5", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOFILEDIGEST,
185 N_("don't verify digest of files (obsolete)"), NULL },
186 { "nocontexts", '\0',0, NULL, RPMCLI_POPT_NOCONTEXTS,
187 N_("don't install file security contexts"), NULL},
188 { "nocaps", '\0',0, NULL, RPMCLI_POPT_NOCAPS,
189 N_("don't install file capabilities"), NULL},
191 { "noorder", '\0', POPT_BIT_SET,
192 &rpmIArgs.installInterfaceFlags, INSTALL_NOORDER,
193 N_("do not reorder package installation to satisfy dependencies"),
196 { "noscripts", '\0', 0, NULL, RPMCLI_POPT_NOSCRIPTS,
197 N_("do not execute package scriptlet(s)"), NULL },
199 { "nopre", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
201 N_("do not execute %%pre scriptlet (if any)"), NULL },
202 { "nopost", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
203 RPMTRANS_FLAG_NOPOST,
204 N_("do not execute %%post scriptlet (if any)"), NULL },
205 { "nopreun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
206 RPMTRANS_FLAG_NOPREUN,
207 N_("do not execute %%preun scriptlet (if any)"), NULL },
208 { "nopostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
209 RPMTRANS_FLAG_NOPOSTUN,
210 N_("do not execute %%postun scriptlet (if any)"), NULL },
211 { "nopretrans", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
212 RPMTRANS_FLAG_NOPRETRANS,
213 N_("do not execute %%pretrans scriptlet (if any)"), NULL },
214 { "noposttrans", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
215 RPMTRANS_FLAG_NOPOSTTRANS,
216 N_("do not execute %%posttrans scriptlet (if any)"), NULL },
218 { "notriggers", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, _noTransTriggers,
219 N_("do not execute any scriptlet(s) triggered by this package"), NULL},
220 { "notriggerprein", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
221 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPREIN,
222 N_("do not execute any %%triggerprein scriptlet(s)"), NULL},
223 { "notriggerin", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
224 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERIN,
225 N_("do not execute any %%triggerin scriptlet(s)"), NULL},
226 { "notriggerun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
227 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERUN,
228 N_("do not execute any %%triggerun scriptlet(s)"), NULL},
229 { "notriggerpostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
230 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPOSTUN,
231 N_("do not execute any %%triggerpostun scriptlet(s)"), NULL},
233 { "oldpackage", '\0', POPT_BIT_SET,
234 &rpmIArgs.probFilter, RPMPROB_FILTER_OLDPACKAGE,
235 N_("upgrade to an old version of the package (--force on upgrades does this automatically)"),
237 { "percent", '\0', POPT_BIT_SET,
238 &rpmIArgs.installInterfaceFlags, INSTALL_PERCENT,
239 N_("print percentages as package installs"), NULL},
240 { "prefix", '\0', POPT_ARG_STRING, &rpmIArgs.prefix, 0,
241 N_("relocate the package to <dir>, if relocatable"),
243 { "relocate", '\0', POPT_ARG_STRING, 0, POPT_RELOCATE,
244 N_("relocate files from path <old> to <new>"),
246 { "replacefiles", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
247 (RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES),
248 N_("ignore file conflicts between packages"), NULL},
249 { "replacepkgs", '\0', POPT_BIT_SET,
250 &rpmIArgs.probFilter, RPMPROB_FILTER_REPLACEPKG,
251 N_("reinstall if the package is already present"), NULL},
252 { "test", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_TEST,
253 N_("don't install, but tell if it would work or not"), NULL},
254 { "upgrade", 'U', POPT_BIT_SET,
255 &rpmIArgs.installInterfaceFlags, (INSTALL_UPGRADE|INSTALL_INSTALL),
256 N_("upgrade package(s)"),
257 N_("<packagefile>+") },
258 { "reinstall", '\0', POPT_BIT_SET,
259 &rpmIArgs.installInterfaceFlags, (INSTALL_REINSTALL|INSTALL_INSTALL),
260 N_("reinstall package(s)"),
261 N_("<packagefile>+") },