xbps-uchroot: support long options; update usage.
This commit is contained in:
parent
9328afb397
commit
a1d66032bd
@ -89,12 +89,14 @@ static SIMPLEQ_HEAD(bindmnt_head, bindmnt) bindmnt_queue =
|
|||||||
static void __attribute__((noreturn))
|
static void __attribute__((noreturn))
|
||||||
usage(const char *p)
|
usage(const char *p)
|
||||||
{
|
{
|
||||||
printf("Usage: %s [-[B|b] src:dest] [-O -t -o <opts>] [--] <dir> <cmd> [<cmdargs>]\n\n"
|
printf("Usage: %s [OPTIONS] [--] <dir> <cmd> [<cmdargs>]\n\n"
|
||||||
"-B src:dest Bind mounts <src> into <dir>/<dest> (read-only)\n"
|
"-B, --bind-ro <src:dest> Bind mounts <src> into <dir>/<dest> (read-only)\n"
|
||||||
"-b src:dest Bind mounts <src> into <dir>/<dest> (read-write)\n"
|
"-b, --bind-rw <src:dest> Bind mounts <src> into <dir>/<dest> (read-write)\n"
|
||||||
"-O Creates a tempdir and mounts <dir> read-only via overlayfs\n"
|
"-O, --overlayfs Creates a tempdir and mounts <dir> read-only via overlayfs\n"
|
||||||
"-t Creates a tempdir and mounts <dir> on tmpfs (for use with -O)\n"
|
"-t, --tmpfs Creates a tempdir and mounts <dir> on tmpfs (for use with -O)\n"
|
||||||
"-o opts Options to be passed to the tmpfs mount (for use with -t)\n", p);
|
"-o, --options <opts> Options to be passed to the tmpfs mount (for use with -t)\n"
|
||||||
|
"-V, --version Show XBPS version\n"
|
||||||
|
"-h, --help Show usage\n\n", p);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,13 +331,20 @@ main(int argc, char **argv)
|
|||||||
pid_t child;
|
pid_t child;
|
||||||
bool overlayfs = false;
|
bool overlayfs = false;
|
||||||
const struct option longopts[] = {
|
const struct option longopts[] = {
|
||||||
|
{ "overlayfs", no_argument, NULL, 'O' },
|
||||||
|
{ "tmpfs", no_argument, NULL, 't' },
|
||||||
|
{ "options", required_argument, NULL, 'o' },
|
||||||
|
{ "bind-rw", required_argument, NULL, 'B' },
|
||||||
|
{ "bind-ro", required_argument, NULL, 'b' },
|
||||||
|
{ "version", no_argument, NULL, 'V' },
|
||||||
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
tmpfs_opts = rootdir = cmd = NULL;
|
tmpfs_opts = rootdir = cmd = NULL;
|
||||||
argv0 = argv[0];
|
argv0 = argv[0];
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "Oto:B:b:V", longopts, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "Oto:B:b:Vh", longopts, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'O':
|
case 'O':
|
||||||
overlayfs = true;
|
overlayfs = true;
|
||||||
@ -359,6 +368,7 @@ main(int argc, char **argv)
|
|||||||
case 'V':
|
case 'V':
|
||||||
printf("%s\n", XBPS_RELVER);
|
printf("%s\n", XBPS_RELVER);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
default:
|
default:
|
||||||
usage(argv0);
|
usage(argv0);
|
||||||
|
Loading…
Reference in New Issue
Block a user