summaryrefslogtreecommitdiff
path: root/hscript/disk.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-23 00:30:01 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-23 00:30:01 -0600
commitec3c6667092c94b12be6b94340ee6007f987791f (patch)
treeb7b411eabb3740f7b942d07c5dea89b6f038d51f /hscript/disk.cc
parentb431adaa06c055105db1e73b34fe841b5a5e9597 (diff)
downloadhorizon-ec3c6667092c94b12be6b94340ee6007f987791f.tar.gz
horizon-ec3c6667092c94b12be6b94340ee6007f987791f.tar.bz2
horizon-ec3c6667092c94b12be6b94340ee6007f987791f.tar.xz
horizon-ec3c6667092c94b12be6b94340ee6007f987791f.zip
hscript: Handle Partition type codes
Diffstat (limited to 'hscript/disk.cc')
-rw-r--r--hscript/disk.cc24
1 files changed, 23 insertions, 1 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()),