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 shasum path #1793

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/electron/routing_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ async function installLinuxRoutingServices(): Promise<void> {
command +=
' && ' +
installationFileDescriptors
.map(({filename, sha256}) => `/usr/bin/echo "${sha256} ${path.join(tmp, filename)}" | /usr/bin/shasum -a 256 -c`)
.map(({filename, sha256}) => `/usr/bin/echo "${sha256} ${path.join(tmp, filename)}" | (/usr/bin/shasum -a 256 -c || /usr/bin/core_perl/shasum -a 256 -c)`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not really the logic we want. If the first command fails for whatever reason (e.g. fingerpring fails) we don't want to run the second command. And we don't want to try to run the first command if it doesn't exist. It's a lot cleaner and easier to reason about if you check the existence of the files before running them.

This also needs to be tested to make sure it works on Ubuntu/Debian, which is our only supported Linux.

/cc @jyyi1 to review

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, I'd rather test which shasum (either /usr/bin/shasum or /usr/bin/core_perl/shasum) exists before running the command, and only append the correct full shasum path to the command:

shasumCmd = findShasum() // this function returns `/usr/bin/shasum` or `/usr/bin/core_perl/shasum` depending on which one exists
command +=
  ' && ' +
  installationFileDescriptors
    .map(({filename, sha256}) => `/usr/bin/echo "${sha256}  ${path.join(tmp, filename)}" | ${shasumCmd} -a 256 -c`)

.join(' && ');
command += ` && "${path.join(tmp, LINUX_INSTALLER_FILENAME)}" "${userInfo().username}"`;

Expand Down
Loading