From 3ce492040bc1c54f4041c9073730b7579d694871 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Sun, 29 Oct 2023 16:53:49 +0100 Subject: [PATCH 1/2] Add indication on interactive chroot shells --- misc-tools/dj_make_chroot.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/misc-tools/dj_make_chroot.in b/misc-tools/dj_make_chroot.in index 2db94ce5cb..69f74553da 100755 --- a/misc-tools/dj_make_chroot.in +++ b/misc-tools/dj_make_chroot.in @@ -310,6 +310,11 @@ if [ -n "$WORKDIR" ] && [ -d "$WORKDIR" ]; then rm -rf "$WORKDIR" fi +# Add indication to interactive shell that the user is in the chroot +for bashrc in "root/.bashrc" "etc/bash.bashrc"; do + echo 'PS1=(chroot)$PS1' >> "$CHROOTDIR/$bashrc" +done + rm -f "$CHROOTDIR/etc/resolv.conf" cp /etc/resolv.conf /etc/hosts /etc/hostname "$CHROOTDIR/etc" || true cp /etc/ssl/certs/ca-certificates.crt "$CHROOTDIR/etc/ssl/certs/" || true From e1c3b7c5be76473cc2311b5bc0e210d89a1da172 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Sun, 29 Oct 2023 17:48:19 +0100 Subject: [PATCH 2/2] Explicit mention the difference between run_chroot and when judging. 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). --- misc-tools/dj_run_chroot.in | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/misc-tools/dj_run_chroot.in b/misc-tools/dj_run_chroot.in index c63197409b..f330468841 100755 --- a/misc-tools/dj_run_chroot.in +++ b/misc-tools/dj_run_chroot.in @@ -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 <