<commit_before>#!/bin/bash -eux

SSH_USER=${SSH_USERNAME:-vagrant}
SSH_USER_HOME=${SSH_USER_HOME:-/home/${SSH_USER}}

if [[ $PACKER_BUILDER_TYPE =~ virtualbox ]]; then
    echo "==> Installing VirtualBox guest additions"
    # Some of these packages should already have been installed in the kickstart
    dnf -y install kernel-headers-"$(uname -r)" kernel-devel-"$(uname -r)" gcc make perl
    # Need to set the KERN_DIR in Fedora 26 through 28 or the VBox additions will not install
    /usr/libexec/system-python -mplatform | grep -qi "fedora-2[678]" && echo "Fedora 26, 27 or 28 detected" && \
    KERN_DIR=/usr/src/kernels/"$(uname -r)" && export KERN_DIR
    VBOX_VERSION=$(cat $SSH_USER_HOME/.vbox_version)
    mount -o loop $SSH_USER_HOME/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
    sh /mnt/VBoxLinuxAdditions.run --nox11
    umount /mnt
    rm -rf $SSH_USER_HOME/VBoxGuestAdditions_$VBOX_VERSION.iso
    rm -f $SSH_USER_HOME/.vbox_version
fi<commit_msg>Adjust the $KERN_DIR value and install dkms<commit_after>#!/bin/bash -eux

SSH_USER=${SSH_USERNAME:-vagrant}
SSH_USER_HOME=${SSH_USER_HOME:-/home/${SSH_USER}}

if [[ $PACKER_BUILDER_TYPE =~ virtualbox ]]; then
    echo "==> Installing VirtualBox guest additions"
    # Need to set the KERN_DIR in Fedora 26 and 27 or the VBox additions will not install
    /usr/libexec/system-python -mplatform | grep -qi "fedora-2[67]" && echo "Fedora 26 or 27 detected" && \
        KERN_DIR=/usr/src/kernels/"$(uname -r)" && export KERN_DIR
    /usr/libexec/system-python -mplatform | grep -qi "fedora-28" && echo "Fedora 28 detected" && \
        KERN_DIR=/lib/modules/"$(uname -r)"/build && export KERN_DIR
    if [ "x$KERN_DIR" != "x" ]; then
        # Some of these packages should already have been installed in the kickstart
        dnf -y install kernel-headers-"$(uname -r)" kernel-devel-"$(uname -r)" gcc make perl dkms
        VBOX_VERSION=$(cat $SSH_USER_HOME/.vbox_version)
        mount -o loop $SSH_USER_HOME/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
        sh /mnt/VBoxLinuxAdditions.run --nox11
        umount /mnt
    else
        echo "Couldn't identify Fedora between 26 and 28: couldn't set KERN_DIR."
        echo "Canceling installation of VirtualBox guest additions"
    fi
    rm -rf $SSH_USER_HOME/VBoxGuestAdditions_$VBOX_VERSION.iso
    rm -f $SSH_USER_HOME/.vbox_version
fi
{'fraction_non_alphanumeric': 0.12069698257543561, 'fraction_numerical': 0.01572460688482788, 'mean_word_length': 3.5444015444015444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7420717', 'n_tokens_mistral': 894, 'n_tokens_neox': 824, 'n_words': 216}