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

Fix wine executable check #513

Open
aentwist opened this issue May 7, 2024 · 2 comments
Open

Fix wine executable check #513

aentwist opened this issue May 7, 2024 · 2 comments

Comments

@aentwist
Copy link

aentwist commented May 7, 2024

Description

The check for wine executable is incorrect. When installing wine, we use the wine metapackage wine. It only installs wine64 behind the scenes.

export async function createWindowsInstaller(options: SquirrelWindowsOptions): Promise<void> {
let useMono = false;
const monoExe = 'mono';
const wineExe = ['arm64', 'x64'].includes(process.arch) ? 'wine64' : 'wine';
if (process.platform !== 'win32') {
useMono = true;
const [hasWine, hasMono] = await Promise.all([
checkIfCommandExists(wineExe),
checkIfCommandExists(monoExe)
]);
if (!hasWine || !hasMono) {
throw new Error('You must install both Mono and Wine on non-Windows');
}

function checkIfCommandExists(command: string): Promise<boolean> {
const checkCommand = os.platform() === 'win32' ? 'where' : 'which';
return new Promise((resolve) => {
exec(`${checkCommand} ${command}`, (error) => {

x64 -> check for wine64 -> not found -> fail

Meanwhile

$ which wine
/usr/bin/wine
$ which wine64

$ apt search wine | grep wine
[...]
wine/stable,now 8.0~repack-4 all [installed] <- we install this metapackage
wine-binfmt/stable 8.0~repack-4 all
wine64/stable,now 8.0~repack-4 amd64 [installed,automatic] <- we get this

Expected

npm run make -- --platform win32 no wine or mono error

Actual

You must install both Mono and Wine on non-Windows

Proposed Solution

The proposal is to not trouble ourselves with it too much unless there is a real reason we need to make sure 64-bit has 64-bit and 32 has 32. But couldn't a 64-bit user have a 32-bit copy anyway..?

const wineExe = "wine";
const wine64Exe = "wine64";

///

    // Promise.all would be helpful if we were trying to combine these promises into one... but we aren't
    const hasWine = await checkIfCommandExists(wineExe);
    const hasWine64 = await checkIfCommandExists(wine64Exe);
    const hasMono = await checkIfCommandExists(monoExe);

    if (!(hasWine || hasWine64) || !hasMono) {
      throw new Error('You must install both Mono and Wine on non-Windows');
    }

Environment

Debian 12

$ uname -r
5.15.146.1-microsoft-standard-WSL2
$ node
> process.arch
x64
@aentwist
Copy link
Author

aentwist commented May 7, 2024

Workaround is this absurd article, a remarkable pages-long effort that just says 'symlink it' :)

sudo ln -s /usr/bin/wine /usr/bin/wine64

@zorn-v
Copy link

zorn-v commented Sep 17, 2024

#530
But your "proposed solution" I like better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants