#!/bin/bash

GITHUB_REPO="https://github.com/RinCat/RTL88x2BU-Linux-Driver.git"
TEMPDIR="/tmp"


dependencies_(){
    if [ -f /usr/bin/dnf ];then
        dnf install make kernel-devel git
    fi
}


clone_(){
    if [ ! -d "${TEMPDIR}"/88xbu ];then
        git clone "${GITHUB_REPO}" "${TEMPDIR}"/88xbu
    fi
}

build_(){
    if [ -d "${TEMPDIR}"/88xbu ];then
    	cd "${TEMPDIR}"/88xbu
        make clean
        make "${1}"
        make install
    else
        echo "${TEMPDIR}/88xbu does not exist"
        exit 1
    fi
    
    
}

dependencies_
clone_
build_ "${1}"