|
Lines 28-38
Link Here
|
| 28 |
#include "lib.h" |
28 |
#include "lib.h" |
| 29 |
#include "delete.h" |
29 |
#include "delete.h" |
| 30 |
|
30 |
|
| 31 |
static char Options[] = "hvDdnfp:"; |
31 |
static char Options[] = "hvDdnfp:r"; |
| 32 |
|
32 |
|
| 33 |
char *Prefix = NULL; |
33 |
char *Prefix = NULL; |
| 34 |
Boolean NoDeInstall = FALSE; |
34 |
Boolean NoDeInstall = FALSE; |
| 35 |
Boolean CleanDirs = FALSE; |
35 |
Boolean CleanDirs = FALSE; |
|
|
36 |
Boolean NeedRoot = TRUE; |
| 36 |
|
37 |
|
| 37 |
static void usage __P((void)); |
38 |
static void usage __P((void)); |
| 38 |
|
39 |
|
|
Lines 58-63
Link Here
|
| 58 |
Prefix = optarg; |
59 |
Prefix = optarg; |
| 59 |
break; |
60 |
break; |
| 60 |
|
61 |
|
|
|
62 |
case 'r': |
| 63 |
NeedRoot = FALSE; |
| 64 |
break; |
| 65 |
|
| 61 |
case 'D': |
66 |
case 'D': |
| 62 |
NoDeInstall = TRUE; |
67 |
NoDeInstall = TRUE; |
| 63 |
break; |
68 |
break; |
|
Lines 107-114
Link Here
|
| 107 |
if (pkgs == start) |
112 |
if (pkgs == start) |
| 108 |
warnx("missing package name(s)"), usage(); |
113 |
warnx("missing package name(s)"), usage(); |
| 109 |
*pkgs = NULL; |
114 |
*pkgs = NULL; |
| 110 |
if (!Fake && getuid() != 0) |
115 |
if (!Fake && getuid() != 0) { |
| 111 |
errx(1, "you must be root to delete packages"); |
116 |
warnx("you must be root to delete packages%s", |
|
|
117 |
NeedRoot ? "" : " (proceeding anyway)"); |
| 118 |
if (NeedRoot) |
| 119 |
return EXIT_FAILURE; |
| 120 |
} |
| 112 |
if ((error = pkg_perform(start)) != 0) { |
121 |
if ((error = pkg_perform(start)) != 0) { |
| 113 |
if (Verbose) |
122 |
if (Verbose) |
| 114 |
warnx("%d package deletion(s) failed", error); |
123 |
warnx("%d package deletion(s) failed", error); |