<commit_before>#
# Helper to install packages into a sandbox in masterdir.
# Actually this needs the xbps-base-chroot package installed.
#

# Umount stuff if SIGINT or SIGQUIT was caught
trap umount_chroot_fs INT QUIT

check_installed_pkg xbps-base-chroot 0.1
if [ $? -ne 0 ]; then
	echo "*** ERROR: xbps-base-chroot pkg not installed ***"
	exit 1
fi

if [ "$(id -u)" -ne 0 ]; then
	echo "*** ERROR: you must be root to use this target ***"
	exit 1
fi

echo -n "=> Preparing sandbox on $XBPS_MASTERDIR... "

if [ ! -x $XBPS_MASTERDIR/bin/sh ]; then
	cd $XBPS_MASTERDIR/bin && ln -s bash sh
fi

if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
	chown -R root:root $XBPS_MASTERDIR/*
	chmod +s $XBPS_MASTERDIR/usr/libexec/pt_chown
	cp -af /etc/passwd /etc/shadow /etc/group /etc/hosts $XBPS_MASTERDIR/etc
	touch $XBPS_MASTERDIR/.xbps_perms_done
fi

for f in bin sbin tmp var sys proc dev xbps; do
	[ ! -d $XBPS_MASTERDIR/$f ] && mkdir -p $XBPS_MASTERDIR/$f
done

for f in sys proc dev; do
	if [ ! -f $XBPS_MASTERDIR/.${f}_mount_bind_done ]; then
		mount -o bind /$f $XBPS_MASTERDIR/$f
		[ $? -eq 0 ] && touch $XBPS_MASTERDIR/.${f}_mount_bind_done
	fi
done

if [ ! -f $XBPS_MASTERDIR/.xbps_mount_bind_done ]; then
	mount -o bind $XBPS_DISTRIBUTIONDIR $XBPS_MASTERDIR/xbps<commit_msg>Make /usr/bin/cc link to gcc in the chroot.<commit_after>#
# Helper to install packages into a sandbox in masterdir.
# Actually this needs the xbps-base-chroot package installed.
#

# Umount stuff if SIGINT or SIGQUIT was caught
trap umount_chroot_fs INT QUIT

check_installed_pkg xbps-base-chroot 0.1
if [ $? -ne 0 ]; then
	echo "*** ERROR: xbps-base-chroot pkg not installed ***"
	exit 1
fi

if [ "$(id -u)" -ne 0 ]; then
	echo "*** ERROR: you must be root to use this target ***"
	exit 1
fi

echo -n "=> Preparing sandbox on $XBPS_MASTERDIR... "

if [ ! -x $XBPS_MASTERDIR/bin/sh ]; then
	cd $XBPS_MASTERDIR/bin && ln -s bash sh
fi

if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
	chown -R root:root $XBPS_MASTERDIR/*
	chmod +s $XBPS_MASTERDIR/usr/libexec/pt_chown
	cp -af /etc/passwd /etc/shadow /etc/group /etc/hosts $XBPS_MASTERDIR/etc
	touch $XBPS_MASTERDIR/.xbps_perms_done
fi

if [ ! -h $XBPS_MASTERDIR/usr/bin/cc ]; then
	cd $XBPS_MASTERDIR/usr/bin && ln -s gcc cc
fi

for f in bin sbin tmp var sys proc dev xbps; do
	[ ! -d $XBPS_MASTERDIR/$f ] && mkdir -p $XBPS_MASTERDIR/$f
done

for f in sys proc dev; do
	if [ ! -f $XBPS_MASTERDIR/.${f}_mount_bind_done ]; then
		mount -o bind /$f $XBPS_MASTERDIR/$f
		[ $? -eq 0 ] && touch $XBPS_MASTERDIR/.${f}_mount_bind_done
	fi
done

if [ ! -f $XBPS_MASTERDIR/.xbps_mount_bind_done ]; then
	mount -o bind $XBPS_DISTRIBUTIONDIR $XBPS_MASTERDIR/xbps
{'fraction_non_alphanumeric': 0.1277467411545624, 'fraction_numerical': 0.0052141527001862194, 'mean_word_length': 3.6470588235294117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3811419', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1129, 'n_words': 319}