3 * Popt tables for install modes.
13 extern time_t get_date(const char * p, void * now); /* XXX expedient lies */
17 struct rpmInstallArguments_s rpmIArgs;
19 #define POPT_RELOCATE -1016
20 #define POPT_EXCLUDEPATH -1019
21 #define POPT_ROLLBACK -1024
23 /*@exits@*/ static void argerror(const char * desc)
26 /*@-modfilesys -globs @*/
27 fprintf(stderr, _("%s: %s\n"), __progname, desc);
28 /*@=modfilesys =globs @*/
34 static void installArgCallback( /*@unused@*/ poptContext con,
35 /*@unused@*/ enum poptCallbackReason reason,
36 const struct poptOption * opt, const char * arg,
37 /*@unused@*/ const void * data)
38 /*@globals rpmIArgs */
39 /*@modifies rpmIArgs */
41 struct rpmInstallArguments_s * ia = &rpmIArgs;
44 fprintf(stderr, "*** opt %s %c info 0x%x arg %p val 0x%x arg %p %s\n", opt->longName, opt->shortName, opt->argInfo, opt->arg, opt->val, arg, arg);
47 /* XXX avoid accidental collisions with POPT_BIT_SET for flags */
51 case POPT_EXCLUDEPATH:
52 if (arg == NULL || *arg != '/')
53 argerror(_("exclude paths must begin with a /"));
54 ia->relocations = xrealloc(ia->relocations,
55 sizeof(*ia->relocations) * (ia->numRelocations + 1));
57 ia->relocations[ia->numRelocations].oldPath = arg;
59 ia->relocations[ia->numRelocations].newPath = NULL;
63 { char * newPath = NULL;
64 if (arg == NULL || *arg != '/')
65 argerror(_("relocations must begin with a /"));
66 if (!(newPath = strchr(arg, '=')))
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));
74 ia->relocations[ia->numRelocations].oldPath = arg;
77 ia->relocations[ia->numRelocations].newPath = newPath;
84 argerror(_("rollback takes a time/date stamp argument"));
87 tid = get_date(arg, NULL);
90 if (tid == (time_t)-1 || tid == (time_t)0)
91 argerror(_("malformed rollback time/date stamp argument"));
100 /*@-bitwisesigned -compmempass @*/
102 struct poptOption rpmInstallPoptTable[] = {
103 /*@-type@*/ /* FIX: cast? */
104 { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
105 installArgCallback, 0, NULL, NULL },
108 { "allfiles", '\0', POPT_BIT_SET,
109 &rpmIArgs.transFlags, RPMTRANS_FLAG_ALLFILES,
110 N_("install all files, even configurations which might otherwise be skipped"),
112 { "allmatches", '\0', POPT_BIT_SET,
113 &rpmIArgs.eraseInterfaceFlags, UNINSTALL_ALLMATCHES,
114 N_("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"),
117 { "apply", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
118 (_noTransScripts|_noTransTriggers|
119 RPMTRANS_FLAG_APPLYONLY|RPMTRANS_FLAG_PKGCOMMIT),
120 N_("do not execute package scriptlet(s)"), NULL },
122 { "badreloc", '\0', POPT_BIT_SET,
123 &rpmIArgs.probFilter, RPMPROB_FILTER_FORCERELOCATE,
124 N_("relocate files in non-relocateable package"), NULL},
125 { "dirstash", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
126 &rpmIArgs.transFlags, RPMTRANS_FLAG_DIRSTASH,
127 N_("save erased package files by renaming into sub-directory"), NULL},
128 { "erase", 'e', POPT_BIT_SET,
129 &rpmIArgs.installInterfaceFlags, INSTALL_ERASE,
130 N_("erase (uninstall) package"), N_("<package>+") },
131 { "excludedocs", '\0', POPT_BIT_SET,
132 &rpmIArgs.transFlags, RPMTRANS_FLAG_NODOCS,
133 N_("do not install documentation"), NULL},
134 { "excludepath", '\0', POPT_ARG_STRING, 0, POPT_EXCLUDEPATH,
135 N_("skip files with leading component <path> "),
137 { "force", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
138 (RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES | RPMPROB_FILTER_OLDPACKAGE),
139 N_("short hand for --replacepkgs --replacefiles"), NULL},
140 { "freshen", 'F', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags,
141 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL),
142 N_("upgrade package(s) if already installed"),
143 N_("<packagefile>+") },
144 { "hash", 'h', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags, INSTALL_HASH,
145 N_("print hash marks as package installs (good with -v)"), NULL},
146 { "ignorearch", '\0', POPT_BIT_SET,
147 &rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREARCH,
148 N_("don't verify package architecture"), NULL},
149 { "ignoreos", '\0', POPT_BIT_SET,
150 &rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREOS,
151 N_("don't verify package operating system"), NULL},
152 { "ignoresize", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
153 (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES),
154 N_("don't check disk space before installing"), NULL},
155 { "includedocs", '\0', 0, &rpmIArgs.incldocs, 0,
156 N_("install documentation"), NULL},
157 { "install", '\0', POPT_BIT_SET,
158 &rpmIArgs.installInterfaceFlags, INSTALL_INSTALL,
159 N_("install package"), N_("<packagefile>+") },
160 { "justdb", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_JUSTDB,
161 N_("update the database, but do not modify the filesystem"), NULL},
162 { "nodeps", '\0', 0, &rpmIArgs.noDeps, 0,
163 N_("do not verify package dependencies"), NULL },
164 { "noorder", '\0', POPT_BIT_SET,
165 &rpmIArgs.installInterfaceFlags, INSTALL_NOORDER,
166 N_("do not reorder package installation to satisfy dependencies"),
169 { "noscripts", '\0', POPT_BIT_SET, &rpmIArgs.transFlags,
170 (_noTransScripts|_noTransTriggers),
171 N_("do not execute package scriptlet(s)"), NULL },
172 { "nopre", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
174 N_("do not execute %%pre scriptlet (if any)"), NULL },
175 { "nopost", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
176 RPMTRANS_FLAG_NOPOST,
177 N_("do not execute %%post scriptlet (if any)"), NULL },
178 { "nopreun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
179 RPMTRANS_FLAG_NOPREUN,
180 N_("do not execute %%preun scriptlet (if any)"), NULL },
181 { "nopostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
182 RPMTRANS_FLAG_NOPOSTUN,
183 N_("do not execute %%postun scriptlet (if any)"), NULL },
185 { "nodigest", '\0', POPT_BIT_SET, &rpmIArgs.qva_flags, VERIFY_DIGEST,
186 N_("don't verify digest(s)"), NULL },
187 { "nosignature", '\0', POPT_BIT_SET, &rpmIArgs.qva_flags, VERIFY_SIGNATURE,
188 N_("don't verify signature(s)"), NULL },
190 { "notriggers", '\0', POPT_BIT_SET, &rpmIArgs.transFlags,
192 N_("do not execute any scriptlet(s) triggered by this package"), NULL},
193 { "notriggerprein", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
194 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPREIN,
195 N_("do not execute any %%triggerprein scriptlet(s)"), NULL},
196 { "notriggerin", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
197 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERIN,
198 N_("do not execute any %%triggerin scriptlet(s)"), NULL},
199 { "notriggerun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
200 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERUN,
201 N_("do not execute any %%triggerun scriptlet(s)"), NULL},
202 { "notriggerpostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
203 &rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPOSTUN,
204 N_("do not execute any %%triggerpostun scriptlet(s)"), NULL},
206 { "oldpackage", '\0', POPT_BIT_SET,
207 &rpmIArgs.probFilter, RPMPROB_FILTER_OLDPACKAGE,
208 N_("upgrade to an old version of the package (--force on upgrades does this automatically)"),
210 { "percent", '\0', POPT_BIT_SET,
211 &rpmIArgs.installInterfaceFlags, INSTALL_PERCENT,
212 N_("print percentages as package installs"), NULL},
213 { "prefix", '\0', POPT_ARG_STRING, &rpmIArgs.prefix, 0,
214 N_("relocate the package to <dir>, if relocatable"),
216 { "relocate", '\0', POPT_ARG_STRING, 0, POPT_RELOCATE,
217 N_("relocate files from path <old> to <new>"),
219 { "repackage", '\0', POPT_BIT_SET,
220 &rpmIArgs.transFlags, RPMTRANS_FLAG_REPACKAGE,
221 N_("save erased package files by repackaging"), NULL},
222 { "replacefiles", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
223 (RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES),
224 N_("install even if the package replaces installed files"), NULL},
225 { "replacepkgs", '\0', POPT_BIT_SET,
226 &rpmIArgs.probFilter, RPMPROB_FILTER_REPLACEPKG,
227 N_("reinstall if the package is already present"), NULL},
228 { "rollback", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_ROLLBACK,
229 N_("deinstall new, reinstall old, package(s), back to <date>"),
231 { "test", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_TEST,
232 N_("don't install, but tell if it would work or not"), NULL},
233 { "upgrade", 'U', POPT_BIT_SET,
234 &rpmIArgs.installInterfaceFlags, (INSTALL_UPGRADE|INSTALL_INSTALL),
235 N_("upgrade package(s)"),
236 N_("<packagefile>+") },
240 /*@=bitwisesigned =compmempass @*/