Revision: 3081 http://ipcop.svn.sourceforge.net/ipcop/?rev=3081&view=rev Author: owes Date: 2009-06-17 19:55:54 +0000 (Wed, 17 Jun 2009)
Log Message: ----------- Avoid a possible problem with running many sed's. Build one big command and execute that. Modified Paths: -------------- ipcop/trunk/src/installer/partition.c Modified: ipcop/trunk/src/installer/partition.c =================================================================== --- ipcop/trunk/src/installer/partition.c 2009-06-17 19:39:15 UTC (rev 3080) +++ ipcop/trunk/src/installer/partition.c 2009-06-17 19:55:54 UTC (rev 3081) @@ -638,6 +638,7 @@ static int make_bootable(char *dev, char *dev2) { char command[STRING_SIZE]; + char bigstring[STRING_SIZE_LARGE]; char device[STRING_SIZE]; char device2[STRING_SIZE]; @@ -647,47 +648,53 @@ snprintf(device2, STRING_SIZE, "/dev/%s", dev2); #if defined (__i386__) + strcpy(bigstring, "/bin/sed "); + if (raid) { /* replace the ROOT_DEV with md0 */ - mysystem("/bin/sed -i -e 's+ROOT_DEV+/dev/md0+g' /harddisk/boot/extlinux.conf"); + strcat(bigstring, "-i -e 's+ROOT_DEV+/dev/md0+g' "); } else if (partition_uuidenc[PART_INDEX_ROOT][0]) { /* replace the ROOT_DEV with UUID partition */ - snprintf(command, STRING_SIZE, "/bin/sed -i -e 's+ROOT_DEV+/dev/disk/by-uuid/%s+g' /harddisk/boot/extlinux.conf", + snprintf(command, STRING_SIZE, "-i -e 's+ROOT_DEV+/dev/disk/by-uuid/%s+g' ", partition_uuidenc[PART_INDEX_ROOT]); - mysystem(command); + strcat(bigstring, command); } else if (partition_label[PART_INDEX_ROOT][0]) { /* replace the ROOT_DEV with LABEL partition */ - snprintf(command, STRING_SIZE, "/bin/sed -i -e 's+ROOT_DEV+/dev/disk/by-label/%s+g' /harddisk/boot/extlinux.conf", "root"); - mysystem(command); + snprintf(command, STRING_SIZE, "-i -e 's+ROOT_DEV+/dev/disk/by-label/%s+g' ", "root"); + strcat(bigstring, command); } else { /* fallback: replace the ROOT_DEV with the real device, partition 1 */ - snprintf(command, STRING_SIZE, "/bin/sed -i -e 's+ROOT_DEV+%s1+g' /harddisk/boot/extlinux.conf", device); - mysystem(command); + snprintf(command, STRING_SIZE, "-i -e 's+ROOT_DEV+%s1+g' ", device); + strcat(bigstring, command); } if (medium_console == serial) { - snprintf(command, STRING_SIZE, "/bin/sed -i -e 's+SERIAL_CONSOLE+SERIAL %u %u+' /harddisk/boot/extlinux.conf", + snprintf(command, STRING_SIZE, "-i -e 's+SERIAL_CONSOLE+SERIAL %u %u+' ", serial_console, serial_bitrate); - mysystem(command); - snprintf(command, STRING_SIZE, "/bin/sed -i -e 's+serial_settings+console=%s+' /harddisk/boot/extlinux.conf", + strcat(bigstring, command); + snprintf(command, STRING_SIZE, "-i -e 's+serial_settings+console=%s+' ", serial_commandline); - mysystem(command); + strcat(bigstring, command); } else { - mysystem("/bin/sed -i -e 's+SERIAL_CONSOLE++' /harddisk/boot/extlinux.conf"); - mysystem("/bin/sed -i -e 's+serial_settings++' /harddisk/boot/extlinux.conf"); + strcat(bigstring, "-i -e 's+SERIAL_CONSOLE++' "); + strcat(bigstring, "-i -e 's+serial_settings++' "); } if (medium_target == flash) { /* Add nodma, maybe others. */ - mysystem("/bin/sed -i -e 's+flashdisk_settings+nodma+' /harddisk/boot/extlinux.conf"); + strcat(bigstring, "-i -e 's+flashdisk_settings+nodma+' "); } else { - mysystem("/bin/sed -i -e 's+flashdisk_settings++' /harddisk/boot/extlinux.conf"); + strcat(bigstring, "-i -e 's+flashdisk_settings++' "); } + strcat(bigstring, "/harddisk/boot/extlinux.conf"); + mysystem(bigstring); + sleep(1); + /* Install extlinux and MBR */ if (mysystem("/bin/chroot /harddisk /sbin/extlinux --install /boot")) { return FAILURE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn