Private/GetArchScripts.ps1

function GetArchScripts {
    [CmdletBinding()]
    Param()

    [System.Collections.ArrayList]$ArchPMInstallScript = @(
        'ls powershell-bin && rm -rf powershell-bin'
        'git clone https://aur.archlinux.org/powershell-bin.git'
        'cd powershell-bin'
        'makepkg -si --noconfirm'
    )

    [System.Collections.ArrayList]$ArchUninstallScript = @('pacman -Rcn powershell-bin --noconfirm')

    [System.Collections.ArrayList]$LinuxPwshRemotingScript = @(
        "if echo `$(cat /etc/ssh/sshd_config | grep -c '^Subsystem powershell') > /dev/null -gt 0; then sed -i '/^Subsystem powershell/d' /etc/ssh/sshd_config; fi"
        'pscorepath=$(command -v pwsh)'
        'if test -z $pscorepath; then echo pwshNotFound && exit 1; fi'
        'subsystemline=$(echo "Subsystem powershell $pscorepath -sshs -NoLogo -NoProfile")'
        'sed -i "s|sftp-server|sftp-server\n$subsystemline|" /etc/ssh/sshd_config'
        'systemctl restart sshd'
    )

    $Arch = [pscustomobject]@{
        PackageManagerInstallScript                 = [System.Collections.ArrayList]$ArchPMInstallScript
        ManualInstallScript                         = [System.Collections.ArrayList]$ArchPMInstallScript
        UninstallScript                             = [System.Collections.ArrayList]$ArchUninstallScript
        ConfigurePwshRemotingScript                 = [System.Collections.ArrayList]$LinuxPwshRemotingScript
    }
}