<commit_before>#!/bin/sh

# 1st parameter: $1 -> image.qcow2
# 2nd parameter: $2 -> tap0..n
# 3rd parameter: $3 -> virtual ethernet device
# 4th parameter: $4 -> additional parameters, enter like this "-usb -usbdevice 1234:5678"

# pass to 4th parameter
# tip: -nographics
# tip: -usb -usbdevice PQRS:TUVW where P..W are 1..9

if [ -z "$1" ] ;then
  echo "Error: No vm image set to boot!"
  exit 1
fi

MODEL=$3
if [ -z "$3" ]; then
  echo "Warning: No nic model set!"
  echo "Warning: Default will be 'e1000'."
  MODEL=e1000
fi

if [ -z "$2" ]; then
  echo "Error: No tap device chosen to connect to virtual guest!"
  exit 1
fi

if [ -z "$4" ]; then
  echo "Warning: No extra parameters given to qemu."
fi

N=$(echo -n $2 | sed 's/.*\([0-9]\+\)$/\1/')
MACADDR="DE:AD:BE:EF:$N$N:$N$N"

echo "mac address: $MACADDR"

KVM=$(which qemu-system-x86_64)
if [ -z "$KVM" ]; then
  echo "Error: no qemu available."
  exit 1
fi

sudo $KVM -drive file=$1,if=virtio,boot=on -m 1024 -smp 2 $4 \
  -net nic,macaddr=$MACADDR,model=$MODEL \
  -net tap,ifname=$2,script=no \
  -usb \
  -name "`basename $1` $2" \
  -no-quit \<commit_msg>virtio-blk is required to run guest with virtio-blk<commit_after>#!/bin/sh

# 1st parameter: $1 -> image.qcow2
# 2nd parameter: $2 -> tap0..n
# 3rd parameter: $3 -> virtual ethernet device
# 4th parameter: $4 -> additional parameters, enter like this "-usb -usbdevice 1234:5678"

# pass to 4th parameter
# tip: -nographics
# tip: -usb -usbdevice PQRS:TUVW where P..W are 1..9

if [ -z "$1" ] ;then
  echo "Error: No vm image set to boot!"
  exit 1
fi

MODEL=$3
if [ -z "$3" ]; then
  echo "Warning: No nic model set!"
  echo "Warning: Default will be 'virtio'."
  echo "Warning: Ascertain whether virtio-blk is loaded"
  MODEL=virtio
fi

if [ -z "$2" ]; then
  echo "Error: No tap device chosen to connect to virtual guest!"
  exit 1
fi

if [ -z "$4" ]; then
  echo "Warning: No extra parameters given to qemu."
fi

N=$(echo -n $2 | sed 's/.*\([0-9]\+\)$/\1/')
MACADDR="DE:AD:BE:EF:$N$N:$N$N"

echo "mac address: $MACADDR"

KVM=$(which qemu-system-x86_64)
if [ -z "$KVM" ]; then
  echo "Error: no qemu available."
  exit 1
fi

sudo $KVM -drive file=$1,if=virtio,boot=on -m 1024 -smp 2 $4 \
  -net nic,macaddr=$MACADDR,model=$MODEL \
  -net tap,ifname=$2,script=no \
  -usb \
  -name "`basename $1` $2" \
  -no-quit \
{'fraction_non_alphanumeric': 0.17387580299785868, 'fraction_numerical': 0.0436830835117773, 'mean_word_length': 3.2014388489208634, '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': '3479642', 'n_tokens_mistral': 996, 'n_tokens_neox': 926, 'n_words': 310}