<commit_before>#!/bin/bash

# Script to swap AMD/Nvidia drivers on boot. Both drivers must have
# been installed first, as the script relies on the various libraries
# being in their default locations. Script works by overriding
# symlinks on libglx.so, libgl.so and xorg.conf. Once these point to
# the AMD/Nvidia libraries, hardware-accelerated OpenGL is available.

function use_nvidia {
    # UPDATE THESE PATHS
    driver_pkg=nvidia
    libglx_path=/usr/lib64/xorg/modules/extensions/libglx.so.346.47
    libgl_path=/usr/lib64/libGL.so.346.47
    xorg_path=/SW-SCRT-0030/bladeConfig/xorg.conf.K2200M
}


function use_fglrx {
    # UPDATE THESE PATHS
    driver_pkg=fglrx
    libglx_path=/usr/lib64/xorg/modules/extensions/fglrx/fglrx-libglx.so
    libgl_path=/usr/lib64/fglrx/fglrx-libGL.so.1.2  
    xorg_path=/SW-SCRT-0030/bladeConfig/xorg/conf.S4000X
}


function swap_drivers {
    echo "Using $driver_pkg driver"
    
    # libglx
    printf "Linking libglx.so..."
    if [ -s $libglx_path ]; then
        ln -snf $libglx_path /usr/lib64/xorg/modules/extensions/libglx.so
        echo OK
    else
        echo ERROR
        echo "Couldn't find $libglx_path"
        exit 1
    fi

    # libGL
    printf "Linking libGL.so.1..."
    if [ -s $libgl_path ]; then
        ln -snf $libgl_path /usr/lib64/libGL.so.1
        echo OK
    else
        echo ERROR
        echo "Couldn't find $libgl_path"
        exit 1
    fi

    # Xorg<commit_msg>Add possible method for dynamic switching after boot<commit_after>#!/bin/bash

# Script to swap AMD/Nvidia drivers on boot. Both drivers must have
# been installed first, as the script relies on the various libraries
# being in their default locations. Script works by overriding
# symlinks on libglx.so, libgl.so and xorg.conf. Once these point to
# the AMD/Nvidia libraries, hardware-accelerated OpenGL is available.

function use_nvidia {
    # UPDATE THESE PATHS
    driver_pkg=nvidia
    libglx_path=/usr/lib64/xorg/modules/extensions/libglx.so.346.47
    libgl_path=/usr/lib64/libGL.so.346.47
    xorg_path=/SW-SCRT-0030/bladeConfig/xorg.conf.K2200M
}


function use_fglrx {
    # UPDATE THESE PATHS
    driver_pkg=fglrx
    libglx_path=/usr/lib64/xorg/modules/extensions/fglrx/fglrx-libglx.so
    libgl_path=/usr/lib64/fglrx/fglrx-libGL.so.1.2  
    xorg_path=/SW-SCRT-0030/bladeConfig/xorg/conf.S4000X
}


function swap_drivers {
    echo "Using $driver_pkg driver"
    
    # libglx
    printf "Linking libglx.so..."
    if [ -s $libglx_path ]; then
        ln -snf $libglx_path /usr/lib64/xorg/modules/extensions/libglx.so
        # Needed for dynamic switching
        # ldconfig /usr/lib64/xorg/modules/extensions
        echo OK
    else
        echo ERROR
        echo "Couldn't find $libglx_path"
        exit 1
    fi

    # libGL
    printf "Linking libGL.so.1..."
    if [ -s $libgl_path ]; then
        ln -snf $libgl_path /usr/lib64/libGL.so.1
        # Needed for dynamic switching
        # ldconfig /usr/lib64
        echo OK
    else
        echo ERROR
        echo "Couldn't find $libgl_path"
        exit 1
    fi

    # Xorg
{'fraction_non_alphanumeric': 0.09319574330861012, 'fraction_numerical': 0.02966784908094163, 'mean_word_length': 2.545142857142857, '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': '1811343', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1104, 'n_words': 262}