summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-02-29 10:50:25 +0100
committerAlexander Larsson <alexl@redhat.com>2016-02-29 10:50:25 +0100
commit05762b42fba2fea394c2810e5bef98e9a38b9cdf (patch)
tree8bbd2ffc7b6753ea42cdd80876e3e4ce3cf53f31
parentcaa95735c8476f702b277c6e771fcc9b19d02387 (diff)
downloadbubblewrap-05762b42fba2fea394c2810e5bef98e9a38b9cdf.tar.gz
Make commandline args shorter, drom --mount and --make prefixes
Its pretty obvious (in this context) what e.g. --bind does. Having unnecessary large names just makes things harder to read.
-rw-r--r--bubblewrap.c54
-rwxr-xr-xdemos/bubblewrap-shell.sh24
-rwxr-xr-xdemos/xdg-app-run.sh56
3 files changed, 67 insertions, 67 deletions
diff --git a/bubblewrap.c b/bubblewrap.c
index 957a617..4c9b025 100644
--- a/bubblewrap.c
+++ b/bubblewrap.c
@@ -140,15 +140,15 @@ usage ()
" --unsetenv VAR Unset an environment variable\n"
" --lock-file DEST Take a lock on DEST while sandbox is running\n"
" --sync-fd FD Keep this fd open while sandbox is running\n"
- " --mount-bind SRC DEST Bind mount the host path SRC on DEST\n"
- " --mount-dev-bind SRC DEST Bind mount the host path SRC on DEST, allowing device access\n"
- " --mount-ro-bind SRC DEST Bind mount the host path SRC readonly on DEST\n"
- " --mount-proc DEST Mount procfs on DEST\n"
- " --mount-dev DEST Mount new dev on DEST\n"
- " --make-dir DEST Create dir at DEST\n"
- " --make-file FD DEST Copy from FD to dest DEST\n"
- " --make-bind-file FD DEST Copy from FD to file which is bind-mounted on DEST\n"
- " --make-symlink SRC DEST Create symlink at DEST with target SRC\n"
+ " --bind SRC DEST Bind mount the host path SRC on DEST\n"
+ " --dev-bind SRC DEST Bind mount the host path SRC on DEST, allowing device access\n"
+ " --ro-bind SRC DEST Bind mount the host path SRC readonly on DEST\n"
+ " --proc DEST Mount procfs on DEST\n"
+ " --dev DEST Mount new dev on DEST\n"
+ " --dir DEST Create dir at DEST\n"
+ " --file FD DEST Copy from FD to dest DEST\n"
+ " --bind-data FD DEST Copy from FD to file which is bind-mounted on DEST\n"
+ " --symlink SRC DEST Create symlink at DEST with target SRC\n"
);
exit (1);
}
@@ -829,10 +829,10 @@ main (int argc,
argv++;
argc--;
}
- else if (strcmp (arg, "--mount-bind") == 0)
+ else if (strcmp (arg, "--bind") == 0)
{
if (argc < 3)
- die ("--mount-bind takes two arguments");
+ die ("--bind takes two arguments");
op = setup_op_new (SETUP_BIND_MOUNT);
op->source = canonicalize_file_name (argv[1]);
@@ -843,10 +843,10 @@ main (int argc,
argv += 2;
argc -= 2;
}
- else if (strcmp (arg, "--mount-ro-bind") == 0)
+ else if (strcmp (arg, "--ro-bind") == 0)
{
if (argc < 3)
- die ("--mount-ro-bind takes two arguments");
+ die ("--ro-bind takes two arguments");
op = setup_op_new (SETUP_RO_BIND_MOUNT);
op->source = canonicalize_file_name (argv[1]);
@@ -857,10 +857,10 @@ main (int argc,
argv += 2;
argc -= 2;
}
- else if (strcmp (arg, "--mount-dev-bind") == 0)
+ else if (strcmp (arg, "--dev-bind") == 0)
{
if (argc < 3)
- die ("--mount-dev-bind takes two arguments");
+ die ("--dev-bind takes two arguments");
op = setup_op_new (SETUP_DEV_BIND_MOUNT);
op->source = canonicalize_file_name (argv[1]);
@@ -871,10 +871,10 @@ main (int argc,
argv += 2;
argc -= 2;
}
- else if (strcmp (arg, "--mount-proc") == 0)
+ else if (strcmp (arg, "--proc") == 0)
{
if (argc < 2)
- die ("--mount-proc takes an argument");
+ die ("--proc takes an argument");
op = setup_op_new (SETUP_MOUNT_PROC);
op->dest = argv[1];
@@ -882,10 +882,10 @@ main (int argc,
argv += 1;
argc -= 1;
}
- else if (strcmp (arg, "--mount-dev") == 0)
+ else if (strcmp (arg, "--dev") == 0)
{
if (argc < 2)
- die ("--mount-dev takes an argument");
+ die ("--dev takes an argument");
op = setup_op_new (SETUP_MOUNT_DEV);
op->dest = argv[1];
@@ -893,10 +893,10 @@ main (int argc,
argv += 1;
argc -= 1;
}
- else if (strcmp (arg, "--make-dir") == 0)
+ else if (strcmp (arg, "--dir") == 0)
{
if (argc < 2)
- die ("--make-dir takes an argument");
+ die ("--dir takes an argument");
op = setup_op_new (SETUP_MAKE_DIR);
op->dest = argv[1];
@@ -904,13 +904,13 @@ main (int argc,
argv += 1;
argc -= 1;
}
- else if (strcmp (arg, "--make-file") == 0)
+ else if (strcmp (arg, "--file") == 0)
{
int file_fd;
char *endptr;
if (argc < 3)
- die ("--make-file takes two arguments");
+ die ("--file takes two arguments");
file_fd = strtol (argv[1], &endptr, 10);
if (argv[1][0] == 0 || endptr[0] != 0 || file_fd < 0)
@@ -923,13 +923,13 @@ main (int argc,
argv += 2;
argc -= 2;
}
- else if (strcmp (arg, "--make-bind-file") == 0)
+ else if (strcmp (arg, "--bind-data") == 0)
{
int file_fd;
char *endptr;
if (argc < 3)
- die ("--make-bind-file takes two arguments");
+ die ("--bind-data takes two arguments");
file_fd = strtol (argv[1], &endptr, 10);
if (argv[1][0] == 0 || endptr[0] != 0 || file_fd < 0)
@@ -942,10 +942,10 @@ main (int argc,
argv += 2;
argc -= 2;
}
- else if (strcmp (arg, "--make-symlink") == 0)
+ else if (strcmp (arg, "--symlink") == 0)
{
if (argc < 3)
- die ("--make-symlink takes two arguments");
+ die ("--symlink takes two arguments");
op = setup_op_new (SETUP_MAKE_SYMLINK);
op->source = argv[1];
diff --git a/demos/bubblewrap-shell.sh b/demos/bubblewrap-shell.sh
index 059ee8b..e04a6bc 100755
--- a/demos/bubblewrap-shell.sh
+++ b/demos/bubblewrap-shell.sh
@@ -10,19 +10,19 @@ getent group `id -g` 65534 > ${GROUP}
( # Remove temporary files before calling bwrap, they are open in the fds anyway
rm $GROUP
rm $PASSWD
- bwrap --mount-ro-bind /usr /usr \
- --make-dir /tmp \
- --mount-proc /proc \
- --mount-dev /dev \
- --mount-ro-bind /etc/resolv.conf /etc/resolv.conf \
- --make-file 11 /etc/passwd \
- --make-file 12 /etc/group \
- --make-symlink usr/lib /lib \
- --make-symlink usr/lib64 /lib64 \
- --make-symlink usr/bin /bin \
- --make-symlink usr/sbin /sbin \
+ bwrap --ro-bind /usr /usr \
+ --dir /tmp \
+ --proc /proc \
+ --dev /dev \
+ --ro-bind /etc/resolv.conf /etc/resolv.conf \
+ --file 11 /etc/passwd \
+ --file 12 /etc/group \
+ --symlink usr/lib /lib \
+ --symlink usr/lib64 /lib64 \
+ --symlink usr/bin /bin \
+ --symlink usr/sbin /sbin \
--chdir / \
--unshare-pid \
- --make-dir /run/user/$(id -u) \
+ --dir /run/user/$(id -u) \
--setenv XDG_RUNTIME_DIR "/run/user/`id -u`" \
/bin/sh) 11< ${PASSWD} 12< ${GROUP}
diff --git a/demos/xdg-app-run.sh b/demos/xdg-app-run.sh
index e8f548a..0461685 100755
--- a/demos/xdg-app-run.sh
+++ b/demos/xdg-app-run.sh
@@ -26,36 +26,36 @@ getent group `id -g` 65534 > ${GROUP}
rm $GROUP
rm $PASSWD
bwrap \
- --mount-ro-bind ~/.local/share/xdg-app/runtime/org.gnome.Platform/x86_64/master/active/files /usr \
+ --ro-bind ~/.local/share/xdg-app/runtime/org.gnome.Platform/x86_64/master/active/files /usr \
--lock-file /usr/.ref \
- --mount-ro-bind ~/.local/share/xdg-app/app/org.gnome.Weather/x86_64/master/active/files/ /app \
+ --ro-bind ~/.local/share/xdg-app/app/org.gnome.Weather/x86_64/master/active/files/ /app \
--lock-file /app/.ref \
- --mount-dev /dev \
- --mount-proc /proc \
- --make-dir /tmp \
- --make-symlink /tmp /var/tmp \
- --make-symlink /run /var/run \
- --make-symlink usr/lib /lib \
- --make-symlink usr/lib64 /lib64 \
- --make-symlink usr/bin /bin \
- --make-symlink usr/sbin /sbin \
- --make-symlink usr/etc /etc \
- --make-dir /run/user/`id -u` \
- --make-bind-file 11 /usr/etc/passwd \
- --make-bind-file 12 /usr/etc/group \
- --mount-ro-bind /etc/machine-id /usr/etc/machine-id \
- --mount-ro-bind /etc/resolv.conf /run/host/monitor/resolv.conf \
- --make-file 10 /run/user/`id -u`/xdg-app-info \
- --mount-ro-bind /sys/block /sys/block \
- --mount-ro-bind /sys/bus /sys/bus \
- --mount-ro-bind /sys/class /sys/class \
- --mount-ro-bind /sys/dev /sys/dev \
- --mount-ro-bind /sys/devices /sys/devices \
- --mount-dev-bind /dev/dri /dev/dri \
- --mount-bind /tmp/.X11-unix/X0 /tmp/.X11-unix/X99 \
- --mount-bind ~/.var/app/org.gnome.Weather ~/.var/app/org.gnome.Weather \
- --mount-bind ~/.config/dconf ~/.config/dconf \
- --mount-bind /run/user/`id -u`/dconf /run/user/`id -u`/dconf \
+ --dev /dev \
+ --proc /proc \
+ --dir /tmp \
+ --symlink /tmp /var/tmp \
+ --symlink /run /var/run \
+ --symlink usr/lib /lib \
+ --symlink usr/lib64 /lib64 \
+ --symlink usr/bin /bin \
+ --symlink usr/sbin /sbin \
+ --symlink usr/etc /etc \
+ --dir /run/user/`id -u` \
+ --bind-data 11 /usr/etc/passwd \
+ --bind-data 12 /usr/etc/group \
+ --ro-bind /etc/machine-id /usr/etc/machine-id \
+ --ro-bind /etc/resolv.conf /run/host/monitor/resolv.conf \
+ --file 10 /run/user/`id -u`/xdg-app-info \
+ --ro-bind /sys/block /sys/block \
+ --ro-bind /sys/bus /sys/bus \
+ --ro-bind /sys/class /sys/class \
+ --ro-bind /sys/dev /sys/dev \
+ --ro-bind /sys/devices /sys/devices \
+ --dev-bind /dev/dri /dev/dri \
+ --bind /tmp/.X11-unix/X0 /tmp/.X11-unix/X99 \
+ --bind ~/.var/app/org.gnome.Weather ~/.var/app/org.gnome.Weather \
+ --bind ~/.config/dconf ~/.config/dconf \
+ --bind /run/user/`id -u`/dconf /run/user/`id -u`/dconf \
--unshare-pid \
--setenv XDG_RUNTIME_DIR "/run/user/`id -u`" \
--setenv DISPLAY :99 \