<commit_before>#!/bin/bash

NAME="ROCK"
VERSION="2.0"
RELEASE="1"
ARCH="x86_64"
KICKSTART="ks.cfg"
TIMESTAMP=$(date +%y%m%d_%H%M%S)
SCRIPT_DIR=$(dirname $(readlink -f $0))

. ./offline-snapshot.sh

function cleanup() {
  umount $TMP_ISO
  [ -d ${TMP_ISO} ] && rm -rf ${TMP_ISO}
  [ -d ${TMP_NEW} ] && rm -rf ${TMP_NEW}
  [ -d ${TMP_RPMDB} ] && rm -rf ${TMP_RPMDB}
}

TMP_ISO=$(mktemp -d)
TMP_NEW=$(mktemp -d)
TMP_RPMDB=$(mktemp -d)

trap cleanup EXIT

function check_depends() {

  which mkisofs    # genisoimage
  which flattenks  # pykiskstart
  which createrepo # createrepo
}

function usage() {
  echo "Usage: $0 CentOS-7-x86_64-Everything-1511.iso [output.iso]"
  exit 2
}

function mkiso() {
  local _build_dir=$1
  local _iso_fname=$2

  /usr/bin/mkisofs -quiet -U -A "${NAME} ${VERSION} ${ARCH}" \
    -V  "${NAME} ${VERSION} ${ARCH}" -volset  "${NAME} ${VERSION} ${ARCH}" \
    -untranslated-filenames -J -joliet-long -r -v -T \
    -x ./lost+found -b isolinux/isolinux.bin -c isolinux/boot.cat \
    -no-emul-boot -boot-load-size 4 -boot-info-table \
    -eltorito-alt-boot -e images/efiboot.img -no-emul-boot \
    -o ${_iso_fname} ${_build_dir}
}

function main() {

  # Check preconditions
  if [ $# -lt 1 ] || [ -z "$1" ]; then usage; fi
  if [ $(id -u) != 0 ]; then echo "Run this script as root (try sudo)"; exit 1; fi

  # Download offline-snapshot
  offline-snapshot

  # Generate output filename
  TIMESTAMP=$(date +%y%m%d_%H%M%S)
  OUT_ISO=${1/.iso/-$TIMESTAMP}.iso
  [ $# -eq 2 ] && [ ! -z "$2" ] && OUT_ISO=$2

  # Mount existing iso and copy to new dir<commit_msg>Closes #79 and #81<commit_after>#!/bin/bash

NAME="ROCK"
VERSION="2.0"
RELEASE="1"
ARCH="x86_64"
KICKSTART="ks.cfg"
TIMESTAMP=$(date +%y%m%d_%H%M%S)
SCRIPT_DIR=$(dirname $(readlink -f $0))

. ./offline-snapshot.sh

function cleanup() {
  umount $TMP_ISO
  [ -d ${TMP_ISO} ] && rm -rf ${TMP_ISO}
  [ -d ${TMP_NEW} ] && rm -rf ${TMP_NEW}
  [ -d ${TMP_RPMDB} ] && rm -rf ${TMP_RPMDB}
}

TMP_ISO=$(mktemp -d)
TMP_NEW=$(mktemp -d)
TMP_RPMDB=$(mktemp -d)

trap cleanup EXIT

function check_depends() {

  which mkisofs    # genisoimage
  which flattenks  # pykiskstart
  which createrepo # createrepo
}

function usage() {
  echo "Usage: $0 CentOS-7-x86_64-Everything-1511.iso [output.iso]"
  exit 2
}

function mkiso() {
  local _build_dir=$1
  local _iso_fname=$2

  /usr/bin/mkisofs -quiet -U -A "${NAME} ${VERSION} ${ARCH}" \
    -V  "${NAME} ${VERSION} ${ARCH}" -volset  "${NAME} ${VERSION} ${ARCH}" \
    -untranslated-filenames -J -joliet-long -r -v -T \
    -x ./lost+found -b isolinux/isolinux.bin -c isolinux/boot.cat \
    -no-emul-boot -boot-load-size 4 -boot-info-table \
    -eltorito-alt-boot -e images/efiboot.img -no-emul-boot \
    -o ${_iso_fname} ${_build_dir}

  /usr/bin/isohybrid --uefi ${_iso_fname}

  /usr/bin/implantisomd5 ${_iso_fname}
}

function main() {

  # Check preconditions
  if [ $# -lt 1 ] || [ -z "$1" ]; then usage; fi
  if [ $(id -u) != 0 ]; then echo "Run this script as root (try sudo)"; exit 1; fi

  # Download offline-snapshot
  offline-snapshot

  # Copy XKCD dictionary
  cp xkcd-dict.txt ${ROCK_CACHE_DIR}/support/

  # Generate output filename
  TIMESTAMP=$(date +%y%m%d_%H%M%S)
  OUT_ISO=${1/.iso/-$TIMESTAMP}.iso
  [ $# -eq 2 ] && [ ! -z "$2" ] && OUT_ISO=$2

  # Mount existing iso and copy to new dir
{'fraction_non_alphanumeric': 0.18944844124700239, 'fraction_numerical': 0.01948441247002398, 'mean_word_length': 3.1869510664993728, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '4972523', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1409, 'n_words': 323}