return 0;
}
-static int hw_calculate_partition_table(struct hw_destination* dest) {
+static int hw_calculate_partition_table(struct hw_destination* dest, int disable_swap) {
char path[DEV_SIZE];
int part_idx = 1;
}
dest->size_boot = hw_boot_size(dest);
- dest->size_swap = hw_swap_size(dest);
dest->size_root = hw_root_size(dest);
+ // Should we use swap?
+ if (disable_swap)
+ dest->size_swap = 0;
+ else
+ dest->size_swap = hw_swap_size(dest);
+
// Determine the size of the data partition.
unsigned long long used_space = dest->size_bootldr + dest->size_boot
+ dest->size_swap + dest->size_root;
return 0;
}
-struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks) {
+struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks, int disable_swap) {
struct hw_destination* dest = malloc(sizeof(*dest));
if (part_type == HW_PART_TYPE_NORMAL) {
// Is this a RAID device?
dest->is_raid = (part_type > HW_PART_TYPE_NORMAL);
- int r = hw_calculate_partition_table(dest);
+ int r = hw_calculate_partition_table(dest, disable_swap);
if (r)
return NULL;
struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection);
struct hw_disk** hw_select_first_disk(const struct hw_disk** disks);
-struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks);
+struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks,
+ int disable_swap);
unsigned long long hw_memory();
int serial_console;
int require_networking;
int perform_download;
+ int disable_swap;
char download_url[STRING_SIZE];
} config = {
.unattended = 0,
.serial_console = 0,
.require_networking = 0,
.perform_download = 0,
+ .disable_swap = 0,
.download_url = DOWNLOAD_URL,
};
else if (strcmp(token, "installer.unattended") == 0)
c->unattended = 1;
+ // disable swap
+ else if (strcmp(token, "installer.disable-swap") == 0)
+ c->disable_swap = 1;
+
// download url
else if (strcmp(key, "installer.download-url") == 0) {
strncpy(c->download_url, val, sizeof(c->download_url));
hw_free_disks(disks);
- struct hw_destination* destination = hw_make_destination(part_type, selected_disks);
+ struct hw_destination* destination = hw_make_destination(part_type, selected_disks, config.disable_swap);
if (!destination) {
errorbox(_("Your harddisk is too small."));
fprintf(flog, "Memory : %lluMB\n", BYTES2MB(hw_memory()));
// Warn the user if there is not enough space to create a swap partition
- if (!config.unattended && !*destination->part_swap) {
- rc = newtWinChoice(title, _("OK"), _("Cancel"),
- _("Your harddisk is very small, but you can continue without a swap partition."));
+ if (!config.unattended) {
+ if (!config.disable_swap && !*destination->part_swap) {
+ rc = newtWinChoice(title, _("OK"), _("Cancel"),
+ _("Your harddisk is very small, but you can continue without a swap partition."));
- if (rc != 1)
- goto EXIT;
+ if (rc != 1)
+ goto EXIT;
+ }
}
// Filesystem selection
if (!config.unattended) {
struct filesystems {
int fstype;
- const char* description;
+ char* description;
} filesystems[] = {
{ HW_FS_EXT4, _("ext4 Filesystem") },
{ HW_FS_EXT4_WO_JOURNAL, _("ext4 Filesystem without journal") },
if (HW_FS_DEFAULT == filesystems[i].fstype)
fs_choice = i;
- fs_names[i] = &filesystems[i].description;
+ fs_names[i] = filesystems[i].description;
}
rc = newtWinMenu(_("Filesystem Selection"), _("Please choose your filesystem:"),