0
0
mirror of https://github.com/termux/proot-distro.git synced 2024-11-13 13:59:19 +00:00
proot-distro/distro-build/void.sh
Leonid Pliushch d5797cf821
ensure that rootfs tarballs usability for standard chroots
Make sure all xattrs are preserved in the archive.
2023-12-19 21:43:29 +02:00

62 lines
2.9 KiB
Bash

dist_name="Void Linux"
dist_version="20230628"
bootstrap_distribution() {
sudo rm -f "${ROOTFS_DIR}"/void-*.tar.xz
for arch in aarch64 armv7l i686 x86_64; do
curl --fail --location \
--output "${WORKDIR}/void-${arch}.tar.xz" \
"https://repo-default.voidlinux.org/live/${dist_version}/void-${arch}-ROOTFS-${dist_version}.tar.xz"
sudo rm -rf "${WORKDIR}/void-$(translate_arch "$arch")"
sudo mkdir -m 755 "${WORKDIR}/void-$(translate_arch "$arch")"
sudo tar -Jxp --acls --xattrs --xattrs-include='*' \
-f "${WORKDIR}/void-${arch}.tar.xz" \
-C "${WORKDIR}/void-$(translate_arch "$arch")"
cat <<- EOF | sudo unshare -mpf bash -e -
rm -f "${WORKDIR}/void-$(translate_arch "$arch")/etc/resolv.conf"
echo "nameserver 1.1.1.1" > "${WORKDIR}/void-$(translate_arch "$arch")/etc/resolv.conf"
mount --bind /dev "${WORKDIR}/void-$(translate_arch "$arch")/dev"
mount --bind /proc "${WORKDIR}/void-$(translate_arch "$arch")/proc"
mount --bind /sys "${WORKDIR}/void-$(translate_arch "$arch")/sys"
chroot "${WORKDIR}/void-$(translate_arch "$arch")" env SSL_NO_VERIFY_PEER=1 xbps-install -Suy xbps
chroot "${WORKDIR}/void-$(translate_arch "$arch")" env SSL_NO_VERIFY_PEER=1 xbps-install -uy
chroot "${WORKDIR}/void-$(translate_arch "$arch")" env SSL_NO_VERIFY_PEER=1 xbps-install -y base-minimal
chroot "${WORKDIR}/void-$(translate_arch "$arch")" xbps-remove -y base-voidstrap
chroot "${WORKDIR}/void-$(translate_arch "$arch")" xbps-reconfigure -fa
EOF
sudo rm -f "${WORKDIR}/void-$(translate_arch "$arch")"/var/cache/xbps/* || true
archive_rootfs "${ROOTFS_DIR}/void-$(translate_arch "$arch")-pd-${CURRENT_VERSION}.tar.xz" \
"void-$(translate_arch "$arch")"
done
}
write_plugin() {
cat <<- EOF > "${PLUGIN_DIR}/void.sh"
# This is a default distribution plug-in.
# Do not modify this file as your changes will be overwritten on next update.
# If you want customize installation, please make a copy.
DISTRO_NAME="Void Linux"
TARBALL_URL['aarch64']="${GIT_RELEASE_URL}/void-aarch64-pd-${CURRENT_VERSION}.tar.xz"
TARBALL_SHA256['aarch64']="$(sha256sum "${ROOTFS_DIR}/void-aarch64-pd-${CURRENT_VERSION}.tar.xz" | awk '{ print $1}')"
TARBALL_URL['arm']="${GIT_RELEASE_URL}/void-arm-pd-${CURRENT_VERSION}.tar.xz"
TARBALL_SHA256['arm']="$(sha256sum "${ROOTFS_DIR}/void-arm-pd-${CURRENT_VERSION}.tar.xz" | awk '{ print $1}')"
TARBALL_URL['i686']="${GIT_RELEASE_URL}/void-i686-pd-${CURRENT_VERSION}.tar.xz"
TARBALL_SHA256['i686']="$(sha256sum "${ROOTFS_DIR}/void-i686-pd-${CURRENT_VERSION}.tar.xz" | awk '{ print $1}')"
TARBALL_URL['x86_64']="${GIT_RELEASE_URL}/void-x86_64-pd-${CURRENT_VERSION}.tar.xz"
TARBALL_SHA256['x86_64']="$(sha256sum "${ROOTFS_DIR}/void-x86_64-pd-${CURRENT_VERSION}.tar.xz" | awk '{ print $1}')"
distro_setup() {
${TAB}# Set default shell to bash.
${TAB}run_proot_cmd usermod --shell /bin/bash root
${TAB}# Fix issue where come CA certificates links may not be created.
${TAB}run_proot_cmd update-ca-certificates --fresh
}
EOF
}