From 35fe3a156f1802240a89062c0663f78474134cba Mon Sep 17 00:00:00 2001 From: lksz Date: Tue, 27 Apr 2021 17:41:00 -0400 Subject: [PATCH] Fixed startup issues Fixed Package condition testing which would fail, but also made it more verbose. Fixed shell-loading-snippets because of the rename to Setup-ScriptEnv. --- base/src/Packagesz.class.inc.ps1 | 4 ++++ shell-loading-snippets/bash | 4 ++-- shell-loading-snippets/sh | 4 ++-- shell-loading-snippets/zsh | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/base/src/Packagesz.class.inc.ps1 b/base/src/Packagesz.class.inc.ps1 index e78e555..a10ab35 100644 --- a/base/src/Packagesz.class.inc.ps1 +++ b/base/src/Packagesz.class.inc.ps1 @@ -20,6 +20,10 @@ class Packagesz { #: System.Management.Automation.IValidateSetValuesGenerator { } static [bool] ValidatePackageConditions($Package) { if( -not $Package.Condition ) { return $true } + $local:badCnd = $Package.Condition | + Get-Member -MemberType NoteProperty | + Where-Object Name -notin ('Logic', 'custom', 'System','Hostname','Username','CmdletExists','AppExeExists') + if( $badCnd ) { Write-Warning "Bad conditions for Package $($Package.name): $($badCnd.Name -join ', ')"; return $false } $local:valid = $Package.Condition[0].Logic -notin ([szLogic]::or, [szLogic]::ornot) $local:currentSys = [SystemName]::_GetValidValues('',$true,$true); $local:hostname = $(hostname) diff --git a/shell-loading-snippets/bash b/shell-loading-snippets/bash index 006d8ab..08e60aa 100755 --- a/shell-loading-snippets/bash +++ b/shell-loading-snippets/bash @@ -8,10 +8,10 @@ if [[ -x ~/.dotnet/tools/pwsh && "1" != "$(which pwsh > /dev/null && echo 1)" ]] export DOTNET_CLI_TELEMETRY_OPTOUT=1 fi -echo "$(date) SZ_SKIP_DEFAULT_SHELL='$SZ_SKIP_DEFAULT_SHELL'; pwsh: $(which pwsh); Setup-Profile: $(ls ~/.local/share/powershell/Scripts/Setup-Profile.ps1) " >> /tmp/default_shell +echo "$(date) SZ_SKIP_DEFAULT_SHELL='$SZ_SKIP_DEFAULT_SHELL'; pwsh: $(which pwsh); Setup-ScriptEnv: $(ls ~/.local/share/powershell/Scripts/Setup-ScriptEnv.ps1) " >> /tmp/default_shell if [[ "$SZ_SKIP_DEFAULT_SHELL" != "1" ]]; then export SZ_SKIP_DEFAULT_SHELL=1 - if [[ "1" == "$(which pwsh > /dev/null && echo 1)" && -f ~/.local/share/powershell/Scripts/Setup-Profile.ps1 ]]; then + if [[ "1" == "$(which pwsh > /dev/null && echo 1)" && -f ~/.local/share/powershell/Scripts/Setup-ScriptEnv.ps1 ]]; then echo 'Starting PowerShell SZcripts...' echo "pwsh" >> /tmp/default_shell pwsh diff --git a/shell-loading-snippets/sh b/shell-loading-snippets/sh index 006d8ab..08e60aa 100755 --- a/shell-loading-snippets/sh +++ b/shell-loading-snippets/sh @@ -8,10 +8,10 @@ if [[ -x ~/.dotnet/tools/pwsh && "1" != "$(which pwsh > /dev/null && echo 1)" ]] export DOTNET_CLI_TELEMETRY_OPTOUT=1 fi -echo "$(date) SZ_SKIP_DEFAULT_SHELL='$SZ_SKIP_DEFAULT_SHELL'; pwsh: $(which pwsh); Setup-Profile: $(ls ~/.local/share/powershell/Scripts/Setup-Profile.ps1) " >> /tmp/default_shell +echo "$(date) SZ_SKIP_DEFAULT_SHELL='$SZ_SKIP_DEFAULT_SHELL'; pwsh: $(which pwsh); Setup-ScriptEnv: $(ls ~/.local/share/powershell/Scripts/Setup-ScriptEnv.ps1) " >> /tmp/default_shell if [[ "$SZ_SKIP_DEFAULT_SHELL" != "1" ]]; then export SZ_SKIP_DEFAULT_SHELL=1 - if [[ "1" == "$(which pwsh > /dev/null && echo 1)" && -f ~/.local/share/powershell/Scripts/Setup-Profile.ps1 ]]; then + if [[ "1" == "$(which pwsh > /dev/null && echo 1)" && -f ~/.local/share/powershell/Scripts/Setup-ScriptEnv.ps1 ]]; then echo 'Starting PowerShell SZcripts...' echo "pwsh" >> /tmp/default_shell pwsh diff --git a/shell-loading-snippets/zsh b/shell-loading-snippets/zsh index c126cde..73c3840 100755 --- a/shell-loading-snippets/zsh +++ b/shell-loading-snippets/zsh @@ -8,10 +8,10 @@ if [[ -x ~/.dotnet/tools/pwsh && "1" != "$(which pwsh > /dev/null && echo 1)" ]] export DOTNET_CLI_TELEMETRY_OPTOUT=1 fi -echo "$(date) SZ_SKIP_DEFAULT_SHELL='$SZ_SKIP_DEFAULT_SHELL'; pwsh: $(which pwsh); Setup-Profile: $(ls ~/.local/share/powershell/Scripts/Setup-Profile.ps1) " >> /tmp/default_shell +echo "$(date) SZ_SKIP_DEFAULT_SHELL='$SZ_SKIP_DEFAULT_SHELL'; pwsh: $(which pwsh); Setup-ScriptEnv: $(ls ~/.local/share/powershell/Scripts/Setup-ScriptEnv.ps1) " >> /tmp/default_shell if [[ "$SZ_SKIP_DEFAULT_SHELL" != "1" ]]; then export SZ_SKIP_DEFAULT_SHELL=1 - if [[ "1" == "$(which pwsh > /dev/null && echo 1)" && -f ~/.local/share/powershell/Scripts/Setup-Profile.ps1 ]]; then + if [[ "1" == "$(which pwsh > /dev/null && echo 1)" && -f ~/.local/share/powershell/Scripts/Setup-ScriptEnv.ps1 ]]; then echo 'Starting PowerShell SZcripts...' echo "pwsh" >> /tmp/default_shell pwsh