<commit_before>require 'fileutils'

module Dock0
  ##
  # An Image is a rootfs for a system
  class Image < Base
    DEFAULT_CONFIG = {
      'paths' => {
        'build_file' => '/opt/build_file',
        'build' => '/opt/build_file_mount',
        'package_list' => './packages',
        'overlay' => './overlay',
        'scripts' => './scripts',
        'output' => './root.fs.sfs'
      },
      'fs' => {
        'size' => 512,
        'type' => 'ext4',
        'flags' => '-F'
      }
    }

    def run_chroot(cmd)
      run "arch-chroot #{@paths['build']} #{cmd}"
    end

    def prepare_root
      build_file = @paths['build_file']
      filesystem = @config['fs']
      puts "Making build FS at #{build_file}"
      run "dd if=/dev/zero of=#{build_file} bs=1MB count=#{filesystem['size']}"
      mkfs = "mkfs.#{filesystem['type']} #{filesystem['flags']}"
      run "#{mkfs} #{build_file}"
      puts "Mounting FS at #{@paths['build']}"<commit_msg>paths should default to relative<commit_after>require 'fileutils'

module Dock0
  ##
  # An Image is a rootfs for a system
  class Image < Base
    DEFAULT_CONFIG = {
      'paths' => {
        'build_file' => './build_file',
        'build' => './build_file_mount',
        'package_list' => './packages',
        'overlay' => './overlay',
        'scripts' => './scripts',
        'output' => './root.fs.sfs'
      },
      'fs' => {
        'size' => 512,
        'type' => 'ext4',
        'flags' => '-F'
      }
    }

    def run_chroot(cmd)
      run "arch-chroot #{@paths['build']} #{cmd}"
    end

    def prepare_root
      build_file = @paths['build_file']
      filesystem = @config['fs']
      puts "Making build FS at #{build_file}"
      run "dd if=/dev/zero of=#{build_file} bs=1MB count=#{filesystem['size']}"
      mkfs = "mkfs.#{filesystem['type']} #{filesystem['flags']}"
      run "#{mkfs} #{build_file}"
      puts "Mounting FS at #{@paths['build']}"
{'fraction_non_alphanumeric': 0.19264629725530813, 'fraction_numerical': 0.006214396685655101, 'mean_word_length': 2.3367875647668392, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '3782031', 'n_tokens_mistral': 669, 'n_tokens_neox': 654, 'n_words': 147}