fix: Chroot pkg (#3870)
* fix: chroot build for buster: error when calculating dependencies * Initialize environment variables when calling chroot * fix: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
This commit is contained in:
parent
a1acdc95de
commit
315a48a16b
@ -40,7 +40,7 @@ create_chroot()
|
||||
components['focal']='main,universe,multiverse'
|
||||
components['jammy']='main,universe,multiverse'
|
||||
display_alert "Creating build chroot" "$release/$arch" "info"
|
||||
local includes="ccache,locales,git,ca-certificates,devscripts,libfile-fcntllock-perl,debhelper,rsync,python3,distcc,apt-utils"
|
||||
local includes="ccache,locales,git,ca-certificates,libfile-fcntllock-perl,rsync,python3,distcc,apt-utils"
|
||||
|
||||
# perhaps a temporally workaround
|
||||
case $release in
|
||||
@ -72,9 +72,15 @@ create_chroot()
|
||||
mkdir -p "${target_dir}"/usr/share/keyrings/ && \
|
||||
cp /usr/share/keyrings/debian-archive-keyring.gpg "${target_dir}"/usr/share/keyrings/
|
||||
|
||||
chroot "${target_dir}" /bin/bash -c "/debootstrap/debootstrap --second-stage"
|
||||
eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
|
||||
/bin/bash -c "/debootstrap/debootstrap --second-stage"'
|
||||
[[ $? -ne 0 || ! -f "${target_dir}"/bin/bash ]] && exit_with_error "Create chroot second stage failed"
|
||||
|
||||
[[ -f "${target_dir}"/etc/locale.gen ]] && \
|
||||
sed -i '/en_US.UTF-8/s/^# //g' "${target_dir}"/etc/locale.gen
|
||||
eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
|
||||
/bin/bash -c "locale-gen; update-locale --reset LANG=en_US.UTF-8"'
|
||||
|
||||
create_sources_list "$release" "${target_dir}"
|
||||
[[ $NO_APT_CACHER != yes ]] && \
|
||||
echo 'Acquire::http { Proxy "http://localhost:3142"; };' > "${target_dir}"/etc/apt/apt.conf.d/02proxy
|
||||
@ -83,10 +89,6 @@ create_chroot()
|
||||
APT::Install-Suggests "0";
|
||||
EOF
|
||||
|
||||
[[ -f "${target_dir}"/etc/locale.gen ]] && \
|
||||
sed -i '/en_US.UTF-8/s/^# //g' "${target_dir}"/etc/locale.gen
|
||||
chroot "${target_dir}" /bin/bash -c "locale-gen; update-locale --reset LANG=en_US.UTF-8"
|
||||
|
||||
printf '#!/bin/sh\nexit 101' > "${target_dir}"/usr/sbin/policy-rc.d
|
||||
chmod 755 "${target_dir}"/usr/sbin/policy-rc.d
|
||||
rm "${target_dir}"/etc/resolv.conf 2>/dev/null
|
||||
@ -98,15 +100,26 @@ create_chroot()
|
||||
rm -rf "${target_dir}"/var/lock 2>/dev/null
|
||||
mkdir -p "${target_dir}"/var/lock
|
||||
fi
|
||||
chroot "${target_dir}" /bin/bash -c "/usr/sbin/update-ccache-symlinks"
|
||||
eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
|
||||
/bin/bash -c "/usr/sbin/update-ccache-symlinks"'
|
||||
|
||||
display_alert "Upgrading packages in" "${target_dir}" "info"
|
||||
chroot "${target_dir}" /bin/bash -c "apt-get -q update; apt-get -q -y upgrade; apt-get clean"
|
||||
eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
|
||||
/bin/bash -c "apt-get -q update; apt-get -q -y upgrade; apt-get clean"'
|
||||
date +%s >"$target_dir/root/.update-timestamp"
|
||||
|
||||
# Install some packages with a large list of dependencies after the update.
|
||||
# This optimizes the process and eliminates looping when calculating
|
||||
# dependencies.
|
||||
eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
|
||||
/bin/bash -c "apt-get install \
|
||||
-q -y --no-install-recommends debhelper devscripts"'
|
||||
|
||||
|
||||
case $release in
|
||||
bullseye|focal|hirsute|sid)
|
||||
chroot "${target_dir}" /bin/bash -c "apt-get install python-is-python3"
|
||||
eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
|
||||
/bin/bash -c "apt-get install python-is-python3"'
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user