#!/bin/env fish
begin
    set -l dir (status dirname)
    source "$dir/../../Scripts/software.fish"

    function installSW -V dir
        yayinst \
            surface-dtx-daemon-bin \
            surface-control-bin
    end

    function configureSW -V dir
        begin
            printf %s\n \
                "# vim:set ft=sh" \
                "MODULES+=(pinctrl_sunrisepoint surface_dtx)"
        end | sudo tee /etc/mkinitcpio.conf.d/surface-book-2.conf > /dev/null

        fish "$dir/../../../Common/Drivers/SurfaceBook2/main.fish" configure
        sudo systemctl enable surface-dtx-daemon.service
        sudo systemctl enable --global surface-dtx-userd.service
    end

    runInstaller $argv
    fish "$dir/../Surface/main.fish" $argv
end