Private/GetRaspbianScripts.ps1

function GetRaspbianScripts {
    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$True)]
        [string]$LinuxGenericArmPackageUrl,

        [Parameter(Mandatory=$True)]
        [string]$LinuxGenericArmPackageName
    )

    [System.Collections.ArrayList]$RaspbianManualInstallScript = @(
        'apt install libunwind8'
        "wget -q $LinuxGenericArmPackageUrl"
        'mkdir ~/powershell'
        "tar -xvf ./$LinuxGenericArmPackageName -C ~/powershell"
    )

    [System.Collections.ArrayList]$RaspbianUninstallScript = @('rm -rf ~/powershell')

    [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'
    )

    [pscustomobject]@{
        PackageManagerInstallScript                 = [System.Collections.ArrayList]$RaspbianManualInstallScript
        ManualInstallScript                         = [System.Collections.ArrayList]$RaspbianManualInstallScript
        UninstallScript                             = [System.Collections.ArrayList]$RaspbianUninstallScript
        ConfigurePwshRemotingScript                 = [System.Collections.ArrayList]$LinuxPwshRemotingScript
    }
}