<commit_before>#!/bin/bash

# Check inputs
if [ "$#" -ne 2 ]; then 
    echo "Usage: $0 IMAGE MOUNT"
    echo "IMAGE - raspberry pi .img file"
    echo "MOUNT - mount location in the file system"
    exit
fi

if [ ! -f $1 ]; then
	echo "Image file $1 does not exist"
	exit 1
fi

if [ ! -d $2 ]; then
	echo "Mount point $2 does not exist"
	exit 2
fi

echo "Attempting to mount $1 to $2"

set -e

# Attach loopback device
LOOP_BASE=`losetup -f --show $1`

echo "Attached base loopback at: $LOOP_BASE"

BLOCK_SIZE=512

# Fetch and parse partition info
P1_INFO=($`fdisk -l $LOOP_BASE | grep ${LOOP_BASE}p1`)
P2_INFO=($`fdisk -l $LOOP_BASE | grep ${LOOP_BASE}p2`)

# Locate partition 2 start address
P1_START=${P1_INFO[1]}
P2_START=${P2_INFO[1]}

echo "Located partitions: p1 at $P1_START p2 at $P2_START"

# Cleanup loopbacks
losetup -d $LOOP_BASE
echo "Closed loopback $LOOP_BASE"

mkdir -p $2
mount $1 -o loop,offset=$(($P2_START*$BLOCK_SIZE)),rw $2
mount $1 -o loop,offset=$(($P1_START*$BLOCK_SIZE)),rw $2/boot

echo "Mounted to $2 and $2/boot"



<commit_msg>Better messages<commit_after>#!/bin/bash

# Check inputs
if [ "$#" -ne 2 ]; then 
    echo "Usage: $0 IMAGE MOUNT"
    echo "IMAGE - raspberry pi .img file"
    echo "MOUNT - mount location in the file system"
    exit
fi

if [ ! -f $1 ]; then
	echo "Image file $1 does not exist"
	exit 1
fi

if [ ! -d $2 ]; then
	echo "Mount point $2 does not exist"
	exit 2
fi

echo "Attempting to mount $1 to $2"

set -e

# Attach loopback device
LOOP_BASE=`losetup -f --show $1`

echo "Attached base loopback at: $LOOP_BASE"

BLOCK_SIZE=512

# Fetch and parse partition info
P1_INFO=($`fdisk -l $LOOP_BASE | grep ${LOOP_BASE}p1`)
P2_INFO=($`fdisk -l $LOOP_BASE | grep ${LOOP_BASE}p2`)

# Locate partition 2 start address
P1_START=${P1_INFO[1]}
P2_START=${P2_INFO[1]}

echo "Located partitions: p1 (/boot) at $P1_START and p2 (/) at $P2_START"

# Cleanup loopbacks
losetup -d $LOOP_BASE
echo "Closed loopback $LOOP_BASE"

mkdir -p $2
mount $1 -o loop,offset=$(($P2_START*$BLOCK_SIZE)),rw $2
mount $1 -o loop,offset=$(($P1_START*$BLOCK_SIZE)),rw $2/boot

echo "Mounted to $2 and $2/boot"




{'fraction_non_alphanumeric': 0.14138576779026218, 'fraction_numerical': 0.035580524344569285, 'mean_word_length': 3.9126436781609195, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1229131', 'n_tokens_mistral': 904, 'n_tokens_neox': 862, 'n_words': 279}