mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
Die Partitionen werden nun dynamisch berechnet.
Min. 512MB - Max. 2GB - / 20MB - /boot Min. 246MB - Max. 1GB - swap git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@596 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -54,7 +54,7 @@ $(TARGET) :
|
||||
# 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 \
|
||||
@@ -65,8 +65,8 @@ $(TARGET) :
|
||||
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 \
|
||||
|
||||
@@ -20,7 +20,6 @@ case "${1}" in
|
||||
boot_mesg "Remounting root file system in read-write mode..."
|
||||
mount -n -o remount,rw / &>/dev/null
|
||||
evaluate_retval
|
||||
sleep 1
|
||||
|
||||
# Remove fsck-related file system watermarks.
|
||||
rm -f /fastboot /forcefsck
|
||||
|
||||
@@ -63,6 +63,19 @@ long calc_swapsize(long memory, long disk) {
|
||||
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 };
|
||||
@@ -390,22 +403,20 @@ int main(int argc, char *argv[])
|
||||
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;
|
||||
}
|
||||
@@ -425,15 +436,23 @@ int main(int argc, char *argv[])
|
||||
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;
|
||||
@@ -469,7 +488,7 @@ int main(int argc, char *argv[])
|
||||
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);
|
||||
@@ -590,10 +609,13 @@ int main(int argc, char *argv[])
|
||||
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... */
|
||||
|
||||
Reference in New Issue
Block a user