summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2024-02-16 00:31:35 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2024-02-16 00:38:55 +0100
commit4e00c58176e18604f7608099390a04c9de1036a2 (patch)
tree9bdad3a41e91b89a262790715c43fec55acdc47f
parent75ada381c3b1554d3daf9d6031f40018b5068423 (diff)
Adapt to arch-nspawn replacement by chroot-run.GNUtoo/various-fixes
When building from git, since the commit 6d5a55989216ac0545d8ac0fd10215b1608ef980 ("replace arch-nspawn with chroot-run (nonsystemd compat)") in devtools-par (https://git.parabola.nu/packages/devtools-par.git) we have the following build error: make[1]: *** No rule to make target 'src/chroot-tools/arch-nspawn.in', needed by 'src/chroot-tools/arch-nspawn'. Stop. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--src/chroot-tools/.gitignore2
-rw-r--r--src/chroot-tools/Makefile4
-rwxr-xr-xsrc/chroot-tools/librechroot60
3 files changed, 33 insertions, 33 deletions
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 1c76661..d892d19 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -42,19 +42,19 @@ umask 0022
# 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=()
+extra_chroot_run_flags=()
-hack_arch_nspawn_flags() {
+hack_chroot_run_flags() {
local copydir="$1"
local makepkg_conf="$copydir/etc/makepkg.conf"
OPTIND=1
- set -- "${arch_nspawn_flags[@]}"
+ set -- "${chroot_run_flags[@]}"
while getopts 'hC:M:c:f:s' arg; do
case "$arg" in
M) makepkg_conf="$OPTARG" ;;
@@ -94,22 +94,22 @@ hack_arch_nspawn_flags() {
fi
# Let qemu/binfmt_misc do its thing
- arch_nspawn_flags+=(-f "$interpreter" -s)
+ chroot_run_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[@]}")
- hack_arch_nspawn_flags "$copydir"
+ local chroot_run_flags=("${chroot_run_flags[@]}")
+ hack_chroot_run_flags "$copydir"
- "$_arch_nspawn" \
- "${arch_nspawn_flags[@]}" \
+ "$_chroot_run" \
+ "${chroot_run_flags[@]}" \
"$copydir" \
- "${sysd_nspawn_flags[@]}" \
+ "${extra_chroot_run_flags[@]}" \
-- \
"${cmd[@]}"
}
@@ -119,13 +119,13 @@ mkarchroot() {
local copydir=$1; shift
local pkgs=("$@")
- local arch_nspawn_flags=("${arch_nspawn_flags[@]}")
- hack_arch_nspawn_flags "$copydir"
+ local chroot_run_flags=("${chroot_run_flags[@]}")
+ hack_chroot_run_flags "$copydir"
local cmd=(
unshare -m "$_mkarchroot"
# mkarchroot flags: (flags are very similar to arch-nspawn)
- "${arch_nspawn_flags[@]}"
+ "${chroot_run_flags[@]}"
# chroot directory:
-- "$copydir"
# pacman flags:
@@ -240,8 +240,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 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.'
@@ -314,8 +314,8 @@ main() {
case $opt in
n) CHROOT=$OPTARG;;
l) COPY=$OPTARG;;
- N) sysd_nspawn_flags+=(--private-network);;
- C|M) arch_nspawn_flags+=(-$opt "$OPTARG");;
+ N) extra_chroot_run_flags+=(--private-network);;
+ C|M) chroot_run_flags+=(-$opt "$OPTARG");;
A)
if ! [[ -f "/usr/share/pacman/defaults/pacman.conf.$OPTARG" && -f "/usr/share/pacman/defaults/makepkg.conf.$OPTARG" ]]; then
error 'Unsupported architecture: %s' "$OPTARG"
@@ -334,12 +334,12 @@ main() {
'\n\n# Enable the volatile arm [aur] repo only as needed.' \
'\n#[aur]\n#Server = https://mirror.archlinuxarm.org/$arch/$repo/' \
>> "$tmppacmanconf"
- arch_nspawn_flags+=(
+ chroot_run_flags+=(
-C "$tmppacmanconf"
-M "/usr/share/pacman/defaults/makepkg.conf.$OPTARG"
);;
- w) sysd_nspawn_flags+=("--bind=$OPTARG");;
- r) sysd_nspawn_flags+=("--bind-ro=$OPTARG");;
+ w) extra_chroot_run_flags+=("--bind=$OPTARG");;
+ r) extra_chroot_run_flags+=("--bind-ro=$OPTARG");;
*) usage >&2; return $EXIT_INVALIDARGUMENT;;
esac
used_opts[$opt]+=1
@@ -474,12 +474,12 @@ 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
if [[ -n ${tmppacmanconf:-} ]]; then
rm -f -- "$tmppacmanconf"
fi
trap EXIT # clear the trap to remove the tmp pacman.conf from -A
- arch_nspawn_flags=() # XXX dirty hack, don't apply -C or -M again
+ chroot_run_flags=() # XXX dirty hack, don't apply -C or -M again
fi
########################################################################
@@ -499,10 +499,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
@@ -514,15 +514,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/*