diff --git a/xbps-builder/Dockerfile b/xbps-builder/Dockerfile index 627a11d..e130607 100644 --- a/xbps-builder/Dockerfile +++ b/xbps-builder/Dockerfile @@ -1,4 +1,4 @@ FROM d.xr.to/base:glibc COPY files/* /opt/dxrto/ -RUN chmod a+x /opt/dxrto/setup-fakedchroot /opt/dxrto/fakedchroot.sh /opt/dxrto/xbps-build && /opt/dxrto/setup-fakedchroot && ln -s /opt/dxrto/xbps-build /bin/xbps-build +RUN chmod a+x /opt/dxrto/setup-fakedchroot /opt/dxrto/xbps-build && /opt/dxrto/setup-fakedchroot && ln -s /opt/dxrto/xbps-build /bin/xbps-build WORKDIR '/_workdir' diff --git a/xbps-builder/files/fakedchroot.sh b/xbps-builder/files/fakedchroot.sh deleted file mode 100644 index 18f97d4..0000000 --- a/xbps-builder/files/fakedchroot.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# -# This chroot script uses bad design -# -fake_mount() { - # - # Fake mount works by removing the dir, and replacing it with a symlink - # This created the illusion of a bind. - # - - local FROM="$1"; - local TO="$2" - if [ -d "$TO" ]; then - rmdir "$TO"; - fi - ln -s "$FROM" "$TO"; -} - -fake_umount() { - # - # Remove the symlink and recreate the dir - # - rm "$1"; - mkdir "$1"; -} - -readonly MASTERDIR="$1" -readonly DISTDIR="$2" -readonly HOSTDIR="$3" -readonly EXTRA_ARGS="$4" -readonly CMD="$5" -shift 5 - -if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then - echo "$0 MASTERDIR/DISTDIR not set" - exit 1 -fi - -fake_mount $DISTDIR $MASTERDIR/void-packages; - -if [ ! -z "$HOSTDIR" ]; then - fake_mount $HOSTDIR $MASTERDIR/host; -fi - -ITEMS=""; -# xbps-src may send some other binds, parse them here -while getopts 'b:' c -- "$EXTRA_ARGS"; do - # Skip everything that's not a bind - [ "$c" = "b" ] || continue; - - _FROM="$(cut -d: -f1 <<< "$OPTARG")"; - _TO="$(cut -d: -f2 <<< "$OPTARG")"; - fake_mount "${_FROM}" "${_TO}"; - # Save created mounts so we can clean them up later - ITEMS+="${_TO} " -done - -CURR_DIR="${PWD}"; -# To give the illusion we entered the chroot, cd to / -cd /; -# Tell xbps-src that we are "in the chroot". -IN_CHROOT=1 $CMD $@; -# Save exit code for after clean up -X="$?"; -# cd back to the old pwd, so everything is the same again -cd "$CURR_DIR"; - -if [ ! -z "$HOSTDIR" ]; then - fake_umount $MASTERDIR/host; -fi - -fake_umount $MASTERDIR/void-packages; - -# "umount" on demand created "mounts" -for i in $ITEMS; do - fake_umount "$i"; -done - -# Exit with the returned exit code -exit "$X"; diff --git a/xbps-builder/files/setup-fakedchroot b/xbps-builder/files/setup-fakedchroot index 5dafe0b..a196e72 100644 --- a/xbps-builder/files/setup-fakedchroot +++ b/xbps-builder/files/setup-fakedchroot @@ -1,37 +1,25 @@ #!/usr/bin/env bash set -e; -if [ "$1" == "--fix" ]; then - sed -i 's:check_installed_pkg base-chroot-0.1_1:true:' common/xbps-src/shutils/common.sh; - exit $? -fi - readonly WORKDIR="/_workdir" # Install base utils required for downloading latest void packages and running xbps-src -xbps-install -Sy xtools base-devel chroot-git chroot-util-linux tar wget coreutils +xbps-remote xtools base-devel chroot-git chroot-util-linux tar wget coreutils # Clone void-packages into workdir, with depth 1, as template history is irrelevant git clone --depth 1 'https://github.com/void-linux/void-packages.git' "${WORKDIR}"; cd "${WORKDIR}"; -# Copy fakedchroot chroot style into chroot-style dir and make it executable -ln -s /opt/dxrto/fakedchroot.sh "${WORKDIR}/common/chroot-style/fakedchroot.sh"; - # If masterdir exists: remove it, because we will replace it with a symlink if [ -d "${WORKDIR}/masterdir" ]; then rm "${WORKDIR}/masterdir"; fi + # Make $WORKDIR/masterdir point to / ln -s / "${WORKDIR}/masterdir"; -# Tell xbps-src to used our new chroot style: fakedchroot -echo XBPS_CHROOT_CMD=fakedchroot >> etc/conf; - -# Tell xbps-src we init'd the chroot -touch "${WORKDIR}/masterdir/.xbps_chroot_init" - -# Since base-chroot has some conflicts with a normal base, replace the check with true -sed -i 's:check_installed_pkg base-chroot-0.1_1:true:' common/xbps-src/shutils/common.sh +# Tell xbps-src to use the ehtereal build style +echo XBPS_CHROOT_CMD=ethereal >> etc/conf; +echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf # Install the non-conflicting dependencies of base-chroot anyway xbps-install -Sy $(xbps-query -Rx base-chroot | grep -v 'bash\|texinfo'); diff --git a/xbps-builder/files/xbps-build b/xbps-builder/files/xbps-build index 01375fc..6b63b4a 100644 --- a/xbps-builder/files/xbps-build +++ b/xbps-builder/files/xbps-build @@ -6,7 +6,5 @@ cd /_workdir; echo "Updating srcpkgs"; git checkout .; git pull --ff; -echo "Fixing fakedchroot"; -/opt/dxrto/setup-fakedchroot --fix; echo "Running build"; ./xbps-src pkg "$@";