diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-02-23 00:30:01 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-02-23 00:30:01 -0600 |
commit | ec3c6667092c94b12be6b94340ee6007f987791f (patch) | |
tree | b7b411eabb3740f7b942d07c5dea89b6f038d51f /hscript | |
parent | b431adaa06c055105db1e73b34fe841b5a5e9597 (diff) | |
download | horizon-ec3c6667092c94b12be6b94340ee6007f987791f.tar.gz horizon-ec3c6667092c94b12be6b94340ee6007f987791f.tar.bz2 horizon-ec3c6667092c94b12be6b94340ee6007f987791f.tar.xz horizon-ec3c6667092c94b12be6b94340ee6007f987791f.zip |
hscript: Handle Partition type codes
Diffstat (limited to 'hscript')
-rw-r--r-- | hscript/disk.cc | 24 | ||||
-rw-r--r-- | hscript/disk.hh | 6 |
2 files changed, 28 insertions, 2 deletions
diff --git a/hscript/disk.cc b/hscript/disk.cc index 4dbc471..bef0b73 100644 --- a/hscript/disk.cc +++ b/hscript/disk.cc @@ -458,11 +458,15 @@ Key *Partition::parseFromData(const std::string &data, int lineno, int *errors, type = Boot; } else if(typecode == "esp") { type = ESP; + } else if(typecode == "bios") { + type = BIOS; + } else if(typecode == "prep") { + type = PReP; } else { if(errors) *errors += 1; output_error("installfile:" + std::to_string(lineno), "partition: expected type code, got: " + typecode, - "valid type codes are 'boot' and 'esp'"); + "valid type codes are: boot esp bios prep"); return nullptr; } } @@ -558,6 +562,24 @@ bool Partition::execute(ScriptOptions opts) const { return false; } + switch(_type) { + case Boot: + ped_partition_set_flag(me, PED_PARTITION_BOOT, 1); + break; + case ESP: + ped_partition_set_flag(me, PED_PARTITION_ESP, 1); + break; + case BIOS: + ped_partition_set_flag(me, PED_PARTITION_BIOS_GRUB, 1); + break; + case PReP: + ped_partition_set_flag(me, PED_PARTITION_PREP, 1); + break; + case None: + /* we good */ + break; + } + int res = ped_disk_add_partition(disk, me, ped_constraint_any(dev)); if(res == 0) { output_error("installfile:" + std::to_string(this->lineno()), diff --git a/hscript/disk.hh b/hscript/disk.hh index 179807c..4adf8f5 100644 --- a/hscript/disk.hh +++ b/hscript/disk.hh @@ -83,7 +83,11 @@ public: /*! Bootable */ Boot, /*! EFI System Partition (GPT only) */ - ESP + ESP, + /*! GRUB BIOS (GPT only) */ + BIOS, + /*! PReP boot (MBR only) */ + PReP }; private: const std::string _block; |