diff --git a/.editorconfig b/.editorconfig index 1f3a579c36..87230b083c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,3 +18,8 @@ end_of_line = crlf [*.{yml, yaml}] indent_size = 2 + +# Makefiles require tab indentation +[{{M,m,GNU}akefile{,.*},*.mak,*.mk}] +indent_style = tab +end_of_line = lf diff --git a/lib/core.ps1 b/lib/core.ps1 index a917f2673e..509af16001 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -578,7 +578,7 @@ function shim($path, $global, $name, $arg) { if($path -match '\.(exe|com)$') { # for programs with no awareness of any shell - Copy-Item "$(versiondir 'scoop' 'current')\supporting\shimexe\bin\shim.exe" "$shim.exe" -force + Copy-Item (get_shim_path) "$shim.exe" -force write-output "path = $resolved_path" | out-file "$shim.shim" -encoding utf8 if($arg) { write-output "args = $arg" | out-file "$shim.shim" -encoding utf8 -append @@ -608,6 +608,18 @@ powershell -noprofile -ex unrestricted `"& '$resolved_path' $arg %args%;exit `$l } } +function get_shim_path() { + $shim_path = "$(versiondir 'scoop' 'current')\supporting\shimexe\bin\shim.exe" + $shim_version = get_config 'shim' 'default' + switch ($shim_version) { + '71' { $shim_path = "$(versiondir 'scoop' 'current')\supporting\shims\71\shim.exe" } + 'kiennq' { $shim_path = "$(versiondir 'scoop' 'current')\supporting\shims\kiennq\shim.exe" } + 'default' { $true } + default { warn "Unknown shim version: '$shim_version'" } + } + return $shim_path +} + function search_in_path($target) { $path = (env 'PATH' $false) + ";" + (env 'PATH' $true) foreach($dir in $path.split(';')) { diff --git a/supporting/shims/71/checksum.sha256 b/supporting/shims/71/checksum.sha256 new file mode 100644 index 0000000000..37a3bd1111 --- /dev/null +++ b/supporting/shims/71/checksum.sha256 @@ -0,0 +1 @@ +70d4690b8ac3b3f715f537cdea6e07a39fda4bc0347bf6b958e4f3ff2f0e04d4 shim.exe diff --git a/supporting/shims/71/checksum.sha512 b/supporting/shims/71/checksum.sha512 new file mode 100644 index 0000000000..116bcee6e8 --- /dev/null +++ b/supporting/shims/71/checksum.sha512 @@ -0,0 +1 @@ +ecde07b32192846c4885cf4d2208eedc170765ea115ae49b81509fed0ce474e21064100bb2f3d815ee79f1c12463d32ef013d4182647eae71855cd18e4196176 shim.exe diff --git a/supporting/shims/71/shim.exe b/supporting/shims/71/shim.exe new file mode 100644 index 0000000000..a812637075 Binary files /dev/null and b/supporting/shims/71/shim.exe differ diff --git a/supporting/shims/kiennq/.gitignore b/supporting/shims/kiennq/.gitignore new file mode 100644 index 0000000000..d271c6ed48 --- /dev/null +++ b/supporting/shims/kiennq/.gitignore @@ -0,0 +1,2 @@ +*.zip +*.bak diff --git a/supporting/shims/kiennq/Makefile b/supporting/shims/kiennq/Makefile new file mode 100644 index 0000000000..531db7048d --- /dev/null +++ b/supporting/shims/kiennq/Makefile @@ -0,0 +1,52 @@ + +VER?=2.2.1 +ZIP=shimexe-$(VER).zip +URL?=https://github.com/kiennq/scoop-better-shimexe/releases/download/$(VER)/$(ZIP) +LATEST_URL?=https://github.com/kiennq/scoop-better-shimexe/releases/latest +NEWVER=$(shell cat version.txt) + +all: verify ## make download upzip verify + +version.txt: + @curl --max-redirs 0 -s -D - -o /dev/null $(LATEST_URL) | grep -i ^location | sed -E -e "s|.*/([^/]+)$$|\1|" >version.txt + @printf "%s " "Latest version is:" + @cat version.txt + +check: version.txt ## Check the version number in version.txt and update if needed + +bump: check ## Bump version number in Makefile + @rm -f Makefile.bak + @sed -i.bak -e 's|=$(VER)|=$(NEWVER)|' Makefile + @cmp --quiet Makefile{,.bak} || echo "Makefile bumped from $(VER) to $(NEWVER)" + +$(ZIP): version.txt + curl -L -s -o $(ZIP) $(URL) + @touch $@ + +download: $(ZIP) ## Download shim from https://github.com/kiennq/scoop-better-shimexe + +shim.exe: $(ZIP) + unzip -z -j -o $(ZIP) + @touch $@ + +unzip: shim.exe ## Unzip download + +verify: shim.exe ## Version SHA256 checksum for shim.exe + sed -e "s|bin/||" checksum.sha256 | sha256sum -c + +clean: ## Clean .zip files + rm -f *.zip + +help: ## Display help text + @printf "%-8s %s\n" Target Description + @printf "%-8s %s\n" '--------' '------------------------------------------' + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-8s %s\n", $$1, $$2}' + +.PHONY: all +.PHONY: bump +.PHONY: check +.PHONY: clean +.PHONY: download +.PHONY: help +.PHONY: unzip +.PHONY: verify diff --git a/supporting/shims/kiennq/checksum.sha256 b/supporting/shims/kiennq/checksum.sha256 new file mode 100644 index 0000000000..32944ff856 --- /dev/null +++ b/supporting/shims/kiennq/checksum.sha256 @@ -0,0 +1 @@ +aa685053f4a5c0e7145f2a27514c8a56ceae25b0824062326f04037937caa558 bin/shim.exe diff --git a/supporting/shims/kiennq/checksum.sha512 b/supporting/shims/kiennq/checksum.sha512 new file mode 100644 index 0000000000..c7014db2a0 --- /dev/null +++ b/supporting/shims/kiennq/checksum.sha512 @@ -0,0 +1 @@ +67c605c8163869d8ef8153c64eb09b82645cbae8228928c0fef944d0259a7b2d3791ecf4b4b01e23566916a878ee7977bfc1a59846bccf3c63bd6a1cf4f521b5 bin/shim.exe diff --git a/supporting/shims/kiennq/shim.exe b/supporting/shims/kiennq/shim.exe new file mode 100644 index 0000000000..743c9f1059 Binary files /dev/null and b/supporting/shims/kiennq/shim.exe differ diff --git a/supporting/shims/kiennq/version.txt b/supporting/shims/kiennq/version.txt new file mode 100644 index 0000000000..c043eea776 --- /dev/null +++ b/supporting/shims/kiennq/version.txt @@ -0,0 +1 @@ +2.2.1