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"), __progname, 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_FORCE:
92 ( RPMPROB_FILTER_REPLACEPKG
93 | RPMPROB_FILTER_REPLACEOLDFILES
94 | RPMPROB_FILTER_REPLACENEWFILES
95 | RPMPROB_FILTER_OLDPACKAGE );
98 case RPMCLI_POPT_NOSCRIPTS:
99 ia->transFlags |= (_noTransScripts | _noTransTriggers);
107 struct poptOption rpmInstallPoptTable[] = {
109 { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
110 installArgCallback, 0, NULL, NULL },
112 { "allfiles", '\0', POPT_BIT_SET,
113 &rpmIArgs.transFlags, RPMTRANS_FLAG_ALLFILES,
114 N_("install all files, even configurations which might otherwise be skipped"),
116 { "allmatches", '\0', POPT_BIT_SET,
117 &rpmIArgs.installInterfaceFlags, UNINSTALL_ALLMATCHES,
118 N_("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"),
121 { "badreloc", '\0', POPT_BIT_SET,
122 &rpmIArgs.probFilter, RPMPROB_FILTER_FORCERELOCATE,
123 N_("relocate files in non-relocatable package"), NULL},
125 { "deploops", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
126 &rpmIArgs.transFlags, RPMTRANS_FLAG_DEPLOOPS,
127 N_("print dependency loops as warning"), NULL},
129 { "erase", 'e', POPT_BIT_SET,
130 &rpmIArgs.installInterfaceFlags, INSTALL_ERASE,
131 N_("erase (uninstall) package"), N_("<package>+") },
132 { "excludeconfigs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
133 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOCONFIGS,
134 N_("do not install configuration files"), NULL},
135 { "excludedocs", '\0', POPT_BIT_SET,
136 &rpmIArgs.transFlags, RPMTRANS_FLAG_NODOCS,
137 N_("do not install documentation"), NULL},
138 { "excludepath", '\0', POPT_ARG_STRING, 0, POPT_EXCLUDEPATH,
139 N_("skip files with leading component <path> "),
142 { "force", '\0', 0, NULL, RPMCLI_POPT_FORCE,
143 N_("short hand for --replacepkgs --replacefiles"), NULL},
145 { "freshen", 'F', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags,
146 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL),
147 N_("upgrade package(s) if already installed"),
148 N_("<packagefile>+") },
149 { "hash", 'h', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags, INSTALL_HASH,
150 N_("print hash marks as package installs (good with -v)"), NULL},
151 { "ignorearch", '\0', POPT_BIT_SET,
152 &rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREARCH,
153 N_("don't verify package architecture"), NULL},
154 { "ignoreos", '\0', POPT_BIT_SET,
155 &rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREOS,
156 N_("don't verify package operating system"), NULL},
157 { "ignoresize", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
158 (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES),
159 N_("don't check disk space before installing"), NULL},
160 { "includedocs", '\0', POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.incldocs, 0,
161 N_("install documentation"), NULL},
163 { "install", 'i', 0, NULL, 'i',
164 N_("install package(s)"), N_("<packagefile>+") },
166 { "justdb", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_JUSTDB,
167 N_("update the database, but do not modify the filesystem"), NULL},
169 { "noconfigs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
170 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOCONFIGS,
171 N_("do not install configuration files"), NULL},
172 { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS,
173 N_("do not verify package dependencies"), NULL },
174 { "nodocs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
175 &rpmIArgs.transFlags, RPMTRANS_FLAG_NODOCS,
176 N_("do not install documentation"), NULL},
178 { "nofiledigest", '\0', 0, NULL, RPMCLI_POPT_NOFILEDIGEST,
179 N_("don't verify digest of files"), NULL },
180 { "nomd5", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOFILEDIGEST,
181 N_("don't verify digest of files (obsolete)"), NULL },
182 { "nocontexts", '\0',0, NULL, RPMCLI_POPT_NOCONTEXTS,
183 N_("don't install file security contexts"), NULL},
185 { "noorder", '\0', POPT_BIT_SET,
186 &rpmIArgs.installInterfaceFlags, INSTALL_NOORDER,
187 N_("do not reorder package installation to satisfy dependencies"),
190 { "noscripts", '\0', 0, NULL, RPMCLI_POPT_NOSCRIPTS,
191 N_("do not execute package scriptlet(s)"), NULL },
193 { "nopre", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
195 N_("do not execute %%pre scriptlet (if any)"), NULL },
196 { "nopost", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
197 RPMTRANS_FLAG_NOPOST,
198 N_("do not execute %%post scriptlet (if any)"), NULL },
199 { "nopreun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
200 RPMTRANS_FLAG_NOPREUN,
201 N_("do not execute %%preun scriptlet (if any)"), NULL },
202 { "nopostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
203 RPMTRANS_FLAG_NOPOSTUN,
204 N_("do not execute %%postun scriptlet (if any)"), NULL },
205 { "nopretrans", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
206 RPMTRANS_FLAG_NOPRETRANS,
207 N_("do not execute %%pretrans scriptlet (if any)"), NULL },
208 { "noposttrans", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
209 RPMTRANS_FLAG_NOPOSTTRANS,
210 N_("do not execute %%posttrans scriptlet (if any)"), NULL },
212 { "notriggers", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, _noTransTriggers,
213 N_("do not execute any scriptlet(s) triggered by this package"), NULL},
214 { "notriggerprein", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
215 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPREIN,
216 N_("do not execute any %%triggerprein scriptlet(s)"), NULL},
217 { "notriggerin", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
218 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERIN,
219 N_("do not execute any %%triggerin scriptlet(s)"), NULL},
220 { "notriggerun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
221 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERUN,
222 N_("do not execute any %%triggerun scriptlet(s)"), NULL},
223 { "notriggerpostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
224 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPOSTUN,
225 N_("do not execute any %%triggerpostun scriptlet(s)"), NULL},
227 { "nocollections", '\0', POPT_BIT_SET,
228 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOCOLLECTIONS,
229 N_("do not perform any collection actions"), NULL},
231 { "oldpackage", '\0', POPT_BIT_SET,
232 &rpmIArgs.probFilter, RPMPROB_FILTER_OLDPACKAGE,
233 N_("upgrade to an old version of the package (--force on upgrades does this automatically)"),
235 { "percent", '\0', POPT_BIT_SET,
236 &rpmIArgs.installInterfaceFlags, INSTALL_PERCENT,
237 N_("print percentages as package installs"), NULL},
238 { "prefix", '\0', POPT_ARG_STRING, &rpmIArgs.prefix, 0,
239 N_("relocate the package to <dir>, if relocatable"),
241 { "relocate", '\0', POPT_ARG_STRING, 0, POPT_RELOCATE,
242 N_("relocate files from path <old> to <new>"),
244 { "replacefiles", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
245 (RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES),
246 N_("ignore file conflicts between packages"), NULL},
247 { "replacepkgs", '\0', POPT_BIT_SET,
248 &rpmIArgs.probFilter, RPMPROB_FILTER_REPLACEPKG,
249 N_("reinstall if the package is already present"), NULL},
250 { "test", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_TEST,
251 N_("don't install, but tell if it would work or not"), NULL},
252 { "upgrade", 'U', POPT_BIT_SET,
253 &rpmIArgs.installInterfaceFlags, (INSTALL_UPGRADE|INSTALL_INSTALL),
254 N_("upgrade package(s)"),
255 N_("<packagefile>+") },