Skip to content

Commit

Permalink
Explicit mention the difference between run_chroot and when judging.
Browse files Browse the repository at this point in the history
We add a mention of the current list for convenience but point the user
to the correct file in case the admin decides to mount more (or less).
  • Loading branch information
vmcj committed Feb 12, 2024
1 parent 64ab6d4 commit ebb27bb
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions misc-tools/dj_run_chroot.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ trap cleanup EXIT
# Default directory where the chroot tree lives:
CHROOTDIR="@judgehost_chrootdir@"

# Gather which dirs will be mounted during judgement.
# (optional lib64 only needed for amd64 architecture)
SUBDIRMOUNTS="etc usr lib bin"
if [ "$(uname -m)" = "x86_64" ]; then
SUBDIRMOUNTS="$SUBDIRMOUNTS lib64"
fi

CONCAT_SUBDIRMOUNTS=""
for subdir in $SUBDIRMOUNTS
do
CONCAT_SUBDIRMOUNTS="${SUBDIRMOUNTS:+${CONCAT_SUBDIRMOUNTS}, }${subdir}"
done

usage()
{
cat <<EOF
Expand All @@ -44,6 +57,9 @@ into the chroot tree, and then e.g. run:
sudo dj_run_chroot "dpkg -i /path/inside/chroot/package_x.y.z_amd64.deb"
Beware that only [$CONCAT_SUBDIRMOUNTS] are mounted inside the chroot!
For the current list see the chroot-start-stop.sh in case of issues.
EOF
}

Expand Down Expand Up @@ -93,9 +109,9 @@ mount --bind /dev/pts "$CHROOTDIR/dev/pts"
# Prevent perl locale warnings in the chroot:
export LC_ALL=C

[ -n "$INTERACTIVE" ] && echo "Entering chroot in '$CHROOTDIR'."

if [ -n "$INTERACTIVE" ]; then
echo "Entering chroot in '$CHROOTDIR'."
echo "Only [$CONCAT_SUBDIRMOUNTS] will be mounted during judgement. See chroot-start-stop.sh for the current list."
chroot "$CHROOTDIR"
else
chroot "$CHROOTDIR" /bin/sh -c "$*"
Expand Down

0 comments on commit ebb27bb

Please sign in to comment.