<commit_before>#!/bin/bash

# Create the build directory structure
mkdir -p ${BUILDDIR}/image/{CentOS,images,isolinux,ks,scripts}
mkdir -p ${BUILDDIR}/image/images/pxeboot
if [ $ELVERSION -eq 5 ] ; then
  mkdir -p ${BUILDDIR}/image/images/xen
fi
echo "$(date) - Created $BUILDDIR directory structure"

#Set the mirror to use for retrieving files
if [ -z "$CENTOSMIRROR" ] ; then
  FETCHMIRROR=`curl -s http://mirrorlist.centos.org/?release=${ELVERSION}\&arch=x86_64\&repo=os | grep -vE '(^#|^ftp)' | head -n 1`
else
  FETCHMIRROR="${CENTOSMIRROR}${ELVERSION}/os/x86_64/"
fi
echo "$(date) - Using $FETCHMIRROR for downloads"

# Retrieve the comps.xml file
echo "$(date) - Retrieving files"
COMPSFILE=`curl -s ${FETCHMIRROR}repodata/ | grep 'comps.xml\"' | sed -e 's/.*href=\"\(.*comps.xml\)\".*/\1/'`
wget ${FETCHMIRROR}/repodata/${COMPSFILE} > /dev/null 2>&1

# Retrieve the files for the root filesystem of the CD
wget ${FETCHMIRROR}/.discinfo -O image/.discinfo > /dev/null 2>&1

# Retrieve the files for the isolinux directory
COMMONFILES="
EULA
GPL
isolinux/boot.msg
isolinux/initrd.img
isolinux/isolinux.bin
isolinux/isolinux.cfg
isolinux/memtest
isolinux/vmlinuz
"
for FILE in $COMMONFILES ; do
wget ${FETCHMIRROR}/${FILE} -O image/${FILE} > /dev/null 2>&1
done

case "$ELVERSION" in
"5")
  ISOLINUXFILES="
isolinux/general.msg
isolinux/options.msg
isolinux/param.msg
isolinux/rescue.msg
isolinux/splash.lss
"
  ;;
"6")
  ISOLINUXFILES="
isolinux/grub.conf
isolinux/splash.jpg
isolinux/vesamenu.c32
"
  ;;
esac

for FILE in $ISOLINUXFILES ; do
wget ${FETCHMIRROR}/${FILE} -O image/${FILE} > /dev/null 2>&1
done

# Retrieve the files for the images directory
case "$ELVERSION" in
"5")
  IMAGESFILES="
README
boot.iso
minstg2.img
stage2.img
diskboot.img
xen/vmlinuz
xen/initrd.img
pxeboot/README
pxeboot/vmlinuz
pxeboot/initrd.img
"
  ;;
"6")
  IMAGESFILES="
efiboot.img
efidisk.img
install.img
pxeboot/initrd.img
pxeboot/vmlinuz
"
  ;;
esac

for FILE in $IMAGESFILES ; do
wget ${FETCHMIRROR}/images/${FILE} -O ./image/images/${FILE} > /dev/null 2>&1
done

# Fix anaconda bugs to allow copying files from CD during %post scripts in EL5, and network prompting in EL6
case "$ELVERSION" in
"5")
  mkdir tmp-anaconda-fix
  cd tmp-anaconda-fix
  mkdir anaconda
  mkdir anaconda-new
  mount -rw -t squashfs -o loop ${BUILDDIR}/image/images/stage2.img anaconda/
  cd anaconda
  tar cf - * .buildstamp | ( cd ${BUILDDIR}/tmp-anaconda-fix/anaconda-new; tar xfp -)
  cd ../anaconda-new
  umount ${BUILDDIR}/tmp-anaconda-fix/anaconda
  sed -i -e 's/    ("dopostaction", doPostAction, ),/#####/g' usr/lib/anaconda/dispatch.py
  sed -i -e 's/    ("methodcomplete", doMethodComplete, ),/    ("dopostaction", doPostAction, ),/g' usr/lib/anaconda/dispatch.py
  sed -i -e 's/#####/    ("methodcomplete", doMethodComplete, ),/g' usr/lib/anaconda/dispatch.py
  mksquashfs . ${BUILDDIR}/tmp-anaconda-fix/stage2.img.new -all-root -no-fragments > /dev/null 2>&1
  rm -f ${BUILDDIR}/image/images/stage2.img
  mv ${BUILDDIR}/tmp-anaconda-fix/stage2.img.new ${BUILDDIR}/image/images/stage2.img
  cd ${BUILDDIR}
  rm -rf tmp-anaconda-fix
  echo "$(date) - Created patched stage2.img"
  ;;
"6")
  # EL6 anaconda hacks to go here
  ;;
esac
<commit_msg>updates.img for EL5 instead of custom stage2.img<commit_after>#!/bin/bash

# Create the build directory structure
mkdir -p ${BUILDDIR}/image/{CentOS,images,isolinux,ks,scripts}
mkdir -p ${BUILDDIR}/image/images/pxeboot
if [ $ELVERSION -eq 5 ] ; then
  mkdir -p ${BUILDDIR}/image/images/xen
fi
echo "$(date) - Created $BUILDDIR directory structure"

#Set the mirror to use for retrieving files
if [ -z "$CENTOSMIRROR" ] ; then
  FETCHMIRROR=`curl -s http://mirrorlist.centos.org/?release=${ELVERSION}\&arch=x86_64\&repo=os | grep -vE '(^#|^ftp)' | head -n 1`
else
  FETCHMIRROR="${CENTOSMIRROR}${ELVERSION}/os/x86_64/"
fi
echo "$(date) - Using $FETCHMIRROR for downloads"

# Retrieve the comps.xml file
echo "$(date) - Retrieving files"
COMPSFILE=`curl -s ${FETCHMIRROR}repodata/ | grep 'comps.xml\"' | sed -e 's/.*href=\"\(.*comps.xml\)\".*/\1/'`
wget ${FETCHMIRROR}/repodata/${COMPSFILE} > /dev/null 2>&1

# Retrieve the files for the root filesystem of the CD
wget ${FETCHMIRROR}/.discinfo -O image/.discinfo > /dev/null 2>&1

# Retrieve the files for the isolinux directory
COMMONFILES="
EULA
GPL
isolinux/boot.msg
isolinux/initrd.img
isolinux/isolinux.bin
isolinux/isolinux.cfg
isolinux/memtest
isolinux/vmlinuz
"
for FILE in $COMMONFILES ; do
wget ${FETCHMIRROR}/${FILE} -O image/${FILE} > /dev/null 2>&1
done

case "$ELVERSION" in
"5")
  ISOLINUXFILES="
isolinux/general.msg
isolinux/options.msg
isolinux/param.msg
isolinux/rescue.msg
isolinux/splash.lss
"
  ;;
"6")
  ISOLINUXFILES="
isolinux/grub.conf
isolinux/splash.jpg
isolinux/vesamenu.c32
"
  ;;
esac

for FILE in $ISOLINUXFILES ; do
wget ${FETCHMIRROR}/${FILE} -O image/${FILE} > /dev/null 2>&1
done

# Retrieve the files for the images directory
case "$ELVERSION" in
"5")
  IMAGESFILES="
README
boot.iso
minstg2.img
stage2.img
diskboot.img
xen/vmlinuz
xen/initrd.img
pxeboot/README
pxeboot/vmlinuz
pxeboot/initrd.img
"
  ;;
"6")
  IMAGESFILES="
efiboot.img
efidisk.img
install.img
pxeboot/initrd.img
pxeboot/vmlinuz
"
  ;;
esac

for FILE in $IMAGESFILES ; do
wget ${FETCHMIRROR}/images/${FILE} -O ./image/images/${FILE} > /dev/null 2>&1
done

# Fix anaconda bugs to allow copying files from CD during %post scripts in EL5, and network prompting in EL6
case "$ELVERSION" in
"5")
  echo "$(date) - Creating updates.img"
  mkdir -p tmp-anaconda-updates/{stage2,updates}
  cd tmp-anaconda-updates
  mount -rw -t squashfs -o loop ${BUILDDIR}/image/images/stage2.img stage2
  dd if=/dev/zero of=updates.img bs=1K count=1 seek=127 > /dev/null 2>&1
  parted updates.img mklabel msdos
  mkfs.ext2 -F -L updates updates.img > /dev/null 2>&1
  losetup -f updates.img
  UPDATESLOOPDEVICE=`losetup -a | grep -E "updates.img" | awk '{print $1}' | sed 's/://g'`
  mount $UPDATESLOOPDEVICE updates
  cp stage2/usr/lib/anaconda/dispatch.py updates/
  sed -i -e 's/    ("dopostaction", doPostAction, ),/#####/g' updates/dispatch.py
  sed -i -e 's/    ("methodcomplete", doMethodComplete, ),/    ("dopostaction", doPostAction, ),/g' updates/dispatch.py
  sed -i -e 's/#####/    ("methodcomplete", doMethodComplete, ),/g' updates/dispatch.py
  umount stage2
  umount updates
  losetup -d $UPDATESLOOPDEVICE
  mv updates.img ${BUILDDIR}/image/images/
  cd ${BUILDDIR}
  rm -rf tmp-anaconda-fix
  echo "$(date) - Created updates.img"
  ;;
"6")
  # EL6 anaconda hacks to go here
  ;;
esac

{'fraction_non_alphanumeric': 0.15627382222899833, 'fraction_numerical': 0.014331452965391065, 'mean_word_length': 4.015290519877676, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7133136', 'n_tokens_mistral': 2772, 'n_tokens_neox': 2629, 'n_words': 627}