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

Added in support for Gitbash on Windows OS #31

Merged
merged 3 commits into from
Oct 7, 2022

Conversation

jdaniel-cpts
Copy link
Contributor

Description

Link to Feature Request: #30

New Feature: Ability for gvm to support Gitbash running on Windows OS. (64bit Windows)

  1. Added switching to support Windows OS so that script downloads zip file vs tar for alternative OS
  2. Updated checksum process to use Windows native checksum for sha256
  3. Generalized the downloaded file extension so it's a clean switch between .zip and .tar
  4. Since Windows doesn't handle symlinks gracefully had to introduce an explicit delete of the symlink directory before any new link is created. (Windows only).

Examples

Sample Run below of a simple go version switch (all credit to the gvm team, this is simply a port to Windows + Gitbash)

image

In order to test make sure you are running a modern version of Windows i.e. Windows 10 64bit.

Install Gitbash: https://www.makeuseof.com/install-git-git-bash-windows/ ( ✔️ Make sure you allow symlinks during install because gvm depends on it to link user to the elected version of go).

gvm
if [[ "$OSTYPE" == "msys"* ]]
then
FILESUM=$(certutil -hashfile $0 sha256 | tail -n2 | head -n1)
EXPECTEDSUM=$(curl -sL "$SUMPATH" | sed 's/ -//') # ⚠️ additional 2xspace + dash may also need to be addressed on unix installs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was interesting as I noticed the additional spaces and dash being appended to $EXPECTEDSUM coming from the $SUMPATH request. I don't have a lot of experience in bash so this may be expected in the Unix environment. Specifically when using shasum. Just thought I'd call it out that I had to strip these appended characters in order to accurately compare the file downloaded to the expected checksum.

Copy link
Member

Choose a reason for hiding this comment

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

I'll look into this

@benjivesterby
Copy link
Member

Thanks for the PR. I'll try and get to it in the next day or so. I'll stand up a VM to test as well.

@jdaniel-cpts
Copy link
Contributor Author

Thanks for the PR. I'll try and get to it in the next day or so. I'll stand up a VM to test as well.

Thank you! No rush at all.

gvm Outdated
@@ -2,7 +2,7 @@

###############################################################################
# GENERATED VERSION! DO NOT CHANGE! #
SCRIPTVERSION="local-dev"
SCRIPTVERSION="latest"
Copy link
Member

Choose a reason for hiding this comment

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

Can you update this to local-dev? The script version should be local-dev for changes. It's updated by the CI/CD pipeline to match the tagged version prior to generating the sum file for comparison on update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem. Just updated in latest commit.

Script version should read local-dev for any changes.  This is in support of the CI/CD pipeline.
@benjivesterby
Copy link
Member

@jdaniel-cpts Weekend ended up busier than expected. Will try and get to this this week. Sorry for the delay.

@jdaniel-cpts
Copy link
Contributor Author

@jdaniel-cpts Weekend ended up busier than expected. Will try and get to this this week. Sorry for the delay.

No problem!

@benjivesterby benjivesterby merged commit ada6fa1 into devnw:main Oct 7, 2022
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

Successfully merging this pull request may close these issues.

2 participants