# Create all directories
for i in addon-lang auth backup ca certs connscheduler crls ddns dhcp dhcpc dmzholes \
ethernet extrahd/bin fwlogs isdn key langs logging main mbmon menu.d modem net-traffic \
- net-traffic\templates nfs optionsfw outgoing/bin patches pakfire portfw \
+ net-traffic/templates nfs optionsfw outgoing/bin patches pakfire portfw \
ppp private proxy/advanced/cre proxy/calamaris/bin qos/bin red remote snort time tripwire/report \
updatexlrator/bin updatexlrator/autocheck urlfilter/autoupdate urlfilter/bin upnp vpn \
wakeonlan wireless xtaccess ; do \
for i in auth/users backup/include.user backup/exclude.user \
certs/index.txt ddns/config ddns/noipsettings ddns/settings ddns/ipcache dhcp/settings \
dhcp/fixleases dhcp/advoptions dmzholes/config ethernet/aliases ethernet/settings ethernet/known_nics ethernet/scanned_nics \
- extrahd/scan extrahd/devices extrahd/partitions extrahd/settings fwlogs/ipsettings fwlogs/portsettings\
- isdn/settings main/hosts main/settings net-traffic\settings optionsfw/settings outgoing/settings outgoing/rules pakfire/settings \
+ extrahd/scan extrahd/devices extrahd/partitions extrahd/settings fwlogs/ipsettings fwlogs/portsettings \
+ isdn/settings main/hosts main/settings net-traffic/settings optionsfw/settings outgoing/settings outgoing/rules pakfire/settings \
portfw/config ppp/settings-1 ppp/settings-2 ppp/settings-3 ppp/settings-4 \
ppp/settings-5 ppp/settings proxy/settings proxy/advanced/settings proxy/advanced/cre/enable remote/settings qos/settings qos/classes qos/subclasses qos/level7config qos/portconfig \
qos/tosconfig snort/settings tripwire/settings upnp/settings vpn/config vpn/settings vpn/ipsec.conf \
return memory*2;
}
+long calc_rootsize(long free, long max) {
+ long root;
+
+ root = max / 2;
+ if (root < 512) {
+ return 0;
+ }
+ if (root > 2048) {
+ root = 2048;
+ }
+ return root;
+}
+
int main(int argc, char *argv[])
{
char *langnames[] = { "Deutsch", "English", NULL };
system(commandstring);
/* Calculate amount of disk space */
- if ((handle = fopen("/tmp/disksize", "r")))
- {
- fgets(line, STRING_SIZE-1, handle);
- if (sscanf (line, "%s", string)) {
+ if ((handle = fopen("/tmp/disksize", "r"))) {
+ fgets(line, STRING_SIZE-1, handle);
+ if (sscanf (line, "%s", string)) {
maximum_free = atoi(string) / 1024;
- }
- fclose(handle);
- }
+ }
+ fclose(handle);
+ }
- fprintf(flog, "maximum_free = %ld, memory = %ld",
- maximum_free, memory);
+ fprintf(flog, "maximum_free = %ld, memory = %ld", maximum_free, memory);
swap_file = calc_swapsize(memory, maximum_free);
- if (maximum_free < 512 + swap_file ) {
- if (maximum_free < 512) {
+ if (maximum_free < 768 + swap_file ) {
+ if (maximum_free < 768) {
errorbox(ctr[TR_DISK_TOO_SMALL]);
goto EXIT;
}
boot_partition = 20; /* in MB */
current_free = maximum_free - boot_partition - swap_file;
- root_partition = 1024 ;
- if (current_free < 512) {
+ if (current_free < 768) {
errorbox(ctr[TR_DISK_TOO_SMALL]);
goto EXIT;
}
-
- current_free = current_free - root_partition;
- if (!swap_file) {
- root_partition = root_partition + swap_file;
+
+ root_partition = calc_rootsize(current_free, maximum_free);
+
+ if (root_partition == 0) {
+ errorbox(ctr[TR_DISK_TOO_SMALL]);
+ goto EXIT;
+ } else {
+ current_free = current_free - root_partition;
+ }
+
+ if (current_free < 256) {
+ errorbox(ctr[TR_DISK_TOO_SMALL]);
+ goto EXIT;
}
system_partition = current_free;
sprintf(mkfscommand, "/sbin/mkreiserfs -f");
} else if (fstype == EXT3) {
mysystem("/sbin/modprobe ext3");
- sprintf(mkfscommand, "/bin/mke2fs -T ext2 -c");
+ sprintf(mkfscommand, "/bin/mke2fs -T ext3 -c");
}
snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -T ext2 -c %s1", hdparams.devnode_part);
if (fstype == REISER4) {
replace("/harddisk/etc/fstab", "FSTYPE", "reiser4");
replace("/harddisk/etc/mkinitcpio.conf", "MODULES=\"", "MODULES=\"reiser4 ");
+ replace("/harddisk/boot/grub/grub.conf", "MOUNT", "rw");
} else if (fstype == REISERFS) {
replace("/harddisk/etc/fstab", "FSTYPE", "reiserfs");
+ replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
} else if (fstype == EXT3) {
replace("/harddisk/etc/fstab", "FSTYPE", "ext3");
+ replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
}
/* Going to make our initrd... */