Introducing Packages

Major Overhaul with Breaking Changes
split into packaged, default behavior moved into 'base' package
each package has a json package description file with criteria for
loading

Modified Setup-Profile to refer to 'base' package path for auto loading

moved Linux aliases and command to 'base.linux' package
created 'docker' package to address docker supported systems

modified Get-MyScripts, Edit-MyScripts and Reload-MyScripts accordingly.

Dropped -System and sys.*, package json conditions will take care of it.

Supplied command to create/edit package json files:
  - New-MyPackage
  - Add-PackageCondition
  - Set-MyPackage
This commit is contained in:
lksz 2020-11-25 00:46:33 -05:00
parent 80a488484b
commit 42b39f4e25
83 changed files with 505 additions and 130 deletions

35
base.linux/sz-df.ps1 Normal file
View file

@ -0,0 +1,35 @@
param([ValidateSet('KB','GB','TB')]$SizeUnitName = 'GB')
$local:zpool_cmd = $null
$local:excludeType = ''
$script:SizeUnit = Invoke-Expression "1$SizeUnitName"
$script:SizeRound = 2
$SizeUnit /= 1KB
function NewDataRow{param($Size,$Used,$Available,$Percent,$Source,$FSType,$Target)
[PSCustomObject]@{
"Size$SizeUnitName" = [Math]::Round($Size /$SizeUnit, $SizeRound)
"Used$SizeUnitName" = [Math]::Round($Used /$SizeUnit, $SizeRound)
"Available$SizeUnitName" = [Math]::Round($Available/$SizeUnit, $SizeRound)
'Used%' = [int]($Percent -replace '%$','')
Source = $Source
FSType = $FSType
Target = $Target
}
}
$local:df = @()
& df '--output=size,used,avail,pcent,source,fstype,target' |
Select-Object -Skip 1 | ForEach-Object {
$local:df = $_.Split(' ', [StringSplitOptions]::RemoveEmptyEntries)
NewDataRow $df[0] $df[1] $df[2] $df[3] $df[4] $df[5] $df[6]
} | Where-Object {
-not ($_.FSType -eq 'zfs' -and $_.Source -match '/')
} | Sort-Object -Property Target
#$zpool_cmd = get-command zpool | Where-Object CommandType -eq 'Application' | Select-Object -ExpandProperty Source
#if( $zpool_cmd ) {
# $excludeType = '--exclude-type=zfs'
#}