Skip to content
Open
Show file tree
Hide file tree
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ scripts/packer/iso/*.iso
scripts/packer/packer_cache
scripts/packer/output-*
*.box

*.code-workspace
9 changes: 8 additions & 1 deletion scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ Param(
[string]$terminal = 'all',

# Build launcher if you have MSBuild tools installed
[switch]$Compile
[switch]$Compile,

# Install pacman if not present
[switch]$InstallPacman
)

# Get the scripts and cmder root dirs we are building in.
Expand Down Expand Up @@ -199,6 +202,10 @@ if (-not $noVendor) {
Copy-Item $($saveTo + "git-prompt.sh") $($saveTo + "git-for-windows/etc/profile.d/git-prompt.sh")
}

if ( $InstallPacman -and !(Test-Path $($saveTo + "git-for-windows/usr/bin/pacman.exe") ) ) {
Write-Verbose "Installing pacman..."
& $($saveTo + "git-for-windows/bin/bash.exe") $($saveTo + "../scripts/install_pacman.sh")
}
Pop-Location
}

Expand Down
128 changes: 128 additions & 0 deletions scripts/install_pacman.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#!/usr/bin/env bash

# Based on: https://github.com/mcgitty/pacman-for-git
# Dax T. Games Fork: https://github.com/daxgames/pacman-for-git

# Disclaimer: Use at your own risk.
#
# This script modifies system files and installs the pacman package manager into your Git for Windows environment.
#
# While it has been tested in various Git for Windows versions, there is always a risk of data loss or system instability when running scripts that alter executable files and shared libraries.
#
# Make sure to back up any important data before proceeding.
#
# Always review and understand scripts from external sources prior to execution.

export bin_source=${1:-https://github.com/daxgames/pacman-for-git/raw/refs/heads/main}
export HOME=$(cygpath -u "$USERPROFILE")
echo "Using binary source: $bin_source"
echo "Using HOME directory: $HOME"

if [[ "$HOSTTYPE" == "i686" ]]; then
pacman=(
pacman-6.0.0-4-i686.pkg.tar.zst
pacman-mirrors-20210703-1-any.pkg.tar.zst
msys2-keyring-1~20210213-2-any.pkg.tar.zst
)

zstd=zstd-1.5.0-1-i686.pkg.tar.xz
zstd_win=https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-v1.5.5-win32.zip
else
pacman=(
pacman-6.0.1-18-x86_64.pkg.tar.zst
pacman-mirrors-20220205-1-any.pkg.tar.zst
msys2-keyring-1~20220623-1-any.pkg.tar.zst
)

zstd=zstd-1.5.2-1-x86_64.pkg.tar.xz
zstd_win=https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-v1.5.5-win64.zip
fi

echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo Downloading pacman files...
echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
for f in "${pacman[@]}"; do
echo "Running: curl -sLkf -o \"$HOME/Downloads/$f\" \"${bin_source}/$f\""
curl -sLkf -o "$HOME/Downloads/$f" "${bin_source}/$f" || exit 1
done
echo -e "\n=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"

echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo Downloading zstd binaries...
echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo "Running: curl -sLkf -o \"$HOME/Downloads/$zstd\" \"${bin_source}/$zstd\""
curl -sLkf -o "$HOME/Downloads/$zstd" "${bin_source}/$zstd" || exit 1
echo "Running: curl -sLkf -o \"$HOME/Downloads/$(basename \"${zstd_win}\")\" \"$zstd_win\""
curl -sLkf -o "$HOME/Downloads/$(basename "${zstd_win}")" "$zstd_win" || exit 1
echo -e "\n=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"

echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo Downloading pacman.conf...
echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo "Running: curl -Lk https://raw.githubusercontent.com/msys2/MSYS2-packages/7858ee9c236402adf569ac7cff6beb1f883ab67c/pacman/pacman.conf"
curl -sLk https://raw.githubusercontent.com/msys2/MSYS2-packages/7858ee9c236402adf569ac7cff6beb1f883ab67c/pacman/pacman.conf -o /etc/pacman.conf || exit 1

pushd "$HOME/Downloads"
[[ -d "$(basename "${zstd_win}" | sed 's/\.zip$//')" ]] && \
rm -rf "$(basename "${zstd_win}" | sed 's/\.zip$//')"
unzip "$HOME/Downloads/$(basename "${zstd_win}")"
export PATH="$PATH:$HOME/Downloads/$(basename "${zstd_win}" | sed 's/\.zip$//')"
popd
echo -e "\n=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"

cd /
echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo Installing pacman files...
echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo "Extracting zstd to /usr..."
tar x --xz -vf "$HOME/Downloads/$zstd" usr

for f in "${pacman[@]}"; do
echo "Extracting $f to /usr and /etc..."
tar x --zstd -vf "$HOME/Downloads/$f" usr etc 2>/dev/null
done
echo -e "\n=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"

echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo Initializing pacman...
echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
mkdir -p /var/lib/pacman
ln -sf "$(which gettext)" /usr/bin/
pacman-key --init
pacman-key --populate msys2
pacman -Syu --noconfirm --disable-download-timeout
echo -e "\n=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"

echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo Getting package versions for the installed Git release
echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
t=$(grep -E 'mingw-w64-[ix_0-9]+-git ' /etc/package-versions.txt)
echo "Found package version line: $t"

curl --help >/dev/null 2>&1 || { echo "ERROR: curl is not installed properly."; exit 1; }

echo "Getting commit ID that matches '$t' from github pacman-for-git..."
t=$(curl -sLk "${bin_source}/version-tags.txt" | grep "$t")
echo "Full line from version-tags.txt: '$t'"

[[ "$t" == "" ]] && echo "ERROR: Commit ID not logged in github pacman-for-git." && exit 1
echo -e "Using commit ID: '${t##* }'"
echo -e "\n=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"

echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo Downloading package database files for the installed Git release
echo =-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
b=64 && [[ "$t" == *-i686-* ]] && b=32
URL="https://github.com/git-for-windows/git-sdk-$b/raw/${t##* }"
while read -r p v; do
d="/var/lib/pacman/local/$p-$v"
mkdir -p "$d"
echo "$d"

for f in desc files mtree; do
curl -fsSL "$URL$d/$f" -o "$d/$f"
done

[[ ! -f "$d/desc" ]] && rmdir "$d" && echo "Missing $d"
done < /etc/package-versions.txt
echo -e "\n=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"
50 changes: 25 additions & 25 deletions vendor/sources.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
[
{
"name": "git-for-windows",
"version": "2.51.2.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.51.2.windows.1/PortableGit-2.51.2-64-bit.7z.exe"
},
{
"name": "clink",
"version": "1.8.8",
"url": "https://github.com/chrisant996/clink/releases/download/v1.8.8/clink.1.8.8.a63364.zip"
},
{
"name": "conemu-maximus5",
"version": "23.07.24",
"url": "https://github.com/ConEmu/ConEmu/releases/download/v23.07.24/ConEmuPack.230724.7z"
},
{
"name": "windows-terminal",
"version": "1.23.12811.0",
"url": "https://github.com/microsoft/terminal/releases/download/v1.23.12811.0/Microsoft.WindowsTerminal_1.23.12811.0_x64.zip"
},
{
"name": "clink-completions",
"version": "0.6.6",
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.6.6.zip"
}
{
"name": "git-for-windows",
"version": "2.52.0.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.52.0.windows.1/PortableGit-2.52.0-64-bit.7z.exe"
},
{
"name": "clink",
"version": "1.9.5",
"url": "https://github.com/chrisant996/clink/releases/download/v1.9.5/clink.1.9.5.ee6b4f.zip"
},
{
"name": "conemu-maximus5",
"version": "23.07.24",
"url": "https://github.com/ConEmu/ConEmu/releases/download/v23.07.24/ConEmuPack.230724.7z"
},
{
"name": "windows-terminal",
"version": "1.23.12811.0",
"url": "https://github.com/microsoft/terminal/releases/download/v1.23.12811.0/Microsoft.WindowsTerminal_1.23.12811.0_x64.zip"
},
{
"name": "clink-completions",
"version": "0.6.7",
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.6.7.zip"
}
]
Loading