3 * Popt tables for install modes.
12 extern time_t get_date(const char * p, void * now); /* XXX expedient lies */
14 struct rpmInstallArguments_s rpmIArgs = {
17 0, /* installInterfaceFlags */
18 0, /* eraseInterfaceFlags */
21 0, /* numRelocations */
24 NULL, /* relocations */
29 #define POPT_RELOCATE -1021
30 #define POPT_EXCLUDEPATH -1022
31 #define POPT_ROLLBACK -1023
33 static void argerror(const char * desc)
35 fprintf(stderr, _("%s: %s\n"), __progname, desc);
41 static void installArgCallback( poptContext con,
42 enum poptCallbackReason reason,
43 const struct poptOption * opt, const char * arg,
46 struct rpmInstallArguments_s * ia = &rpmIArgs;
48 /* XXX avoid accidental collisions with POPT_BIT_SET for flags */
53 ia->installInterfaceFlags |= INSTALL_INSTALL;
56 case POPT_EXCLUDEPATH:
57 if (arg == NULL || *arg != '/')
58 argerror(_("exclude paths must begin with a /"));
59 ia->relocations = xrealloc(ia->relocations,
60 sizeof(*ia->relocations) * (ia->numRelocations + 1));
61 ia->relocations[ia->numRelocations].oldPath = xstrdup(arg);
62 ia->relocations[ia->numRelocations].newPath = NULL;
66 { char * oldPath = NULL;
67 char * newPath = NULL;
69 if (arg == NULL || *arg != '/')
70 argerror(_("relocations must begin with a /"));
71 oldPath = xstrdup(arg);
72 if (!(newPath = strchr(oldPath, '=')))
73 argerror(_("relocations must contain a ="));
76 argerror(_("relocations must have a / following the ="));
77 ia->relocations = xrealloc(ia->relocations,
78 sizeof(*ia->relocations) * (ia->numRelocations + 1));
79 ia->relocations[ia->numRelocations].oldPath = oldPath;
80 ia->relocations[ia->numRelocations].newPath = newPath;
87 argerror(_("rollback takes a time/date stamp argument"));
89 tid = get_date(arg, NULL);
91 if (tid == (time_t)-1 || tid == (time_t)0)
92 argerror(_("malformed rollback time/date stamp argument"));
96 case RPMCLI_POPT_NODIGEST:
97 ia->qva_flags |= VERIFY_DIGEST;
100 case RPMCLI_POPT_NOSIGNATURE:
101 ia->qva_flags |= VERIFY_SIGNATURE;
104 case RPMCLI_POPT_NOHDRCHK:
105 ia->qva_flags |= VERIFY_HDRCHK;
108 case RPMCLI_POPT_NODEPS:
112 case RPMCLI_POPT_NOMD5:
113 ia->transFlags |= RPMTRANS_FLAG_NOMD5;
116 case RPMCLI_POPT_NOCONTEXTS:
117 ia->transFlags |= RPMTRANS_FLAG_NOCONTEXTS;
120 case RPMCLI_POPT_FORCE:
122 ( RPMPROB_FILTER_REPLACEPKG
123 | RPMPROB_FILTER_REPLACEOLDFILES
124 | RPMPROB_FILTER_REPLACENEWFILES
125 | RPMPROB_FILTER_OLDPACKAGE );
128 case RPMCLI_POPT_NOSCRIPTS:
129 ia->transFlags |= (_noTransScripts | _noTransTriggers);
137 struct poptOption rpmInstallPoptTable[] = {
139 { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
140 installArgCallback, 0, NULL, NULL },
142 { "aid", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_ADDINDEPS,
143 N_("add suggested packages to transaction"), NULL },
145 { "allfiles", '\0', POPT_BIT_SET,
146 &rpmIArgs.transFlags, RPMTRANS_FLAG_ALLFILES,
147 N_("install all files, even configurations which might otherwise be skipped"),
149 { "allmatches", '\0', POPT_BIT_SET,
150 &rpmIArgs.eraseInterfaceFlags, UNINSTALL_ALLMATCHES,
151 N_("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"),
154 { "apply", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
155 (_noTransScripts|_noTransTriggers|
156 RPMTRANS_FLAG_APPLYONLY|RPMTRANS_FLAG_PKGCOMMIT),
157 N_("do not execute package scriptlet(s)"), NULL },
159 { "badreloc", '\0', POPT_BIT_SET,
160 &rpmIArgs.probFilter, RPMPROB_FILTER_FORCERELOCATE,
161 N_("relocate files in non-relocatable package"), NULL},
163 { "deploops", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
164 &rpmIArgs.transFlags, RPMTRANS_FLAG_DEPLOOPS,
165 N_("print dependency loops as warning"), NULL},
167 { "dirstash", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
168 &rpmIArgs.transFlags, RPMTRANS_FLAG_DIRSTASH,
169 N_("save erased package files by renaming into sub-directory"), NULL},
170 { "erase", 'e', POPT_BIT_SET,
171 &rpmIArgs.installInterfaceFlags, INSTALL_ERASE,
172 N_("erase (uninstall) package"), N_("<package>+") },
173 { "excludeconfigs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
174 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOCONFIGS,
175 N_("do not install configuration files"), NULL},
176 { "excludedocs", '\0', POPT_BIT_SET,
177 &rpmIArgs.transFlags, RPMTRANS_FLAG_NODOCS,
178 N_("do not install documentation"), NULL},
179 { "excludepath", '\0', POPT_ARG_STRING, 0, POPT_EXCLUDEPATH,
180 N_("skip files with leading component <path> "),
183 { "fileconflicts", '\0', POPT_BIT_CLR, &rpmIArgs.probFilter,
184 (RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES),
185 N_("detect file conflicts between packages"), NULL},
186 { "force", '\0', 0, NULL, RPMCLI_POPT_FORCE,
187 N_("short hand for --replacepkgs --replacefiles"), NULL},
189 { "freshen", 'F', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags,
190 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL),
191 N_("upgrade package(s) if already installed"),
192 N_("<packagefile>+") },
193 { "hash", 'h', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags, INSTALL_HASH,
194 N_("print hash marks as package installs (good with -v)"), NULL},
195 { "ignorearch", '\0', POPT_BIT_SET,
196 &rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREARCH,
197 N_("don't verify package architecture"), NULL},
198 { "ignoreos", '\0', POPT_BIT_SET,
199 &rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREOS,
200 N_("don't verify package operating system"), NULL},
201 { "ignoresize", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
202 (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES),
203 N_("don't check disk space before installing"), NULL},
204 { "includedocs", '\0', POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.incldocs, 0,
205 N_("install documentation"), NULL},
207 { "install", 'i', 0, NULL, 'i',
208 N_("install package(s)"), N_("<packagefile>+") },
210 { "justdb", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_JUSTDB,
211 N_("update the database, but do not modify the filesystem"), NULL},
213 { "noconfigs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
214 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOCONFIGS,
215 N_("do not install configuration files"), NULL},
216 { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS,
217 N_("do not verify package dependencies"), NULL },
218 { "nodocs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
219 &rpmIArgs.transFlags, RPMTRANS_FLAG_NODOCS,
220 N_("do not install documentation"), NULL},
222 { "nomd5", '\0', 0, NULL, RPMCLI_POPT_NOMD5,
223 N_("don't verify MD5 digest of files"), NULL },
224 { "nocontexts", '\0',0, NULL, RPMCLI_POPT_NOCONTEXTS,
225 N_("don't install file security contexts"), NULL},
227 { "noorder", '\0', POPT_BIT_SET,
228 &rpmIArgs.installInterfaceFlags, INSTALL_NOORDER,
229 N_("do not reorder package installation to satisfy dependencies"),
232 { "nosuggest", '\0', POPT_BIT_SET, &rpmIArgs.transFlags,
233 RPMTRANS_FLAG_NOSUGGEST,
234 N_("do not suggest missing dependency resolution(s)"), NULL},
236 { "noscripts", '\0', 0, NULL, RPMCLI_POPT_NOSCRIPTS,
237 N_("do not execute package scriptlet(s)"), NULL },
239 { "nopre", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
241 N_("do not execute %%pre scriptlet (if any)"), NULL },
242 { "nopost", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
243 RPMTRANS_FLAG_NOPOST,
244 N_("do not execute %%post scriptlet (if any)"), NULL },
245 { "nopreun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
246 RPMTRANS_FLAG_NOPREUN,
247 N_("do not execute %%preun scriptlet (if any)"), NULL },
248 { "nopostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
249 RPMTRANS_FLAG_NOPOSTUN,
250 N_("do not execute %%postun scriptlet (if any)"), NULL },
252 { "nodigest", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NODIGEST,
253 N_("don't verify package digest(s)"), NULL },
254 { "nohdrchk", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NOHDRCHK,
255 N_("don't verify database header(s) when retrieved"), NULL },
256 { "nosignature", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NOSIGNATURE,
257 N_("don't verify package signature(s)"), NULL },
259 { "notriggers", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, _noTransTriggers,
260 N_("do not execute any scriptlet(s) triggered by this package"), NULL},
261 { "notriggerprein", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
262 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPREIN,
263 N_("do not execute any %%triggerprein scriptlet(s)"), NULL},
264 { "notriggerin", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
265 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERIN,
266 N_("do not execute any %%triggerin scriptlet(s)"), NULL},
267 { "notriggerun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
268 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERUN,
269 N_("do not execute any %%triggerun scriptlet(s)"), NULL},
270 { "notriggerpostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
271 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPOSTUN,
272 N_("do not execute any %%triggerpostun scriptlet(s)"), NULL},
274 { "oldpackage", '\0', POPT_BIT_SET,
275 &rpmIArgs.probFilter, RPMPROB_FILTER_OLDPACKAGE,
276 N_("upgrade to an old version of the package (--force on upgrades does this automatically)"),
278 { "percent", '\0', POPT_BIT_SET,
279 &rpmIArgs.installInterfaceFlags, INSTALL_PERCENT,
280 N_("print percentages as package installs"), NULL},
281 { "prefix", '\0', POPT_ARG_STRING, &rpmIArgs.prefix, 0,
282 N_("relocate the package to <dir>, if relocatable"),
284 { "relocate", '\0', POPT_ARG_STRING, 0, POPT_RELOCATE,
285 N_("relocate files from path <old> to <new>"),
287 { "repackage", '\0', POPT_BIT_SET,
288 &rpmIArgs.transFlags, RPMTRANS_FLAG_REPACKAGE,
289 N_("save erased package files by repackaging"), NULL},
290 { "replacefiles", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
291 (RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES),
292 N_("ignore file conflicts between packages"), NULL},
293 { "replacepkgs", '\0', POPT_BIT_SET,
294 &rpmIArgs.probFilter, RPMPROB_FILTER_REPLACEPKG,
295 N_("reinstall if the package is already present"), NULL},
296 { "rollback", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_ROLLBACK,
297 N_("deinstall new, reinstall old, package(s), back to <date>"),
299 { "test", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_TEST,
300 N_("don't install, but tell if it would work or not"), NULL},
301 { "upgrade", 'U', POPT_BIT_SET,
302 &rpmIArgs.installInterfaceFlags, (INSTALL_UPGRADE|INSTALL_INSTALL),
303 N_("upgrade package(s)"),
304 N_("<packagefile>+") },