diff options
authorLuke Shumaker <>2018-08-07 16:31:48 -0400
committerLuke Shumaker <>2018-08-07 16:35:07 -0400
commitca8266cc911101b6508e95fa4d8977aa193d34e1 (patch)
parent7a16e913507bf49d8fafdacfaf859489727151e1 (diff)
librechroot: Disallow flags overriding other flags
This results in user confusion, like
2 files changed, 49 insertions, 27 deletions
diff --git a/po/es/libretools.po b/po/es/libretools.po
index 1db6950..33f0dc4 100644
--- a/po/es/libretools.po
+++ b/po/es/libretools.po
@@ -525,35 +525,35 @@ msgstr "chroot '%s' no está a la versión %s. Por favor reconstruir."
msgid "(chcleanup): Must be run inside of a chroot"
msgstr "(chcleanup): Debe ser ejecutado dentro de un chroot"
-#: src/chroot-tools/chcleanup:94
+#: src/chroot-tools/chcleanup:96
msgid "Cleaning chroot..."
msgstr "Limpiando un chroot..."
-#: src/chroot-tools/chcleanup:107
+#: src/chroot-tools/chcleanup:128
msgid "Creating a full list of packages..."
msgstr "Creando una lista completa de paquetes..."
-#: src/chroot-tools/chcleanup:127
+#: src/chroot-tools/chcleanup:141
msgid "Could not create a full list of packages, exiting."
msgstr "No se pudo crear una lista completa de paquetes, saliendo."
-#: src/chroot-tools/chcleanup:128
+#: src/chroot-tools/chcleanup:142
msgid "This is likely caused by a dependency that could not be found."
msgstr ""
-#: src/chroot-tools/chcleanup:139
+#: src/chroot-tools/chcleanup:153
msgid "No packages to remove"
msgstr "No hay paquetes para remover"
-#: src/chroot-tools/chcleanup:141
+#: src/chroot-tools/chcleanup:155
msgid "Removing %d packages"
msgstr "Removiendo %d paquetes"
-#: src/chroot-tools/chcleanup:154
+#: src/chroot-tools/chcleanup:168
msgid "No packages to add"
msgstr ""
-#: src/chroot-tools/chcleanup:156
+#: src/chroot-tools/chcleanup:170
msgid "Adding %d packages"
msgstr ""
@@ -896,77 +896,85 @@ msgstr "Entrar a un shell interactivo en la copia de chroot"
msgid "Clean /repo in the chroot copy"
msgstr "Limpiar /repo en la copia del chroot"
-#: src/chroot-tools/librechroot:308
+#: src/chroot-tools/librechroot:309
msgid "Unsupported architecture: %s"
msgstr "Arquitectura no admitida: %s"
-#: src/chroot-tools/librechroot:309
+#: src/chroot-tools/librechroot:310
msgid "See the files in %q for valid architectures."
msgstr ""
-#: src/chroot-tools/librechroot:326
+#: src/chroot-tools/librechroot:328
+msgid "Option -%s may only be given once"
+msgstr ""
+#: src/chroot-tools/librechroot:334
+msgid "Option -A may not be used together with -C or -M"
+msgstr ""
+#: src/chroot-tools/librechroot:340
msgid "Must specify a command"
msgstr "Debe especificar un comando"
-#: src/chroot-tools/librechroot:332
+#: src/chroot-tools/librechroot:346
msgid "Unrecognized command: %s"
msgstr "Comando no reconocido: %s"
-#: src/chroot-tools/librechroot:340
+#: src/chroot-tools/librechroot:354
msgid "Command `%s` does not take any arguments: %s"
msgstr "El comando `%s` no toma ningún argumento: %s"
-#: src/chroot-tools/librechroot:347
+#: src/chroot-tools/librechroot:361
msgid "Command `%s` requires at least one file"
msgstr "El comando `%s` requiere al menos un archivo"
-#: src/chroot-tools/librechroot:359
+#: src/chroot-tools/librechroot:373
msgid "%s: file(s) not found: %s"
msgstr "%s: archivo(s) no encontrado(s): %s"
-#: src/chroot-tools/librechroot:366
+#: src/chroot-tools/librechroot:380
msgid "Command `%s` requires at least one package name"
msgstr "El comando `%s` requiere al menos un nombre de un paquete"
-#: src/chroot-tools/librechroot:373
+#: src/chroot-tools/librechroot:387
msgid "Command `%s` requires at least one argument"
msgstr "El comando `%s` requiere al menos un argumento"
-#: src/chroot-tools/librechroot:396
+#: src/chroot-tools/librechroot:410
msgid "This program must be run as root."
msgstr "Este programa debe ser ejecutado como root."
-#: src/chroot-tools/librechroot:404
+#: src/chroot-tools/librechroot:418
msgid "Input is not a TTY"
msgstr "La entrada no es un TTY"
-#: src/chroot-tools/librechroot:405
+#: src/chroot-tools/librechroot:419
msgid ""
msgstr ""
-#: src/chroot-tools/librechroot:406
+#: src/chroot-tools/librechroot:420
msgid ""
msgstr ""
-#: src/chroot-tools/librechroot:407
+#: src/chroot-tools/librechroot:421
msgid "Due to a bug in systemd-nspawn, redirecting stdin is not supported."
msgstr "Debido a un error en systemd-nspawn, el redireccionamiento de stdin "
"no está soportado."
-#: src/chroot-tools/librechroot:415 src/chroot-tools/libremakepkg:274
+#: src/chroot-tools/librechroot:429 src/chroot-tools/libremakepkg:274
msgid "Waiting for existing lock on chroot copy to be released: [%s]"
msgstr "Esperando que el bloqueo existente en la copia de chroot sea "
"liberado: [%s]"
-#: src/chroot-tools/librechroot:419
+#: src/chroot-tools/librechroot:433
msgid "Chroot copy is mounted with nosuid or noexec options: [%s]"
msgstr "La copia del chroot se monta con opciones nosuid o noexec: [%s]"
-#: src/chroot-tools/librechroot:424
+#: src/chroot-tools/librechroot:438
msgid "Creating 'root' copy for chroot [%s]"
msgstr "Creando copia 'root' para el chroot [%s]"
-#: src/chroot-tools/librechroot:430
+#: src/chroot-tools/librechroot:444
msgid "Syncing copy [%s] with root copy"
msgstr "Sincronizando copia [%s] con la copia root"
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index c8b83f8..378222b 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -296,7 +296,8 @@ main() {
declare -i retconf=0
load_conf chroot.conf CHROOTDIR CHROOT || retconf=$?
- local mode=enter
+ local mode=enter opt
+ declare -Ai used_opts
while getopts 'n:l:NC:M:A:w:r:' opt; do
case $opt in
@@ -320,7 +321,20 @@ main() {
r) sysd_nspawn_flags+=("--bind-ro=$OPTARG");;
*) usage >&2; return $EXIT_INVALIDARGUMENT;;
+ used_opts[$opt]+=1
+ for opt in n l C M A; do
+ if (( ${used_opts[$opt]:-0} > 1 )); then
+ error "Option -%s may only be given once"
+ usage >&2
+ fi
+ done
+ if (( ${used_opts[A]:-0} && ( ${used_opts[C]:-0} || ${used_opts[M]:-0} ) )); then
+ error "Option -A may not be used together with -C or -M"
+ usage >&2
+ fi
shift $((OPTIND - 1))
if [[ $# -lt 1 ]]; then
error "Must specify a command"