2 static char *rcsid = "$Id: main.c,v 1.3 1993/09/05 04:53:49 jkh Exp $";
7 * FreeBSD install - a package for the installation and maintainance
8 * of non-core utilities.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
22 * This is the add module.
29 static char Options[] = "hvIRnp:SMt:";
32 Boolean NoInstall = FALSE;
33 Boolean NoRecord = FALSE;
39 char *Directory = NULL;
41 add_mode_t AddMode = NORMAL;
44 main(int argc, char **argv)
48 char *prog_name = argv[0];
51 while ((ch = getopt(argc, argv, Options)) != EOF)
89 usage(prog_name, NULL);
96 /* Get all the remaining package names, if any */
100 /* If no packages, yelp */
102 if (pkgs == start && AddMode != SLAVE)
103 usage(prog_name, "Missing package name(s)");
104 else if (start[1] && AddMode == MASTER)
105 usage(prog_name, "Only one package name may be specified with master mode");
106 else if (pkgs != start && AddMode == SLAVE)
107 whinge("Package names ignored in slave mode.");
108 if ((err = pkg_perform(start)) != NULL) {
110 fprintf(stderr, "%d package addition(s) failed.\n", err);
118 usage(const char *name, const char *fmt, ...)
124 fprintf(stderr, "%s: ", name);
125 vfprintf(stderr, fmt, args);
126 fprintf(stderr, "\n\n");
129 fprintf(stderr, "Usage: %s [args] pkg [ .. pkg ]\n", name);
130 fprintf(stderr, "Where args are one or more of:\n\n");
131 fprintf(stderr, "-v verbose\n");
132 fprintf(stderr, "-p arg override prefix with arg\n");
133 fprintf(stderr, "-I don't execute pkg install script, if any\n");
134 fprintf(stderr, "-R don't record installation (can't delete!)\n");
135 fprintf(stderr, "-n don't actually install, just show steps\n");
136 fprintf(stderr, "-t temp use temp as template for mktemp()\n");
137 fprintf(stderr, "-S run in SLAVE mode\n");
138 fprintf(stderr, "-M run in MASTER mode\n");