summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid P <megver83@parabola.nu>2021-07-09 00:54:23 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2024-01-01 17:40:25 -0500
commit7de6029abaf3673d4130a8fc0adcefb5b17e9706 (patch)
treeaf14650138201da720e8b01b23f0e899d770818f
parent64d2386d50808e44d1eec5d84e643b376a284c76 (diff)
replace arch-nspawn with chroot-run (nonsystemd compat)
Signed-off-by: David P <megver83@parabola.nu> Previously, the nonsystemd branch was rebased onto the master branch for nonsystemd releases from v20180428 to v20190907. The nonsystemd build seems to work well on systemd systems, and it has no dependencies in [nonsystemd]; so there only needs to be one build in [libre]. This commit squashes the functional changes from the following commits from the former nonsystemd branch: * e51206cf3223baaca3a108f1215b98bcab0afdea initial arch-nspawn replacement with chroot-run * 98969d9bf3efca05eb2781a91282b204a5a8d749 librechroot: fix bind mounts; update .gitignore; update translations * 455bfe339805da4502973e876b01f53d9ebfa6d4 librechroot: little fix for chroot-run() function
-rw-r--r--po/es/libretools.po28
-rw-r--r--src/chroot-tools/.gitignore2
-rw-r--r--src/chroot-tools/Makefile4
-rwxr-xr-xsrc/chroot-tools/librechroot78
-rw-r--r--src/lib/.gitignore2
-rw-r--r--src/lib/Makefile4
6 files changed, 73 insertions, 45 deletions
diff --git a/po/es/libretools.po b/po/es/libretools.po
index 167ca35..ed393fe 100644
--- a/po/es/libretools.po
+++ b/po/es/libretools.po
@@ -554,6 +554,34 @@ msgstr ""
msgid "Location of a makepkg config file"
msgstr ""
+#: src/chroot-tools/chroot-run:27
+msgid "Killing chroot process: %s (%s)"
+msgstr "Matando proceso del chroot: %s (%s)"
+
+#: src/chroot-tools/chroot-run:72 src/chroot-tools/mkarchroot:40
+msgid "invalid argument '%s'"
+msgstr "argumento inválido '%s'"
+
+#: src/chroot-tools/chroot-run:77
+msgid "You must specify a directory."
+msgstr "Debe especificar un directorio."
+
+#: src/chroot-tools/chroot-run:83 src/chroot-tools/mkarchroot:52
+msgid "Please specify a working directory."
+msgstr "Por favor especifique un directorio de trabajo."
+
+#: src/chroot-tools/chroot-run:143
+msgid "'%s' does not appear to be an Arch chroot."
+msgstr "'%s' no parece ser un chroot de Arch."
+
+#: src/chroot-tools/chroot-run:149
+msgid "failed to setup API filesystems in chroot %s"
+msgstr "falló al configurar los sistemas de archivos API en el chroot"
+
+#: src/chroot-tools/chroot-run:145
+msgid "chroot '%s' is not at version %s. Please rebuild."
+msgstr "chroot '%s' no está a la versión %s. Por favor reconstruir."
+
#: src/chroot-tools/arch-nspawn:30
msgid "Set pacman cache directory"
msgstr ""
diff --git a/src/chroot-tools/.gitignore b/src/chroot-tools/.gitignore
index 8054d28..c176bd4 100644
--- a/src/chroot-tools/.gitignore
+++ b/src/chroot-tools/.gitignore
@@ -1,6 +1,6 @@
makechrootpkg.sh*
makechrootpkg.in
-arch-nspawn*
+chroot-run*
mkarchroot*
!*.patch
diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile
index de79819..a279172 100644
--- a/src/chroot-tools/Makefile
+++ b/src/chroot-tools/Makefile
@@ -4,9 +4,9 @@ include $(topsrcdir)/build-aux/Makefile.head.mk
pkglibexecdir = $(libexecdir)/libretools/chroot
pkglibdir = $(libdir)/libretools/chroot
-libretools.src.devtools = makechrootpkg.in mkarchroot.in arch-nspawn.in
+libretools.src.devtools = makechrootpkg.in mkarchroot.in chroot-run.in
libretools.out.bins = librechroot libremakepkg
-libretools.out.libexecs = arch-nspawn chcleanup distcc-tool indent mkarchroot
+libretools.out.libexecs = chroot-run chcleanup distcc-tool indent mkarchroot
libretools.out.libs = $(libretools.src.sh) makechrootpkg.sh
files.out.int += chcleanup.lib
files.sys.libretools += $(bindir)/chcleanup # not in libretools.out.bins because explicit rule
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index 240d975..33d4ebb 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -118,20 +118,20 @@ check_mountpoint() {
# Wrappers for files in ${pkglibexecdir}/chroot/ #
################################################################################
-readonly _arch_nspawn="$(librelib chroot/arch-nspawn)"
+readonly _chroot_run="$(librelib chroot/chroot-run)"
readonly _mkarchroot="$(librelib chroot/mkarchroot)"
-arch_nspawn_flags=()
-sysd_nspawn_flags=()
+chroot_run_flags=()
+mkarchroot_flags=()
-hack_arch_nspawn_flags() {
+hack_mkarchroot_flags() {
local copydir="$1"
local makepkg_conf="$copydir/etc/makepkg.conf"
local CARCH=$(detect_chroot_arch "$makepkg_conf")
local setarch interpreter
OPTIND=1
- set -- "${arch_nspawn_flags[@]}"
+ set -- "${mkarchroot_flags[@]}"
while getopts 'hC:M:c:f:s' arg; do
case "$arg" in
M) makepkg_conf="$OPTARG" ;;
@@ -145,7 +145,6 @@ hack_arch_nspawn_flags() {
esac
if ! setarch $setarch /bin/true 2>/dev/null; then
# We're running a cross-arch chroot
-
# Make sure that qemu-static is set up with binfmt_misc
if [[ -z $(grep -l -xF \
-e "interpreter $interpreter" \
@@ -157,28 +156,28 @@ hack_arch_nspawn_flags() {
prose 'Such a binfmt_misc entry is provided by the %s
package. If you have it installed, but still see
this message, you may need to restart %s.' \
- qemu-user-static-binfmt systemd-binfmt.service
+ qemu-user-static-binfmt binfmt
return $EXIT_NOTINSTALLED
fi
# Let qemu/binfmt_misc do its thing
- arch_nspawn_flags+=(-f "$interpreter" -s)
+ mkarchroot_flags+=(-f "$interpreter" -s)
fi
}
-# Usage: arch-nspawn $copydir $cmd...
-arch-nspawn() {
+# Usage: chroot-run $copydir $cmd...
+chroot-run() {
local copydir=$1; shift
local cmd=("$@")
- local arch_nspawn_flags=("${arch_nspawn_flags[@]}")
+ local mkarchroot_flags=("${mkarchroot_flags[@]}")
- hack_arch_nspawn_flags "$copydir"
+ hack_mkarchroot_flags "$copydir"
- "$_arch_nspawn" \
- "${arch_nspawn_flags[@]}" \
- "$copydir" \
- "${sysd_nspawn_flags[@]}" \
+ "$_chroot_run" \
+ "${mkarchroot_flags[@]}" \
+ "${chroot_run_flags[@]}" \
-- \
+ "$copydir" \
"${cmd[@]}"
}
@@ -186,15 +185,14 @@ arch-nspawn() {
mkarchroot() {
local copydir=$1; shift
local pkgs=("$@")
- local arch_nspawn_flags=("${arch_nspawn_flags[@]}")
+ local mkarchroot_flags=("${mkarchroot_flags[@]}")
- hack_arch_nspawn_flags "$copydir"
+ hack_mkarchroot_flags "$copydir"
local cmd=(
unshare -m "$_mkarchroot"
# mkarchroot flags:
- # * flags are very similar to arch-nspawn
- "${arch_nspawn_flags[@]}"
+ "${mkarchroot_flags[@]}"
# chroot directory:
-- "$copydir"
# pacman flags:
@@ -275,8 +273,8 @@ usage() {
prose 'This command will make the following configuration changes in the
chroot:'
bullet 'overwrite `/etc/libretools.d/chroot.conf`' # libretools/librechroot
- bullet 'overwrite `/etc/pacman.d/mirrorlist`' # devtools/arch-nspawn
- bullet 'set `CacheDir` in `/etc/pacman.conf`' # devtools/arch-nspawn
+ bullet 'overwrite `/etc/pacman.d/mirrorlist`' # devtools/chroot-run
+ bullet 'set `CacheDir` in `/etc/pacman.conf`' # devtools/chroot-run
prose 'If an over-ride `pacman.conf` is specified with the `-C` flag,
the changes above are made after the file is copied in.
The `-C` flag will not prevent these modifications.'
@@ -358,8 +356,8 @@ main() {
local tmp_pacmanconf="$(mktemp --tmpdir librechroot-pacman.conf.XXXXXXXXXX)"
local seed_pacmanconf="${def_pacmanconf}"
local use_tmp_pacmanconf=0
- arch_nspawn_flags=( -C "$def_pacmanconf"
- -M "$def_makepkgconf" )
+ mkarchroot_flags=( -C "$def_pacmanconf"
+ -M "$def_makepkgconf" )
trap "[[ ! -f \"$tmp_pacmanconf\" ]] || rm -f -- \"$tmp_pacmanconf\"" EXIT
@@ -370,20 +368,20 @@ main() {
case $opt in
n) CHROOT=$OPTARG ;;
l) COPY=$OPTARG ;;
- C) arch_nspawn_flags=( -C "$OPTARG" -M "$def_makepkgconf" ) ;;
- M) arch_nspawn_flags=( -M "$OPTARG" -C "$def_pacmanconf" )
+ C) mkarchroot_flags=( -C "$OPTARG" -M "$def_makepkgconf" ) ;;
+ M) mkarchroot_flags=( -M "$OPTARG" -C "$def_pacmanconf" )
target_arch=$(detect_chroot_arch "$OPTARG") ;;
A) target_arch=$OPTARG
use_tmp_pacmanconf=1
def_pacmanconf="${DEF_PACMANCONF_DIR}"/pacman.conf.${target_arch}
def_makepkgconf="${DEF_PACMANCONF_DIR}"/makepkg.conf.${target_arch}
seed_pacmanconf="${tmp_pacmanconf}"
- arch_nspawn_flags+=( -C "${seed_pacmanconf}"
- -M "${def_makepkgconf}" ) ;;
- N) sysd_nspawn_flags+=( --private-network ) ;;
- w) sysd_nspawn_flags+=( "--bind=$OPTARG" ) ;;
- r) sysd_nspawn_flags+=( "--bind-ro=$OPTARG" ) ;;
- *) ExitInvalidArgument ;;
+ mkarchroot_flags+=( -C "${seed_pacmanconf}"
+ -M "${def_makepkgconf}" ) ;;
+ N ) chroot_run_flags+=( -N ) ;;
+ w ) chroot_run_flags+=(-b "-B:$OPTARG") ;;
+ r ) chroot_run_flags+=(-b "-Br:$OPTARG") ;;
+ * ) ExitInvalidArgument ;;
esac
used_opts[$opt]+=1
done
@@ -557,13 +555,13 @@ main() {
# - overwrite '/etc/pacman.d/mirrorlist'"
# - set 'CacheDir' in \`/etc/pacman.conf'"
# - apply -C or -M flags
- arch-nspawn "$copydir" true </dev/null
+ chroot-run "$copydir" true </dev/null
fi
# cleanup
[[ ! -f "$tmp_pacmanconf" ]] || rm -f -- "$tmp_pacmanconf"
- trap EXIT # clear the trap to remove the temporary pacman.conf
- arch_nspawn_flags=() # XXX dirty hack, don't apply -C or -M again
+ trap EXIT # clear the trap to remove the temporary pacman.conf
+ mkarchroot_flags=() # XXX dirty hack, don't apply -C or -M again
## handle commands ##
@@ -583,10 +581,10 @@ main() {
chroot_add_to_local_repo "$copydir" "$@"
;;
install-name)
- arch-nspawn "$copydir" pacman -Sy --noconfirm -- "$@" </dev/null
+ chroot-run "$copydir" pacman -Sy --noconfirm -- "$@" </dev/null
;;
update)
- arch-nspawn "$copydir" pacman -Syu --noconfirm </dev/null
+ chroot-run "$copydir" pacman -Syu --noconfirm </dev/null
;;
clean-pkgs)
trap "rm -f -- ${copydir@Q}/{chcleanup,chrootexec}" EXIT
@@ -598,15 +596,15 @@ main() {
'/chcleanup' \
> "$copydir/chrootexec"
chmod 755 "$copydir/chrootexec"
- arch-nspawn "$copydir" /chrootexec </dev/null
+ chroot-run "$copydir" /chrootexec </dev/null
;;
# Other
run)
- arch-nspawn "$copydir" "$@"
+ chroot-run "$copydir" "$@"
;;
enter)
- arch-nspawn "$copydir" bash
+ chroot-run "$copydir" bash
;;
clean-repo)
rm -rf "${copydir}"/repo/*
diff --git a/src/lib/.gitignore b/src/lib/.gitignore
index ec4ff7a..d12288a 100644
--- a/src/lib/.gitignore
+++ b/src/lib/.gitignore
@@ -2,4 +2,6 @@ common.sh
common.sh.in
archroot.sh
archroot.sh.in
+mount.sh
+mount.sh.in
conf.sh
diff --git a/src/lib/Makefile b/src/lib/Makefile
index 1871e19..7f23b32 100644
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -3,8 +3,8 @@ include $(topsrcdir)/build-aux/Makefile.head.mk
libretools.pkg = librelib
-libretools.src.devtools = common.sh.in archroot.sh.in
-libretools.out.libs += common.sh archroot.sh conf.sh
+libretools.src.devtools = common.sh.in archroot.sh.in mount.sh.in
+libretools.out.libs += common.sh archroot.sh mount.sh conf.sh
# Build ##############################################################