<commit_before>#!/bin/bash

# This script will mount a given image in loop mode.
# Make sure to change the path and offsets for the image you use. You can get
# the correct offsets using `file $PATH_TO_IMAGE` or fdisk.

# To make debugging easier
echo "KittenGroomer: in mount_image.sh" 1>&2

if [ "$(id -u)" != "0" ]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

set -e
set -x

# Double check the path and offsets as noted above!
# Path to the image
IMAGE='/media/sf_ubuntu-shared/2017-02-02_CIRCLean.img'
# Start sector of boot (first) partition
BOOT_START=8192
# Start sector of root (second) partition
ROOT_START=137216
# Locations you'd like the partitions mounted
BOOT_PATH='/mnt/rpi-boot'
ROOTFS_PATH='/mnt/rpi-root'

# Calculate offsets for each partition
offset_boot=$((${BOOT_START} * 512))
offset_rootfs=$((${ROOT_START} * 512))
# TODO: add logic for creating directories if they aren't already there
mkdir -p ${BOOT_PATH}
mkdir -p ${ROOTFS_PATH}
# Mount each partition in loop mode
mount -o loop,offset=${offset_boot} ${IMAGE} ${BOOT_PATH}
mount -o loop,offset=${offset_rootfs} ${IMAGE} ${ROOTFS_PATH}

echo "Image mounted" 1>&2<commit_msg>Remove path from helper script<commit_after>#!/bin/bash

# This script will mount a given image in loop mode.
# Make sure to change the path and offsets for the image you use. You can get
# the correct offsets using `file $PATH_TO_IMAGE` or fdisk.

# To make debugging easier
echo "KittenGroomer: in mount_image.sh" 1>&2

if [ "$(id -u)" != "0" ]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

set -e
set -x

# Double check the path and offsets as noted above!
# Path to the image
IMAGE='2017-02-02_CIRCLean.img'
# Start sector of boot (first) partition
BOOT_START=8192
# Start sector of root (second) partition
ROOT_START=137216
# Locations you'd like the partitions mounted
BOOT_PATH='/mnt/rpi-boot'
ROOTFS_PATH='/mnt/rpi-root'

# Calculate offsets for each partition
offset_boot=$((${BOOT_START} * 512))
offset_rootfs=$((${ROOT_START} * 512))
# TODO: add logic for creating directories if they aren't already there
mkdir -p ${BOOT_PATH}
mkdir -p ${ROOTFS_PATH}
# Mount each partition in loop mode
mount -o loop,offset=${offset_boot} ${IMAGE} ${BOOT_PATH}
mount -o loop,offset=${offset_rootfs} ${IMAGE} ${ROOTFS_PATH}

echo "Image mounted" 1>&2
{'fraction_non_alphanumeric': 0.11628901239846089, 'fraction_numerical': 0.027362120564343735, 'mean_word_length': 4.777777777777778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4310988', 'n_tokens_mistral': 850, 'n_tokens_neox': 775, 'n_words': 297}