<commit_before>#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

CUR_TIME=`date +%FT%TZ`
CUSTOM_RPMS=./RPMS
DVD_LAYOUT=./centos-7-iso-layout
DVD_TITLE='CentOS-7-Joyent'
ISO=CentOS-7-x86_64-Minimal.iso
ISO_DIR=/data/fetched-iso
ISO_FILENAME=./centos-7-joyent.iso
KS_CFG=./ks.cfg
GUESTTOOLS=sdc-vmtools
MIRROR=http://buildlogs.centos.org/rolling/7/isos/x86_64
MOUNT_POINT=/mnt/centos7

function fetch_iso() {
    if [ ! -d $ISO_DIR ]; then
        mkdir -p $ISO_DIR
    fi
    
    if [ ! -e $ISO_DIR/$ISO ]; then
        echo "No local copy of $ISO. Fetching latest $ISO"
        curl -s -o $ISO_DIR/$ISO $MIRROR/$ISO
    fi
    
    echo "Checking to see if we have the latest $ISO:"
    echo "  Getting checksum"
    curl -s -O $MIRROR/sha256sum.txt
    
    ISO_NAME=$(echo $ISO | cut -f1 -d'.')
    CHECKSUM=$(grep $ISO_NAME sha256sum.txt | cut -f1 -d' ')
    
    if [[ $(sha256sum $ISO_DIR/$ISO | cut -f1 -d' ') == "$CHECKSUM" ]]; then
        echo "  Checksums match, using local copy of $ISO"
    else
        echo "  Checksums do not match. Fetching latest $ISO"
        curl -s -o $ISO_DIR/$ISO $MIRROR/$ISO
    fi
}

function create_layout() {
    echo "Creating ISO Layout"
    if [ -d $DVD_LAYOUT ]; then
        echo "Layout $DVD_LAYOUT exists...nuking"
        rm -rf $DVD_LAYOUT
    fi
    echo "Creating $DVD_LAYOUT"
    mkdir -p $DVD_LAYOUT

    # Check if $MOUNT_POINT is already mounted
    # This may happen if a previous build failed
    if [ $(grep $MOUNT_POINT /proc/mounts) ]; then
      echo "Unmounting $MOUNT_POINT from previous build..."
        umount $MOUNT_POINT
    fi

    echo "Mounting $ISO to $MOUNT_POINT"
    if [ ! -d $MOUNT_POINT ]; then
        echo "Creating $MOUNT_POINT..."
        mkdir $MOUNT_POINT
    fi
    mount $ISO_DIR/$ISO $MOUNT_POINT -o loop
    pushd $MOUNT_POINT > /dev/null 2>&1
    echo "Populating Layout"
    tar cf - . | tar xpf - -C $DVD_LAYOUT
    popd > /dev/null 2>&1
    umount $MOUNT_POINT
    
    if [ -d $CUSTOM_RPMS ]; then
        echo "Copying custom RPMS"
        find $CUSTOM_RPMS -type f -exec cp {} $DVD_LAYOUT/Packages \;
    fi
    
    echo "Finished Populating Layout"
}

function copy_ks_cfg() {
    echo "Copying Kickstart file"
    cp $KS_CFG $DVD_LAYOUT/
}
<commit_msg>Fix path again<commit_after>#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

CUR_TIME=`date +%FT%TZ`
CUSTOM_RPMS=./RPMS
DVD_LAYOUT=centos-7-iso-layout
DVD_TITLE='CentOS-7-Joyent'
ISO=CentOS-7-x86_64-Minimal.iso
ISO_DIR=/data/fetched-iso
ISO_FILENAME=./centos-7-joyent.iso
KS_CFG=./ks.cfg
GUESTTOOLS=sdc-vmtools
MIRROR=http://buildlogs.centos.org/rolling/7/isos/x86_64
MOUNT_POINT=/mnt/centos7

function fetch_iso() {
    if [ ! -d $ISO_DIR ]; then
        mkdir -p $ISO_DIR
    fi
    
    if [ ! -e $ISO_DIR/$ISO ]; then
        echo "No local copy of $ISO. Fetching latest $ISO"
        curl -s -o $ISO_DIR/$ISO $MIRROR/$ISO
    fi
    
    echo "Checking to see if we have the latest $ISO:"
    echo "  Getting checksum"
    curl -s -O $MIRROR/sha256sum.txt
    
    ISO_NAME=$(echo $ISO | cut -f1 -d'.')
    CHECKSUM=$(grep $ISO_NAME sha256sum.txt | cut -f1 -d' ')
    
    if [[ $(sha256sum $ISO_DIR/$ISO | cut -f1 -d' ') == "$CHECKSUM" ]]; then
        echo "  Checksums match, using local copy of $ISO"
    else
        echo "  Checksums do not match. Fetching latest $ISO"
        curl -s -o $ISO_DIR/$ISO $MIRROR/$ISO
    fi
}

function create_layout() {
    echo "Creating ISO Layout"
    if [ -d $DVD_LAYOUT ]; then
        echo "Layout $DVD_LAYOUT exists...nuking"
        rm -rf $DVD_LAYOUT
    fi
    echo "Creating $DVD_LAYOUT"
    mkdir -p $DVD_LAYOUT

    # Check if $MOUNT_POINT is already mounted
    # This may happen if a previous build failed
    if [ $(grep $MOUNT_POINT /proc/mounts) ]; then
      echo "Unmounting $MOUNT_POINT from previous build..."
        umount $MOUNT_POINT
    fi

    echo "Mounting $ISO to $MOUNT_POINT"
    if [ ! -d $MOUNT_POINT ]; then
        echo "Creating $MOUNT_POINT..."
        mkdir $MOUNT_POINT
    fi
    mount $ISO_DIR/$ISO $MOUNT_POINT -o loop
    pushd $MOUNT_POINT > /dev/null 2>&1
    echo "Populating Layout"
    tar cf - . | tar xpf - -C $PWD/$DVD_LAYOUT
    popd > /dev/null 2>&1
    umount $MOUNT_POINT
    
    if [ -d $CUSTOM_RPMS ]; then
        echo "Copying custom RPMS"
        find $CUSTOM_RPMS -type f -exec cp {} $DVD_LAYOUT/Packages \;
    fi
    
    echo "Finished Populating Layout"
}

function copy_ks_cfg() {
    echo "Copying Kickstart file"
    cp $KS_CFG $DVD_LAYOUT/
}

{'fraction_non_alphanumeric': 0.12571934484285083, 'fraction_numerical': 0.013280212483399735, 'mean_word_length': 2.439117199391172, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '189927', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1740, 'n_words': 452}