@@ -99,11 +99,11 @@ Justification='This script is not intended for pipelining.')]
9999Justification= ' Some of these functions may deal with multiple updates.' )]
100100[CmdletBinding ()] Param (
101101# The sources of updates to install, in order.
102- [ValidateSet (' Chocolatey' , ' DellCommand' , ' Dotnet' , ' Essential' , ' GitHubCli' , ' Npm' , ' ScriptsData' ,
102+ [ValidateSet (' Apt ' , ' Chocolatey' , ' DellCommand' , ' Dotnet' , ' Essential' , ' Flatpak ' , ' GitHubCli' , ' Npm' , ' ScriptsData' ,
103103 ' PSHelp' , ' PSModule' , ' Scoop' , ' VSCodeExtenions' , ' WindowsUpdate' , ' WindowsStore' , ' WinGet' )]
104104[Parameter (Position = 0 , ValueFromRemainingArguments = $true )][string []] $Steps =
105105 @ (' Essential' , ' WindowsStore' , ' PSModule' , ' Scoop' , ' Chocolatey' , ' WinGet' , ' Npm' , ' Dotnet' ,
106- ' GitHubCli' , ' VSCodeExtensions' , ' ScriptsData' , ' PSHelp' , ' DellCommand' , ' WindowsUpdate' )
106+ ' GitHubCli' , ' VSCodeExtensions' , ' ScriptsData' , ' PSHelp' , ' DellCommand' , ' WindowsUpdate' , ' Apt ' , ' Flatpak ' )
107107)
108108Begin
109109{
@@ -115,6 +115,7 @@ Begin
115115 [CmdletBinding ()][OutputType ([bool ])] Param (
116116 [switch ] $Shared
117117 )
118+ if (! $IsWindows ) {return }
118119 if ($Shared -and $Script :IsNotAdministrator ) {return $false }
119120 $dir = [environment ]::GetFolderPath(($Shared ? ' CommonDesktopDirectory' : ' Desktop' ))
120121 return ! (Join-Path $dir * .lnk | Get-Item )
@@ -125,6 +126,7 @@ Begin
125126 [CmdletBinding ()] Param (
126127 [switch ] $Shared
127128 )
129+ if (! $IsWindows ) {return }
128130 if ($Shared -and $Script :IsNotAdministrator ) {return }
129131 $dir = [environment ]::GetFolderPath(($Shared ? ' CommonDesktopDirectory' : ' Desktop' ))
130132 Remove-Item (Join-Path $dir * .lnk)
@@ -233,7 +235,7 @@ Begin
233235 function Test-DbatoolsHasUpdate
234236 {
235237 [CmdletBinding ()][OutputType ([bool ])] Param ()
236- $version = Get-Module dbatools - ListAvailable | Measure-Object Version - Maximum
238+ $version = @ ( Get-Module dbatools - ListAvailable | Measure-Object Version - Maximum)
237239 if ($version.Count -eq 0 ) {return }
238240 if ($version.Maximum -ge (Find-Module dbatools - Repository PSGallery).Version) {return }
239241 $allUsers = (Get-ModuleScope.ps1 dbatools).Scope -eq ' AllUsers'
@@ -394,6 +396,31 @@ Begin
394396 Get-WindowsUpdate
395397 Install-WindowsUpdate | Format-Table X, Result, KB, Size, Title
396398 }
399+
400+ function Update-Apt
401+ {
402+ [CmdletBinding ()] Param ()
403+ if (! $IsLinux ) {return }
404+ if ($Script :IsNotAdministrator ) {Write-Warning " Not running as admin; skipping apt." ; return }
405+ if (! (Get-Command apt - Type Application - ErrorAction Ignore))
406+ {Write-Verbose ' apt not found, skipping' ; return }
407+ Write-Step " $UP Updating apt packages"
408+ apt update
409+ # apt dist-upgrade -y
410+ apt autoremove - y
411+ apt autoclean - y
412+ }
413+
414+ function Update-Flatpak
415+ {
416+ [CmdletBinding ()] Param ()
417+ if (! $IsLinux ) {return }
418+ # if($Script:IsNotAdministrator) {Write-Warning "Not running as admin; skipping flatpak."; return}
419+ if (! (Get-Command flatpak - Type Application - ErrorAction Ignore))
420+ {Write-Verbose ' flatpak not found, skipping' ; return }
421+ Write-Step " $UP Updating flatpak packages"
422+ flatpak update - y -- noninteractive
423+ }
397424}
398425Process
399426{
0 commit comments