From 20abc39fa8ad7ab76207ab960ceceb2dc7c42ba2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Jan 2023 17:38:15 +0000 Subject: [PATCH 1/4] chore(deps): bump ua-parser-js from 0.7.32 to 0.7.33 Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.32 to 0.7.33. - [Release notes](https://github.com/faisalman/ua-parser-js/releases) - [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md) - [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.32...0.7.33) --- updated-dependencies: - dependency-name: ua-parser-js dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9f904068..dc0396ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6997,9 +6997,9 @@ typedarray-to-buffer@^3.1.5: is-typedarray "^1.0.0" ua-parser-js@^0.7.30: - version "0.7.32" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.32.tgz#cd8c639cdca949e30fa68c44b7813ef13e36d211" - integrity sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw== + version "0.7.33" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.33.tgz#1d04acb4ccef9293df6f70f2c3d22f3030d8b532" + integrity sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw== unherit@^1.0.4: version "1.1.3" From 227ee872275443adc2bfa696dbc4f085eb5c893a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 4 Feb 2023 10:43:01 +0000 Subject: [PATCH 2/4] chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1. - [Release notes](https://github.com/kornelski/http-cache-semantics/releases) - [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1) --- updated-dependencies: - dependency-name: http-cache-semantics dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9f904068..87c65ff9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4309,9 +4309,9 @@ htmlparser2@^8.0.1: entities "^4.3.0" http-cache-semantics@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" - integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== + version "4.1.1" + resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" + integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== http-deceiver@^1.2.7: version "1.2.7" From 34fd69ec015fcb395b1aedbcb1f6fd2ca6469704 Mon Sep 17 00:00:00 2001 From: Gerardo Grignoli Date: Mon, 20 Feb 2023 08:34:33 -0300 Subject: [PATCH 3/4] Switched to nuget project as suggested by @awakecoding --- build/06-release-Nuget.ps1 | 8 +--- build/Nuget/gsudo.csproj | 36 ++++++++++++++++++ build/Nuget/gsudo.nuspec.template | 56 ---------------------------- build/Nuget/gsudo.targets | 33 ++++++++++++++++ src/gsudo.Wrappers/gsudoModule.psm1 | 58 +++++++++++++++++++++++++++++ 5 files changed, 129 insertions(+), 62 deletions(-) create mode 100644 build/Nuget/gsudo.csproj delete mode 100644 build/Nuget/gsudo.nuspec.template create mode 100644 build/Nuget/gsudo.targets diff --git a/build/06-release-Nuget.ps1 b/build/06-release-Nuget.ps1 index 87895be9..ccb822f1 100644 --- a/build/06-release-Nuget.ps1 +++ b/build/06-release-Nuget.ps1 @@ -16,15 +16,11 @@ if ($env:version) { "- Cleaning Nuget template folder" git clean .\Build\Nuget\gsudo -xf -"- Generate gsudo.nuspec" -(Get-Content Build\Nuget\gsudo.nuspec.template) -replace '#VERSION#', "$version" | Out-File -encoding UTF8 .\Build\Nuget\gsudo.nuspec - - "- Packing v$version to nuget" -mkdir Artifacts\Nuget -Force > $null -& nuget pack .\Build\Nuget\gsudo.nuspec -OutputDirectory "$((get-item Artifacts\Nuget).FullName)" || $(throw "Nuget pack failed.") +dotnet build .\Build\Nuget\gsudo.csproj /p:Version=$version -o artifacts\Nuget || $(throw "Nuget pack failed.") "`n- Uploading v$version to Nuget" +gi "artifacts\nuget\gsudo.$($version).nupkg" || $(throw "Nuget push failed.") nuget push artifacts\nuget\gsudo.$($version).nupkg -Source https://api.nuget.org/v3/index.json || $(throw "Nuget push failed.") diff --git a/build/Nuget/gsudo.csproj b/build/Nuget/gsudo.csproj new file mode 100644 index 00000000..13387ea0 --- /dev/null +++ b/build/Nuget/gsudo.csproj @@ -0,0 +1,36 @@ + + + + 1.0.0.0 + GerardoGrignoli + GerardoGrignoli + gsudo + gsudo + gsudo;sudo;runas + gsudo + netstandard2.0 + true + false + false + true + false + true + + + + + runtimes\win-anycpu\native\gsudo.exe + + + runtimes\win-x86\native\gsudo.exe + + + runtimes\win-x64\native\gsudo.exe + + + runtimes\win-arm64\native\gsudo.exe + + + + + diff --git a/build/Nuget/gsudo.nuspec.template b/build/Nuget/gsudo.nuspec.template deleted file mode 100644 index 22dced05..00000000 --- a/build/Nuget/gsudo.nuspec.template +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - gsudo - - - - #VERSION# - Gerardo Grignoli - - - - - gsudo - a sudo for windows - Gerardo Grignoli & GitHub contributors - - - 2023 Gerardo Grignoli - https://opensource.org/licenses/MIT - -`gsudo` allows to run commands with elevated permissions within the current console. -It is a `sudo` equivalent for Windows, with a similar user-experience as the original *nix sudo. - -Elevated commands are shown in the caller (non-elevated) console, no switching to another console required. - -http://github.com/gerardog/gsudo - -### Usage - -```gsudo [command] [arguments]``` -Executes the specified command, elevated, and returns. - -Examples - -```gsudo notepad c:\Windows\System32\drivers\etc\hosts``` -```gsudo cmd``` - - - http://github.com/gerardog/gsudo/releases/v#VERSION# - - - - - - - - - - - - diff --git a/build/Nuget/gsudo.targets b/build/Nuget/gsudo.targets new file mode 100644 index 00000000..e53270e4 --- /dev/null +++ b/build/Nuget/gsudo.targets @@ -0,0 +1,33 @@ + + + + + gsudo.exe + PreserveNewest + Included + false + false + + + runtimes\win-x86\native\gsudo.exe + PreserveNewest + Included + false + false + + + runtimes\win-x64\native\gsudo.exe + PreserveNewest + Included + false + false + + + runtimes\win-arm64\native\gsudo.exe + PreserveNewest + Included + false + false + + + \ No newline at end of file diff --git a/src/gsudo.Wrappers/gsudoModule.psm1 b/src/gsudo.Wrappers/gsudoModule.psm1 index d5dc4b1e..514c3a88 100644 --- a/src/gsudo.Wrappers/gsudoModule.psm1 +++ b/src/gsudo.Wrappers/gsudoModule.psm1 @@ -4,6 +4,64 @@ $c += "}" iex ($c -join "`n" | Out-String) function gsudo { +<# +.SYNOPSIS +Runs a command/scriptblock with elevated permissions. If no command is specified, it starts an elevated Powershell session. + +.DESCRIPTION +This function will attempt to retrieve a matching registry key for an +already installed application, usually to be used with a +chocolateyUninstall.ps1 automation script. + +The function also prevents `Get-ItemProperty` from failing when +handling wrongly encoded registry keys. + +.NOTES +Available in 0.9.10+. If you need to maintain compatibility with pre +0.9.10, please add the following to your nuspec (check for minimum +version): + +~~~xml + + + +~~~ + +.INPUTS +String + +.OUTPUTS +This function searches registry objects and returns an array +of PSCustomObject with the matched key's properties. + +Retrieve properties with dot notation, for example: +`$key.UninstallString` + +.EXAMPLE +> +# Version match: Software name is "Gpg4Win (2.3.0)" +[array]$key = Get-UninstallRegistryKey -SoftwareName "Gpg4win (*)" +$key.UninstallString + +.EXAMPLE +> +# Fuzzy match: Software name is "Launchy 2.5" +[array]$key = Get-UninstallRegistryKey -SoftwareName "Launchy*" +$key.UninstallString + +.EXAMPLE +> +# Exact match: Software name in Programs and Features is "VLC media player" +[array]$key = Get-UninstallRegistryKey -SoftwareName "VLC media player" +$key.UninstallString + +.EXAMPLE +> +# Elevate your current shell +gsudo + +#> + $invocationLine = $MyInvocation.Line -replace "^$($MyInvocation.InvocationName)\s+" # -replace '"','""' if ($invocationLine -match "(^| )!!( |$)") From 2b5aa58072b4e8c460d4fc23a12d805c9bff5a3f Mon Sep 17 00:00:00 2001 From: Gerardo Grignoli Date: Mon, 20 Feb 2023 08:39:36 -0300 Subject: [PATCH 4/4] Fix pkg description --- build/Nuget/gsudo.csproj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build/Nuget/gsudo.csproj b/build/Nuget/gsudo.csproj index 13387ea0..442ef354 100644 --- a/build/Nuget/gsudo.csproj +++ b/build/Nuget/gsudo.csproj @@ -2,12 +2,11 @@ 1.0.0.0 - GerardoGrignoli - GerardoGrignoli - gsudo + Gerardo Grignoli + Gerardo Grignoli gsudo gsudo;sudo;runas - gsudo + gsudo is a sudo for Windows, allows to run commands with elevated permissions in the current console. netstandard2.0 true false @@ -15,6 +14,11 @@ true false true + Gerardo Grignoli and GitHub Contributors + MIT + https://github.com/gerardog/gsudo + https://github.com/gerardog/gsudo + GIT