diff --git a/build/Chocolatey/gsudo/tools/chocolateyinstall.ps1 b/build/Chocolatey/gsudo/tools/chocolateyinstall.ps1 index 38313a7..aa0e018 100644 --- a/build/Chocolatey/gsudo/tools/chocolateyinstall.ps1 +++ b/build/Chocolatey/gsudo/tools/chocolateyinstall.ps1 @@ -29,6 +29,11 @@ Install-ChocolateyPath -PathToInstall $SymLinkDir -PathType 'Machine' cmd /c mklink "$TargetDir\sudo.exe" "$TargetDir\gsudo.exe" 2>$null +# Copy gsudoModule to "$env:ProgramFiles\PowerShell\Modules\gsudoModule" +$PSModulesTargetDir = "$env:ProgramFiles\PowerShell\Modules\gsudoModule" +md $PSModulesTargetDir -ErrorAction SilentlyContinue +copy "$bin\*.ps*" $TargetDir -Exclude *.ignore -Force + $OldCurrentDir = Get-Item $SymLinkDir -ErrorAction ignore if ($OldCurrentDir) { @@ -43,13 +48,13 @@ cmd /c mklink /d "$SymLinkDir" "$TargetDir\" Write-Output "gsudo successfully installed. Please restart your consoles to use gsudo.`n" if (Get-Module gsudoModule) { - "Please restart PowerShell to update PowerShell gsudo Module." + "Please restart all your PowerShell consoles to update PowerShell gsudo Module." } else { & { - "PowerShell users: To use enhanced gsudo and Invoke-Gsudo cmdlet, add the following line to your `$PROFILE" - " Import-Module '$SymLinkDir\gsudoModule.psd1'" + "PowerShell users: Add auto-complete to gsudo by adding the following line to your `$PROFILE" + " Import-Module 'gsudoModule'" "Or run: " - " Write-Output `"``nImport-Module '$SymLinkDir\gsudoModule.psd1'`" | Add-Content `$PROFILE" + " Write-Output `"``nImport-Module 'gsudoModule'`" | Add-Content `$PROFILE" } } diff --git a/installgsudo.ps1 b/installgsudo.ps1 index cbe2a6b..5233194 100644 --- a/installgsudo.ps1 +++ b/installgsudo.ps1 @@ -43,10 +43,10 @@ else Write-Output "Please restart your consoles to use gsudo!`n" "PowerShell users: To use enhanced gsudo and Invoke-Gsudo cmdlet, add the following line to your `$PROFILE" - " Import-Module '${Env:ProgramFiles}\gsudo\Current\gsudoModule.psd1'" + " Import-Module 'gsudoModule'" "Or run: " " New-Item -Type Directory (`$PROFILE | Split-Path) -ErrorAction Ignore" - " Write-Output `"``nImport-Module '${Env:ProgramFiles}\gsudo\Current\gsudoModule.psd1'`" | Add-Content `$PROFILE" + " Write-Output `"``nImport-Module 'gsudoModule'`" | Add-Content `$PROFILE" Remove-Item $fileName }