Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add powershell app based on PowerShell Core 6.1, #1440

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/winetricks
Original file line number Diff line number Diff line change
Expand Up @@ -14953,6 +14953,45 @@ load_openwatcom()

#----------------------------------------------------------------

w_metadata powershell apps \
title="Windows Powershell" \
publisher="Microsoft" \
year="2019" \
media="download" \
file1="PowerShell-6.1.6-win-x86.zip" \
installed_file1="$W_SYSTEM32_DLLS_WIN/WindowsPowerShell/v1.0/powershell.exe"

load_powershell()
{
if test "$W_ARCH" = "win64"; then
w_die "Only implemented for 32bit arch at the moment"
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use w_package_unsupported_win64 for that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can technically add win64 support if you would prefer that. I don't really see an issue adding it.
However if you would like that indeed - what would be the best example of handling separate x86/64 archives?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be preferable, but not required.

There are several examples, e.g., amstream:
https://github.com/Winetricks/winetricks/blob/master/src/winetricks#L5586

you'll want to unconditionally install win32 (as win64 always supports win32), then selectively install win64 if $W_ARCH = win64.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am honestly not sure what is the right way to install this properly and integrate into system and how PATH is supposed to be set up in the right way if both 32 and 64 bit things are installed so I guess I'll just leave it as is here


w_warn "Installing Powershell into $W_SYSTEM32_DLLS_WIN/WindowsPowerShell/v1.0/"
w_warn "So that apps that require psh scripts to be executed would find it"
w_warn "Note that some functionality may not work without Windows Management Framework"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will give 3 popups in GUI mode, please combine it into one.


w_call dotnet462

w_download https://github.com/PowerShell/PowerShell/releases/download/v6.1.6/PowerShell-6.1.6-win-x86.zip 1dc690c9a1091d0ed5b71de903ab3cd7b58ba9638acdfeb9f9fe7031abaf47e9 PowerShell-6.1.6-win-x86.zip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're not changing the filename, there's no need to specify it as the last argument.


w_override_dlls native powershell.exe

# remove builtin placeholders
rm -f "$W_SYSTEM32_DLLS"/powershell.exe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prepend with w_try



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the extra newline.

mkdir -p "$W_SYSTEM32_DLLS"/WindowsPowerShell/v1.0

w_try_7z "$W_SYSTEM32_DLLS"/WindowsPowerShell/v1.0/ "${W_CACHE}/${W_PACKAGE}/${file1}"
w_try_cd "$W_SYSTEM32_DLLS"/WindowsPowerShell/v1.0
w_try cp -f pwsh.exe powershell.exe
for file in *\\*; do target="${file//\\//}"; mkdir -p "${target%/*}"; mv -v "$file" "$target"; done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mkdir/mv should be behind w_try().

This also introduces a bashism, causing travis to fail.

w_append_path "$W_SYSTEM32_DLLS"/WindowsPowerShell/v1.0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason for this is this is a non-compliant zip file that has back slashes. While unzip detects that and extracts archive reversing slashes it fails to successfully extract archive due to a different reasn (for w/e reason it creates one of directories without executable bit and then fails to extract files into it with permission denied)

}

#----------------------------------------------------------------

w_metadata protectionid apps \
title="Protection ID" \
publisher="CDKiLLER & TippeX" \
Expand Down