Skip to content

Commit 0135fca

Browse files
anjannathpraveenkumar
authored andcommitted
choco: add instructions to verify the hashes of embedded files
adds makefile target to generate the VERIFICATION.txt and LICENSE.txt files in the required format LICENSE.txt should contain a From: <LICENSE file URL> at the top VERIFICATION.txt should contains steps to verify the hashes of the embedded files as well as their hashes
1 parent a52b5f5 commit 0135fca

File tree

4 files changed

+41
-8
lines changed

4 files changed

+41
-8
lines changed

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,25 @@ $(BUILD_DIR)/windows-amd64/crc-windows-installer.zip: $(BUILD_DIR)/windows-amd64
402402

403403
.PHONY: choco choco-clean
404404
CHOCO_PKG_DIR = packaging/chocolatey/crc
405-
choco: clean choco-clean $(BUILD_DIR)/windows-amd64/crc.exe $(HOST_BUILD_DIR)/crc-embedder $(CHOCO_PKG_DIR)/crc.nuspec
405+
$(CHOCO_PKG_DIR)/tools/crc-admin-helper-windows.exe: $(HOST_BUILD_DIR)/crc-embedder
406406
$(HOST_BUILD_DIR)/crc-embedder download --goos=windows --components=admin-helper $(CHOCO_PKG_DIR)/tools
407+
choco: clean choco-clean $(BUILD_DIR)/windows-amd64/crc.exe $(CHOCO_PKG_DIR)/tools/crc-admin-helper-windows.exe $(CHOCO_PKG_DIR)/crc.nuspec $(CHOCO_PKG_DIR)/VERIFICATION.txt
407408
cp $(BUILD_DIR)/windows-amd64/crc.exe $(CHOCO_PKG_DIR)/tools/crc.exe
408-
cp LICENSE $(CHOCO_PKG_DIR)/tools/LICENSE.txt
409+
mv $(CHOCO_PKG_DIR)/VERIFICATION.txt $(CHOCO_PKG_DIR)/tools/VERIFICATION.txt
410+
powershell.exe -NoProfile -Command "@('From: https://github.com/crc-org/crc/blob/main/LICENSE') + (Get-Content 'LICENSE') | Set-Content $(CHOCO_PKG_DIR)/tools/LICENSE.txt"
409411
cd $(CHOCO_PKG_DIR) && choco pack
410412
choco-clean:
411413
rm -f $(CHOCO_PKG_DIR)/*.nupkg
412414
rm -f $(CHOCO_PKG_DIR)/tools/*.exe
415+
rm -f $(CHOCO_PKG_DIR)/crc.nuspec
416+
rm -f $(CHOCO_PKG_DIR)/tools/VERIFICATION.txt
417+
418+
ADMIN_HELPER_HASH = $(shell powershell.exe -NoProfile -Command "Get-FileHash -Algorithm SHA256 $(CHOCO_PKG_DIR)/tools/crc-admin-helper-windows.exe | Select-Object -ExpandProperty Hash")
419+
HELPER_SCRIPT_HASH = $(shell powershell.exe -NoProfile -Command "Get-FileHash -Algorithm SHA256 $(CHOCO_PKG_DIR)/tools/crcprerequisitesetup.ps1 | Select-Object -ExpandProperty Hash")
420+
# todo: retreive this dynamically instead of setting here
421+
ADMIN_HELPER_VERSION = 0.0.12
422+
%.txt: %.txt.in
423+
@sed -e 's/__ADMIN_HELPER_CHECKSUM__/'$(ADMIN_HELPER_HASH)'/g' \
424+
-e 's/__HELPER_SCRIPT_CHECKSUM__/'$(HELPER_SCRIPT_HASH)'/g' \
425+
-e 's/__ADMIN_HELPER_VERSION__/'$(ADMIN_HELPER_VERSION)'/g' \
426+
$< >$@

packaging/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@
1515
/chocolatey/crc/crc.nuspec
1616
/chocolatey/crc/tools/*.exe
1717
/chocolatey/crc/tools/LICENSE.txt
18+
/chocolatey/crc/VERIFICATION.txt
19+
/chocolatey/crc/tools/VERIFICATION.txt
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
VERIFICATION
2+
3+
Verification is intended to assist the Chocolatey moderators and community
4+
in verifying that this package's contents are trustworthy.
5+
6+
This package is published by the CRC project itself.
7+
8+
There are two embedded files in the package, those can be verified like this:
9+
10+
1. crc.exe
11+
- crc.exe is built from source while building the chocolatey package, the chocolatey package specific files lives in the same
12+
git repo as the CRC project at: https://github.com/crc-org/crc/tree/main/packaging/chocolatey/crc
13+
the chocolatey package is also published by CRC project itself.
14+
15+
2. crc-admin-helper-windows.exe
16+
- Go to https://github.com/crc-org/admin-helper/releases/download/v__ADMIN_HELPER_VERSION__/crc-admin-helper-windows.exe to download the binary
17+
- User posh cmdlet 'Get-FileHash -Algorithm SHA256' to obtain the hash for the downloaded binary
18+
- Checksum SHA256: __ADMIN_HELPER_CHECKSUM__
19+
20+
3. crcprerequisitesetup.ps1
21+
- Go to https://github.com/crc-org/crc/raw/main/packaging/chocolatey/crc/tools/crcprerequisitesetup.ps1 to download the script
22+
- User posh cmdlet 'Get-FileHash -Algorithm SHA256' to obtain the hash for the downloaded script
23+
- Checksum SHA256: __HELPER_SCRIPT_CHECKSUM__

packaging/chocolatey/crc/tools/VERIFICATION.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)