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 a script for installing and updating Git-for-windows on Msys2 ( including Git-for-windows ) and Cygwin #261

Merged
merged 4 commits into from
Nov 5, 2019

Conversation

sinloss
Copy link
Contributor

@sinloss sinloss commented Oct 15, 2019

As adviced by @dscho in the thread git-for-windows/git#1335, I committed this PR to find a home for these scripts which might and are glad to help others

The gitupdate could install and update the git-for-windows's binary and copy all necessary files on msys2 without messing up your msys2 due to the already installed msys2 environment which has already contained most of the files which are needed by the git-for-windows's binary files. This script will check the latest released version of the git-for-windows via its tags page on Github and then download it using wget or curl (if wget cound not be found nor installed by Pacman)... and then extract files into /tmp from the downloaded installer using innounp, copy necessary files and clean up all the temp files at last.

The upkit is a tool kit for gitupdate containing some reusable functions, this might be useful if someone wants to write a similar script. I personally wrote a script to install and update the latest metasploit-framework using upkit as well. (If anyone is interested, I could create a public repo and share that)

This might work on cygwin, but not assured.

Signed-off-by: liuxy [email protected]

This script could install and update the git-for-windows's binary and
necessary files on msys2 without messing up your msys2 due to the
already installed msys2 has already contained most of the files which is
needed by the git-for-windows's binary files. This script will check the
latest released version of the git-for-windows via its tags page on
github and then download it via wget or curl... and then extract, copy
and clean up

Signed-off-by: liuxy <[email protected]>
@dscho
Copy link
Member

dscho commented Oct 15, 2019

Two questions:

  1. Would it be possible to find a better home for that script? I mean, if this is intended to be installed together with Git for Windows, or with Portable Git, then it won't be found if it is in build-extra.
  2. I cannot accept a PR with binaries. It is one thing to install it via pacman in a script, it is a totally different thing to accept an .exe from an untrusted source... Maybe you want to make sure that the script downloads the innounp.exe file (actually the .tar.xz one) from the Pacman repository?

@sinloss
Copy link
Contributor Author

sinloss commented Oct 16, 2019

Two questions:

  1. Would it be possible to find a better home for that script? I mean, if this is intended to be installed together with Git for Windows, or with Portable Git, then it won't be found if it is in build-extra.
  2. I cannot accept a PR with binaries. It is one thing to install it via pacman in a script, it is a totally different thing to accept an .exe from an untrusted source... Maybe you want to make sure that the script downloads the innounp.exe file (actually the .tar.xz one) from the Pacman repository?
  1. I'm not sure... my intention is just to follow your advice to give it a home here, I comprehended your advice in the other thread as that somehow this script might not as useful in the git repo. But if it does, I'll be glad to submit a PR there...
    And if it goes that way, I might need to adjust these scripts to adapt both mingw32 / mingw64 environments... that would take some time. Any suggestions or advice are appreciated.
  2. The innounp.exe is written in and built by Delphi, and this makes it hard to create a package in the Pacman repository according to my knowledge(msys2 needed the package to be reproducible, and it's hard to achieve without a proper compiler to compile pascal). But I could just download the Git-2.23.0-64-bit.tar.bz2 instead of the installer, it's just bigger in size, but not a problem...

@sinloss
Copy link
Contributor Author

sinloss commented Oct 21, 2019

@dscho If it's not too late, may I ask where may I submit these scripts, here or the repo git-for-windows/git?

@dscho
Copy link
Member

dscho commented Oct 21, 2019

Sorry for the delay in answering; I've been a bit busy with preparing Git for Windows v2.24.0-rc0 (and it is still not finished, I am waiting for the automation to fail again so that I can fix yet another problem...).

Two questions:

  1. Would it be possible to find a better home for that script? I mean, if this is intended to be installed together with Git for Windows, or with Portable Git, then it won't be found if it is in build-extra.
  1. I'm not sure... my intention is just to follow your advice to give it a home here, I comprehended your advice in the other thread as that somehow this script might not as useful in the git repo. But if it does, I'll be glad to submit a PR there...

And if it goes that way, I might need to adjust these scripts to adapt both mingw32 / mingw64 environments... that would take some time. Any suggestions or advice are appreciated.

Oh, sorry, I think this is the correct repository. But I thought your script was meant to be run in a fully populated Git for Windows SDK? If so, it would probably make sense to install it as part of the git-extra package, whose contents can be found in this repository's git-extra/ subdirectory.

  1. I cannot accept a PR with binaries. It is one thing to install it via pacman in a script, it is a totally different thing to accept an .exe from an untrusted source... Maybe you want to make sure that the script downloads the innounp.exe file (actually the .tar.xz one) from the Pacman repository?
  1. The innounp.exe is written in and built by Delphi, and this makes it hard to create a package in the Pacman repository according to my knowledge(msys2 needed the package to be reproducible, and it's hard to achieve without a proper compiler to compile pascal). But I could just download the Git-2.23.0-64-bit.tar.bz2 instead of the installer, it's just bigger in size, but not a problem...

Silly question: why not just run the Portable installer in silent mode?

@sinloss
Copy link
Contributor Author

sinloss commented Oct 25, 2019

Thank you for your hard-working on Git-for-windows to bring us a great experience in using Git on windows, it's a great thing for all developers! A great work!

Two questions:

  1. Would it be possible to find a better home for that script? I mean, if this ...
  1. I'm not sure... my intention is just to follow your advice to give it a home ...

Oh, sorry, I think this is the correct repository. But I thought your script was meant to be run in a fully populated Git for Windows SDK? If so, it would probably make sense to install it as part of the git-extra package, whose contents can be found in this repository's git-extra/ subdirectory.

To make it work, one of the executables of wget or curl is needed. As the curl is now included in Windows 10's system32 folder from 1803 and also included in /mingw64/bin, this script could work either.

  1. I cannot accept a PR with binaries. It is one thing to install it via pacman ...
  1. The innounp.exe is written in and built by Delphi, and this makes it hard ...

Silly question: why not just run the Portable installer in silent mode?

Whoa, I missed that simple solution... I didn't even notice that the self-extractable 7z package could do that kind of thing. that's a new thing I've learned today, thank you! I'll try that out in a few days.

@dscho
Copy link
Member

dscho commented Oct 25, 2019

Thank you for your hard-working on Git-for-windows to bring us a great experience in using Git on windows, it's a great thing for all developers! A great work!

You're welcome!!!

To make it work, one of the executables of wget or curl is needed. As the curl is now included in Windows 10's system32 folder from 1803 and also included in /mingw64/bin, this script could work either.

Excellent.

why not just run the Portable installer in silent mode?

Whoa, I missed that simple solution... I didn't even notice that the self-extractable 7z package could do that kind of thing. that's a new thing I've learned today, thank you! I'll try that out in a few days.

Perfect. Please do let us know how that goes.

That aside, this commit contains a lot of changes that can make it
possible to successfully get or update git-on-windows on `Msys2` or
`Cygwin` which is generally tested. Also, a feature of generating
scripts of adding and removing context menu items (`Git Bash Here` and
`Git GUI Here` is included in this commit so that user could easily add
or remove these two context menu items as they wish. Last but not least,
the two scripts are now one single file which makes it possible to call
this script without downloading via a single command `curl ... | bash`

Signed-off-by: liuxy <[email protected]>
@sinloss
Copy link
Contributor Author

sinloss commented Nov 3, 2019

@dscho
Hi there, it's been slightly busy lately, yet I finally get this done ( thanks to my weekend and the support from my wife, it is supposed to be me and her taking care of our baby together )... And also have it tested on Msys2 32 bit, Msys2 64 bit, Cygwin 64 bit and Git-for-Windows's Msys2 64 bit inside my Windows Sandbox on Windows 10 1903.
With my latest change, people could easily get or update Git for Windows on there Msys2 or Cygwin platform via curl https://raw.githubusercontent.com/git-for-windows/build-extra/master/git-extra/getgit | bash after this PR is merged.

So here's a question, is it worth to put an instruction about this feature in the readme?

@sinloss sinloss changed the title Add an updater for installing and updating git on msys2 or maybe cygwin Add a script for installing and updating git on Msys2 ( including Git-for-windows ) and Cygwin Nov 3, 2019
@sinloss sinloss changed the title Add a script for installing and updating git on Msys2 ( including Git-for-windows ) and Cygwin Add a script for installing and updating Git-for-windows on Msys2 ( including Git-for-windows ) and Cygwin Nov 3, 2019
…ere`

So that the generating feature won't fail when there's now /cmd folder
available, and fixes the `hook execution requires sh (not in PATH)`
error when using `Git GUI Here` on Cygwin whose default bin folder is
`/bin` rather than `/usr/bin`.

In addition:
There's a known issue that are hard to fix without breaking the
principle of `keeping every existing things intact`: the `Git Bash Here`
on Cygwin won't have a nice prompt which shows the current branch of
current directory. To fix this, the `/etc/bash.bashrc` needs be edited.

Signed-off-by: liuxy <[email protected]>
@dscho
Copy link
Member

dscho commented Nov 5, 2019

it's been slightly busy lately, yet I finally get this done ( thanks to my weekend and the support from my wife, it is supposed to be me and her taking care of our baby together )...

Oh, now I feel bad! Do go and spend time with your family, I would suggest. Git for Windows will still be there when you actually have time to work on it.

So here's a question, is it worth to put an instruction about this feature in the readme?

Sure, but please do not feel any pressure to add that!

@dscho dscho merged commit 64aa691 into git-for-windows:master Nov 5, 2019
@sinloss
Copy link
Contributor Author

sinloss commented Nov 6, 2019

So here's a question, is it worth to put an instruction about this feature in the readme?

Sure, but please do not feel any pressure to add that!

I could not find a sensible section to put in the readme, so I finally added an introduction in the wiki.

Oh, I followed you on twitter ⭐️ 😄.

@dscho
Copy link
Member

dscho commented Nov 6, 2019

I could not find a sensible section to put in the readme, so I finally added an introduction in the wiki.

That makes a lot of sense to me! Thank you!

@sinloss
Copy link
Contributor Author

sinloss commented Nov 7, 2019

I could not find a sensible section to put in the readme, so I finally added an introduction in the wiki.

That makes a lot of sense to me! Thank you!

My pleasure!

@sinloss sinloss deleted the gitupdate branch November 7, 2019 10:04
@elieux
Copy link
Contributor

elieux commented Nov 11, 2019

Hey, @sinloss. After discussing this installation method on Gitter, I would like to ask if you'd be okay with me reorganizing your wiki article to better separate the How to instructions from the rest.

@sinloss
Copy link
Contributor Author

sinloss commented Nov 12, 2019

Hey, @sinloss. After discussing this installation method on Gitter, I would like to ask if you'd be okay with me reorganizing your wiki article to better separate the How to instructions from the rest.

Sure! Of course.

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.

3 participants