Last active
March 9, 2023 21:54
-
-
Save wsdookadr/9cef27eef9f90962d8fe66ea67012d1f to your computer and use it in GitHub Desktop.
Fetch & build github repos for studying purposes (built to run on WSL on Windows)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Builds all the repos. Yes it assumes they're .NET projects. | |
| # This can be adapted to other toolchains and makefiles (automake / cmake / npm / ninja / etc) | |
| # of your choice. | |
| # | |
| for d in $(find -maxdepth 1 -mindepth 1 -type d); do | |
| cd $d | |
| echo "== $d ==" | |
| #find -name "build*cmd" | xargs -I{} powershell.exe -c './{}' ; | |
| #find -name "*setup*cmd" | xargs -I{} powershell.exe -c './{}' ; | |
| #find -name "build*ps1" | xargs -I{} powershell.exe {} ; | |
| find -name "*.sln" | xargs -I{} powershell.exe -c 'dotnet build {}' ; | |
| cd .. | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Fetches all the repos and their submodules | |
| # | |
| git clone https://github.com/user/repo1 | |
| git clone https://github.com/user/repo2 | |
| for d in $(find -maxdepth 1 -mindepth 1 -type d); do | |
| cp fix_submodule_urls.sh $d/ | |
| cd $d | |
| ./fix_submodule_urls.sh | |
| cd .. | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Many repos on Github have gitmodules with SSH remotes instead of HTTPS remotes. | |
| # The authors probably forget to switch to HTTPS remotes.. | |
| # This script fixes that, does the SSH -> HTTPS conversion, so you can actually | |
| # fetch the submodules. | |
| # | |
| for sm in $( git submodule | awk '{print $2}'); do | |
| url=$(git config --file .gitmodules --get-regexp url | grep $sm | awk '{print $2}') | |
| fix=$(echo $url | sed -e "s/git@\(.*\):\(.*\)\.git/https:\/\/\1\/\2.git/") | |
| echo "$url $fix" | |
| git submodule set-url $sm $fix | |
| done | |
| git submodule sync | |
| git submodule update --init --recursive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for d in $(find -maxdepth 1 -mindepth 1 -type d); do | |
| zip -r -2 $d.zip $d/ | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment