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 gdisk 1.0.9 #1423

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
33 changes: 33 additions & 0 deletions build_patch/gdisk/gpt-sig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/gpt.cc b/gpt.cc
index 24d6918..4130352 100644
--- a/gpt.cc
+++ b/gpt.cc
@@ -506,24 +506,24 @@ int GPTData::CheckHeaderValidity(void) {
// a message is displayed in the ReversePartitionBytes() function
if ((mainHeader.signature != GPT_SIGNATURE) || (!CheckHeaderCRC(&mainHeader, 1))) {
valid -= 1;
- } else if ((mainHeader.revision != 0x00010000) && valid) {
+ } else if ((mainHeader.revision != 0x00000001) && valid) {
valid -= 1;
cout << "Unsupported GPT version in main header; read 0x";
cout.width(8);
cout << hex << mainHeader.revision << ", should be\n0x";
cout.width(8);
- cout << UINT32_C(0x00010000) << dec << "\n";
+ cout << UINT32_C(0x00000001) << dec << "\n";
} // if/else/if

if ((secondHeader.signature != GPT_SIGNATURE) || (!CheckHeaderCRC(&secondHeader))) {
valid -= 2;
- } else if ((secondHeader.revision != 0x00010000) && valid) {
+ } else if ((secondHeader.revision != 0x00000001) && valid) {
valid -= 2;
cout << "Unsupported GPT version in backup header; read 0x";
cout.width(8);
cout << hex << secondHeader.revision << ", should be\n0x";
cout.width(8);
- cout << UINT32_C(0x00010000) << dec << "\n";
+ cout << UINT32_C(0x00000001) << dec << "\n";
} // if/else/if

// Check for an Apple disk signature
45 changes: 45 additions & 0 deletions makefiles/gdisk.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
ifneq ($(PROCURSUS),1)
$(error Use the main Makefile)
endif

SUBPROJECTS += gdisk
GDISK_VERSION := 1.0.9
DEB_GDISK_V ?= $(GDISK_VERSION)

gdisk-setup: setup
$(call DOWNLOAD_FILES,$(BUILD_SOURCE),https://sourceforge.net/projects/gptfdisk/files/gptfdisk/$(GDISK_VERSION)/gptfdisk-$(GDISK_VERSION).tar.gz)
$(call EXTRACT_TAR,gptfdisk-$(GDISK_VERSION).tar.gz,gptfdisk-$(GDISK_VERSION),gdisk)
$(call DO_PATCH,gdisk,gdisk,-p1)

ifneq ($(wildcard $(BUILD_WORK)/gdisk/.build_complete),)
gdisk:
@echo "Using previously built gdisk."
else
gdisk: gdisk-setup
# TODO: fix the makefile, it sucks ass
+$(MAKE) -C $(BUILD_WORK)/gdisk
mkdir -p $(BUILD_STAGE)/gdisk/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin
mv $(BUILD_WORK)/gdisk/gdisk $(BUILD_STAGE)/gdisk/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin
$(call AFTER_BUILD,copy)
endif

gdisk-package: gdisk-stage
# gdisk.mk Package Structure
rm -rf $(BUILD_DIST)/gdisk
mkdir -p $(BUILD_DIST)/gdisk/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin

# gdisk.mk Prep gdisk
cp -a $(BUILD_STAGE)/gdisk/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin/gdisk $(BUILD_DIST)/gdisk/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin

# gdisk.mk Sign
# TODO: This probably needs more entitlements
$(call SIGN,gdisk,general.xml)

# gdisk.mk Make .debs
# TODO: control file
$(call PACK,gdisk,DEB_GDISK_V)

# gdisk.mk Build cleanup
rm -rf $(BUILD_DIST)/gdisk

.PHONY: gdisk gdisk-package