summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-08-29 12:53:26 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-08-29 13:53:39 -0400
commitaa18cb7c9f5e57b1a37d49bc146a144f653b8c51 (patch)
treed8e0e59bf139edaf837b4519a089e28e8a2dc786
parent440530085011e496dd229dd7569090430d86a832 (diff)
librechroot make: Try harder to avoid inheriting the host's pacman config
- `-A`: Comment out the `Include = /etc/pacman.d/*.conf` line that is present in the /usr/share/pacman/defaults/ files since pacman 5.1.1-1.parabola4 - Pass --hookdir="$copydir/etc/pacman.d/hooks" to mkarchroot's pacman to avoid inheriting the host's hooks. https://bugs.archlinux.org/task/49347 I should maybe add tests for both of those things, but they both rely on the actual contents of /etc/pacman.d/...
-rw-r--r--po/es/libretools.po159
-rwxr-xr-xsrc/chroot-tools/librechroot30
2 files changed, 108 insertions, 81 deletions
diff --git a/po/es/libretools.po b/po/es/libretools.po
index b0ee284..337cece 100644
--- a/po/es/libretools.po
+++ b/po/es/libretools.po
@@ -154,7 +154,7 @@ msgstr "En el modo de comparación (si se da el indicador `-n`), de forma "
"imprimirá la línea `[REPO]`."
#: src/abslibre-tools/libredbdiff:157 src/abslibre-tools/librerelease:128
-#: src/chroot-tools/librechroot:253 src/chroot-tools/libremakepkg:170
+#: src/chroot-tools/librechroot:265 src/chroot-tools/libremakepkg:170
#: src/devtools/find-libdeps:36 src/librefetch/librefetch:80
#: src/pkgbuild-check-nonfree:51 src/pkgbuild-summarize-nonfree:39
#: src/toru/toru-path:46
@@ -166,7 +166,7 @@ msgid "Don't update anything, just compare already downloaded files."
msgstr "No actualice nada, simplemente compare archivos ya descargados."
#: src/abslibre-tools/libredbdiff:159 src/abslibre-tools/librerelease:134
-#: src/chroot-tools/librechroot:283 src/chroot-tools/libremakepkg:182
+#: src/chroot-tools/librechroot:295 src/chroot-tools/libremakepkg:182
#: src/devtools/find-libdeps:39 src/librefetch/librefetch:92
#: src/pkgbuild-check-nonfree:58 src/pkgbuild-summarize-nonfree:41
#: src/toru/toru-path:51
@@ -573,7 +573,7 @@ msgstr "Uso: %q COMANDO [ARGUMENTOS]"
msgid "Tool for using distcc within a networkless chroot"
msgstr "Herramienta para usar distcc dentro de un chroot sin red"
-#: src/chroot-tools/distcc-tool:57 src/chroot-tools/librechroot:264
+#: src/chroot-tools/distcc-tool:57 src/chroot-tools/librechroot:276
msgid "Commands:"
msgstr "Comandos:"
@@ -642,15 +642,15 @@ msgstr "Esta entrada binfmt_misc es proporcionada por el paquete %s. Si lo "
"tiene instalado, pero todavía ve este mensaje, puede que tenga que "
"reiniciar %s."
-#: src/chroot-tools/librechroot:194
+#: src/chroot-tools/librechroot:205
msgid "Usage: %s [OPTIONS] COMMAND [ARGS...]"
msgstr "Uso: %s [OPCIONES] COMANDO [ARGS...]"
-#: src/chroot-tools/librechroot:195
+#: src/chroot-tools/librechroot:206
msgid "Interacts with an archroot (arch chroot)."
msgstr "Interactúa con un archroot (arch chroot)."
-#: src/chroot-tools/librechroot:197
+#: src/chroot-tools/librechroot:208
msgid "This is configured with `chroot.conf`, either in `/etc/libretools.d/"
"`, or `$XDG_CONFIG_HOME/libretools/`. The variables you may set are "
"$CHROOTDIR, $CHROOT, and $CHROOTEXTRAPKG."
@@ -658,16 +658,16 @@ msgstr "Esto se configura con `chroot.conf`, en `/etc/libretools.d/`, o `"
"$XDG_CONFIG_HOME/libretools/`. Las variables que puede establecer "
"son $CHROOTDIR, $CHROOT, y $CHROOTEXTRAPKG."
-#: src/chroot-tools/librechroot:202
+#: src/chroot-tools/librechroot:213
msgid "There may be multiple chroots; they are stored in $CHROOTDIR."
msgstr "Hay múltiples chroots; ellos están guardados en $CHROOTDIR."
-#: src/chroot-tools/librechroot:204
+#: src/chroot-tools/librechroot:215
msgid "Each chroot is named; the default is configured with $CHROOT."
msgstr "Cada chroot es nombrado; el predeterminado está configurado con "
"$CHROOT."
-#: src/chroot-tools/librechroot:206
+#: src/chroot-tools/librechroot:217
msgid "Each named chroot has a master clean copy (named `root`), and any "
"number of other named copies; the copy used by default is the "
"current username (or $SUDO_USER, or `copy` if root)."
@@ -676,7 +676,7 @@ msgstr "Cada chroot nombrado tiene una copia limpia maestra (llamada "
"utilizada por defecto es el nombre de usuario actual (o $SUDO_USER, "
"o `copy` si es root). "
-#: src/chroot-tools/librechroot:210
+#: src/chroot-tools/librechroot:221
msgid "The full path to the chroot copy is \"$CHROOTDIR/$CHROOT/$COPY\", "
"unless the copy name is manually specified as an absolute path, in "
"which case, that path is used."
@@ -684,19 +684,19 @@ msgstr "La ruta completa a la copia de chroot es \"$CHROOTDIR/$CHROOT/$COPY"
"\", a menos que el nombre de copia se especifique manualmente como "
"una ruta absoluta, en cuyo caso, esa ruta se utiliza."
-#: src/chroot-tools/librechroot:214
+#: src/chroot-tools/librechroot:225
msgid "The current settings for the above variables are:"
msgstr "Los ajustes actuales para las variables anteriores son:"
-#: src/chroot-tools/librechroot:215 src/chroot-tools/librechroot:216
+#: src/chroot-tools/librechroot:226 src/chroot-tools/librechroot:227
msgid "ERROR: NO SETTING"
msgstr "ERROR: SIN AJUSTES"
-#: src/chroot-tools/librechroot:218 src/chroot-tools/librechroot:219
+#: src/chroot-tools/librechroot:229 src/chroot-tools/librechroot:230
msgid "ERROR"
msgstr "ERROR "
-#: src/chroot-tools/librechroot:221
+#: src/chroot-tools/librechroot:232
msgid "If the chroot or copy does not exist, it will be created "
"automatically. A chroot by default contains the packages in the "
"group \"base-devel\" and any packages named in $CHROOTEXTRAPKG. "
@@ -712,25 +712,25 @@ msgstr "Si el chroot o copia no existe, se creará automáticamente. Un chroot
"en los paquetes, no las versiones de su sistema. Otras herramientas "
"(tales como como libremakepkg) pueden alterar la configuración."
-#: src/chroot-tools/librechroot:229
+#: src/chroot-tools/librechroot:240
msgid "This command will make the following configuration changes in the "
"chroot:"
msgstr "Este comando realizará los siguientes cambios de configuración en el "
"chroot:"
-#: src/chroot-tools/librechroot:231
+#: src/chroot-tools/librechroot:242
msgid "overwrite `/etc/libretools.d/chroot.conf`"
msgstr "sobreescribir `/etc/libretools.d/chroot.conf`"
-#: src/chroot-tools/librechroot:232
+#: src/chroot-tools/librechroot:243
msgid "overwrite `/etc/pacman.d/mirrorlist`"
msgstr "sobreescribir `/etc/pacman.d/mirrorlist`"
-#: src/chroot-tools/librechroot:233
+#: src/chroot-tools/librechroot:244
msgid "set `CacheDir` in `/etc/pacman.conf`"
msgstr "establezca `CacheDir` en `/etc/pacman.conf`"
-#: src/chroot-tools/librechroot:234
+#: src/chroot-tools/librechroot:245
msgid "If a new `pacman.conf` is inserted with the `-C` flag, the change is "
"made after the file is copied in; the `-C` flag doesn't stop the "
"change from being effective."
@@ -738,132 +738,143 @@ msgstr "Si se inserta un nuevo `pacman.conf` con el indicador `-C`, el "
"cambio es hecho después de que el archivo se copia; el parámetro `-"
"C` no detiene el el cambio de ser eficaz."
-#: src/chroot-tools/librechroot:238
+#: src/chroot-tools/librechroot:249
msgid "The processor architecture of the chroot is determined by the by "
"`CARCH` variable in the `/etc/makepkg.conf` file inside of the "
"chroot."
msgstr "La arquitectura del procesador del chroot es determinada por la "
"variable `CATCH` en el archivo `/etc/makepkg.conf` dentro del chroot."
-#: src/chroot-tools/librechroot:242
+#: src/chroot-tools/librechroot:253
msgid "The `-A CARCH` flag is *almost* simply an alias for"
msgstr "El indicador `-A CATCH` es *casi* simplemente un alias para"
-#: src/chroot-tools/librechroot:246
-msgid "However, before doing that, it actually makes a temporary copy of "
- "`pacman.conf`, and sets the `Architecture` line to match the `CARCH` "
- "line in `makepkg.conf`."
-msgstr "Sin embargo, antes de hacer eso, en realidad hace una copia temporal "
- "de `pacman.conf`, y establece la línea `Architecture` para que "
- "coincida con la línea `CARCH` en `makepkg.conf`. "
+#: src/chroot-tools/librechroot:257
+#, fuzzy
+#| msgid "However, before doing that, it actually makes a temporary "
+#| "copy of `pacman.conf`, and sets the `Architecture` line to match the "
+#| "`CARCH` line in `makepkg.conf`."
+msgid "However, before doing that, it actually makes a temporary "
+ "copy of `pacman.conf`, and modifies it to:"
+msgstr "Sin embargo, antes de hacer eso, en realidad hace una copia "
+ "temporal de `pacman.conf`, y establece la línea `Architecture` para "
+ "que coincida con la línea `CARCH` en `makepkg.conf`. "
+
+#: src/chroot-tools/librechroot:259
+msgid "set `Architecture` to match the `CARCH` line in `makepkg.conf`"
+msgstr ""
-#: src/chroot-tools/librechroot:250
+#: src/chroot-tools/librechroot:260
+msgid "comment out any `Include = /etc/pacman.d/*.conf` lines"
+msgstr ""
+
+#: src/chroot-tools/librechroot:262
msgid "Creating a copy, deleting a copy, or syncing a copy can be fairly "
"slow; but are very fast if $CHROOTDIR is on a btrfs partition."
msgstr "Crear una copia, eliminar una copia o sincronizar una copia puede "
"ser bastante lento; pero son muy rápidos si $CHROOTDIR está en una "
"partición btrfs."
-#: src/chroot-tools/librechroot:254 src/chroot-tools/libremakepkg:172
+#: src/chroot-tools/librechroot:266 src/chroot-tools/libremakepkg:172
msgid "CHROOT"
msgstr "CHROOT"
-#: src/chroot-tools/librechroot:254 src/chroot-tools/libremakepkg:172
+#: src/chroot-tools/librechroot:266 src/chroot-tools/libremakepkg:172
msgid "Name of the chroot to use"
msgstr "Nombre del chroot a usar"
-#: src/chroot-tools/librechroot:255 src/chroot-tools/libremakepkg:173
+#: src/chroot-tools/librechroot:267 src/chroot-tools/libremakepkg:173
msgid "COPY"
msgstr "COPIA"
-#: src/chroot-tools/librechroot:255
+#: src/chroot-tools/librechroot:267
msgid "Name of, or absolute path to, the copy to use"
msgstr "Nombre, o ruta absoluta, de la copia a utilizar"
-#: src/chroot-tools/librechroot:256
+#: src/chroot-tools/librechroot:268
msgid "Disable networking in the chroot"
msgstr "Deshabilitar la conexión de redes en el chroot"
-#: src/chroot-tools/librechroot:257
+#: src/chroot-tools/librechroot:269
msgid "Copy this file to `$copydir/etc/pacman.conf`"
msgstr "Copiar este archivo a `$copydir/etc/pacman.conf`"
-#: src/chroot-tools/librechroot:257 src/chroot-tools/librechroot:258
+#: src/chroot-tools/librechroot:269 src/chroot-tools/librechroot:270
#: src/librefetch/librefetch:84
msgid "FILE"
msgstr "ARCHIVO"
-#: src/chroot-tools/librechroot:258
+#: src/chroot-tools/librechroot:270
msgid "Copy this file to `$copydir/etc/makepkg.conf`"
msgstr "Copia este archivo a `$copydir/etc/makepkg.conf`"
-#: src/chroot-tools/librechroot:259
+#: src/chroot-tools/librechroot:271
msgid "CARCH"
msgstr "CARCH"
-#: src/chroot-tools/librechroot:259
+#: src/chroot-tools/librechroot:271
msgid "Set the architecture of the copy; simply an alias for the `-C` and `-"
"M` flags, see above."
msgstr "Establecer la arquitectura de la copia; simplemente un alias para "
"las opciones `-C` y` -M`, vea arriba."
-#: src/chroot-tools/librechroot:261 src/chroot-tools/libremakepkg:174
+#: src/chroot-tools/librechroot:273 src/chroot-tools/libremakepkg:174
msgid "Bind mount a file or directory, read/write"
msgstr "Enlazar un archivo o directorio, lectura/escritura"
-#: src/chroot-tools/librechroot:261 src/chroot-tools/librechroot:262
+#: src/chroot-tools/librechroot:273 src/chroot-tools/librechroot:274
#: src/chroot-tools/libremakepkg:174 src/chroot-tools/libremakepkg:175
#, fuzzy
#| msgid "PATH[:PATH]"
msgid "PATH[:INSIDE_PATH[:OPTIONS]]"
msgstr "RUTA[:RUTA]"
-#: src/chroot-tools/librechroot:262 src/chroot-tools/libremakepkg:175
+#: src/chroot-tools/librechroot:274 src/chroot-tools/libremakepkg:175
msgid "Bind mount a file or directory, read-only"
msgstr "Enlazar-montar un archivo o directorio, de solo lectura"
-#: src/chroot-tools/librechroot:265
+#: src/chroot-tools/librechroot:277
msgid " Create/copy/delete:"
msgstr " Crear/copiar/eliminar"
-#: src/chroot-tools/librechroot:266
+#: src/chroot-tools/librechroot:278
msgid "Do not do anything, but still creates the chroot copy if it does not "
"exist"
msgstr "No hacer nada, pero todavía crea la copia del chroot si no existe"
-#: src/chroot-tools/librechroot:268
+#: src/chroot-tools/librechroot:280
msgid "Sync the copy with the clean (`root`) copy"
msgstr "Sincroniza la copia con la copia limpia (`root`)"
-#: src/chroot-tools/librechroot:269
+#: src/chroot-tools/librechroot:281
msgid "Delete the chroot copy"
msgstr "Elimina la copia del chroot"
-#: src/chroot-tools/librechroot:270
+#: src/chroot-tools/librechroot:282
msgid " Dealing with packages:"
msgstr " Lidiando con paquetes:"
-#: src/chroot-tools/librechroot:271
+#: src/chroot-tools/librechroot:283
msgid "FILES..."
msgstr "ARCHIVOS..."
-#: src/chroot-tools/librechroot:271
+#: src/chroot-tools/librechroot:283
msgid "Like `pacman -U FILES...`"
msgstr "Como `pacman -U FILES...`"
-#: src/chroot-tools/librechroot:272
+#: src/chroot-tools/librechroot:284
msgid "Like `pacman -S NAMES...`"
msgstr "Como `pacman -S NOMBRES...`"
-#: src/chroot-tools/librechroot:272
+#: src/chroot-tools/librechroot:284
msgid "NAMES..."
msgstr "NOMBRES..."
-#: src/chroot-tools/librechroot:273
+#: src/chroot-tools/librechroot:285
msgid "Like `pacman -Syu`"
msgstr "Como `pacman -Syu`"
-#: src/chroot-tools/librechroot:274
+#: src/chroot-tools/librechroot:286
#, fuzzy
#| msgid "Remove all packages from the chroot copy that are not in "
#| "base-devel, $CHROOTEXTRAPKG, or named as a dependency in the file `/"
@@ -876,88 +887,88 @@ msgstr "Eliminar todos los paquetes de la copia chroot que no están "
"en base-devel, $CHROOTEXTRAPKG, o nombrado como una dependencia en "
"el archivo`/startdir/PKGBUILD` en la copia chroot"
-#: src/chroot-tools/librechroot:279
+#: src/chroot-tools/librechroot:291
msgid " Other:"
msgstr " Otro:"
-#: src/chroot-tools/librechroot:280
+#: src/chroot-tools/librechroot:292
msgid "CMD..."
msgstr "CMD..."
-#: src/chroot-tools/librechroot:280
+#: src/chroot-tools/librechroot:292
msgid "Run CMD in the chroot copy"
msgstr "Ejecuta CMD en la copia de chroot"
-#: src/chroot-tools/librechroot:281
+#: src/chroot-tools/librechroot:293
msgid "Enter an interactive shell in the chroot copy"
msgstr "Entrar a un shell interactivo en la copia de chroot"
-#: src/chroot-tools/librechroot:282
+#: src/chroot-tools/librechroot:294
msgid "Clean /repo in the chroot copy"
msgstr "Limpiar /repo en la copia del chroot"
-#: src/chroot-tools/librechroot:309
+#: src/chroot-tools/librechroot:321
msgid "Unsupported architecture: %s"
msgstr "Arquitectura no admitida: %s"
-#: src/chroot-tools/librechroot:310
+#: src/chroot-tools/librechroot:322
msgid "See the files in %q for valid architectures."
msgstr ""
-#: src/chroot-tools/librechroot:328
+#: src/chroot-tools/librechroot:344
msgid "Option -%s may only be given once"
msgstr ""
-#: src/chroot-tools/librechroot:334
+#: src/chroot-tools/librechroot:350
msgid "Option -A may not be used together with -C or -M"
msgstr ""
-#: src/chroot-tools/librechroot:340
+#: src/chroot-tools/librechroot:356
msgid "Must specify a command"
msgstr "Debe especificar un comando"
-#: src/chroot-tools/librechroot:346
+#: src/chroot-tools/librechroot:362
msgid "Unrecognized command: %s"
msgstr "Comando no reconocido: %s"
-#: src/chroot-tools/librechroot:354
+#: src/chroot-tools/librechroot:370
msgid "Command `%s` does not take any arguments: %s"
msgstr "El comando `%s` no toma ningún argumento: %s"
-#: src/chroot-tools/librechroot:361
+#: src/chroot-tools/librechroot:377
msgid "Command `%s` requires at least one file"
msgstr "El comando `%s` requiere al menos un archivo"
-#: src/chroot-tools/librechroot:373
+#: src/chroot-tools/librechroot:389
msgid "%s: file(s) not found: %s"
msgstr "%s: archivo(s) no encontrado(s): %s"
-#: src/chroot-tools/librechroot:380
+#: src/chroot-tools/librechroot:396
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:387
+#: src/chroot-tools/librechroot:403
msgid "Command `%s` requires at least one argument"
msgstr "El comando `%s` requiere al menos un argumento"
-#: src/chroot-tools/librechroot:410
+#: src/chroot-tools/librechroot:426
msgid "This program must be run as root."
msgstr "Este programa debe ser ejecutado como root."
-#: src/chroot-tools/librechroot:419 src/chroot-tools/libremakepkg:274
+#: src/chroot-tools/librechroot:435 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:423
+#: src/chroot-tools/librechroot:439
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:428
+#: src/chroot-tools/librechroot:444
msgid "Creating 'root' copy for chroot [%s]"
msgstr "Creando copia 'root' para el chroot [%s]"
-#: src/chroot-tools/librechroot:434
+#: src/chroot-tools/librechroot:450
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 1896711..b3cf041 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -122,10 +122,21 @@ mkarchroot() {
local arch_nspawn_flags=("${arch_nspawn_flags[@]}")
hack_arch_nspawn_flags "$copydir"
- unshare -m "$_mkarchroot" \
- "${arch_nspawn_flags[@]}" \
- "$copydir" \
- "${pkgs[@]}"
+ local cmd=(
+ unshare -m "$_mkarchroot"
+ # mkarchroot flags: (flags are very similar to arch-nspawn)
+ "${arch_nspawn_flags[@]}"
+ # chroot directory:
+ -- "$copydir"
+ # pacman flags:
+ # * hack around https://bugs.archlinux.org/task/49347
+ --hookdir="$copydir/etc/pacman.d/hooks"
+ # packages: (and maybe more flags... pacstrap injects
+ # flags at the end, so we can't turn of flag parsing
+ # with '--')
+ "${pkgs[@]}"
+ )
+ "${cmd[@]}"
}
################################################################################
@@ -244,8 +255,9 @@ usage() {
'-C "/usr/share/pacman/defaults/pacman.conf.$CARCH" \' \
'-M "/usr/share/pacman/defaults/makepkg.conf.$CARCH"'
prose 'However, before doing that, it actually makes a temporary copy of
- `pacman.conf`, and sets the `Architecture` line to match the
- `CARCH` line in `makepkg.conf`.'
+ `pacman.conf`, and modifies it to:'
+ bullet 'set `Architecture` to match the `CARCH` line in `makepkg.conf`'
+ bullet 'comment out any `Include = /etc/pacman.d/*.conf` lines'
echo
prose 'Creating a copy, deleting a copy, or syncing a copy can be fairly
slow; but are very fast if $CHROOTDIR is on a btrfs partition.'
@@ -312,7 +324,11 @@ main() {
fi
trap 'rm -f -- "$tmppacmanconf"' EXIT
tmppacmanconf="$(mktemp --tmpdir librechroot-pacman.conf.XXXXXXXXXX)"
- < "/usr/share/pacman/defaults/pacman.conf.$OPTARG" sed -r "s|^#?\\s*Architecture.+|Architecture = ${OPTARG}|g" > "$tmppacmanconf"
+ sed -r \
+ -e "s|^#?\\s*Architecture.+|Architecture = ${OPTARG}|g" \
+ -e "s|^.*Include\s*=\s*/etc/pacman.d/.*\.conf|#&|" \
+ < "/usr/share/pacman/defaults/pacman.conf.$OPTARG" \
+ > "$tmppacmanconf"
arch_nspawn_flags+=(
-C "$tmppacmanconf"
-M "/usr/share/pacman/defaults/makepkg.conf.$OPTARG"