2 Commits

Author SHA1 Message Date
Martchus b981c6afe8 Add builduser to same groups as on host 2 months ago
Martchus 401609212e Log systemd-nspawn invocation parameters 2 months ago
  1. 5
      arch-nspawn.in
  2. 7
      makechrootpkg.in

5
arch-nspawn.in

@ -127,7 +127,9 @@ eval "$(grep -a '^CARCH=' "$working_dir/etc/makepkg.conf")"
[[ -z $nosetarch ]] || unset CARCH
exec systemd-nspawn -q \
for p in echo exec; do
[[ $p == echo ]] && msg "Entering chroot \"$working_dir\" via:"
"$p" systemd-nspawn -q \
-D "$working_dir" \
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
--register=no \
@ -136,3 +138,4 @@ exec systemd-nspawn -q \
--resolv-conf=copy-host \
"${mount_args[@]}" \
"$@"
done

7
makechrootpkg.in

@ -159,6 +159,7 @@ prepare_chroot() {
local builduser_uid builduser_gid
builduser_uid="$(id -u "$makepkg_user")"
builduser_gid="$(id -g "$makepkg_user")"
builduser_gids="$(id -G "$makepkg_user")"
local install="install -o $builduser_uid -g $builduser_gid"
local x
@ -167,6 +168,12 @@ prepare_chroot() {
# an x86_64 host).
sed -e '/^builduser:/d' -i "$copydir"/etc/{passwd,shadow,group}
printf >>"$copydir/etc/group" 'builduser:x:%d:\n' "$builduser_gid"
for gid in $builduser_gids; do
if [[ $gid != $builduser_gid ]]; then
group_name=$(getent group "$gid" | cut -d: -f1)
printf >>"$copydir/etc/group" "$group_name:x:%d:builduser\n" "$gid"
fi
done
printf >>"$copydir/etc/passwd" 'builduser:x:%d:%d:builduser:/build:/bin/bash\n' "$builduser_uid" "$builduser_gid"
printf >>"$copydir/etc/shadow" 'builduser:!!:%d::::::\n' "$(( $(date -u +%s) / 86400 ))"

Loading…
Cancel
Save