From: <ow...@us...> - 2007-12-06 21:52:02
|
Revision: 837 http://ipcop.svn.sourceforge.net/ipcop/?rev=837&view=rev Author: owes Date: 2007-12-06 13:52:06 -0800 (Thu, 06 Dec 2007) Log Message: ----------- small modification to make changing hw detection easier Modified Paths: -------------- ipcop/trunk/src/installer/partition.c Modified: ipcop/trunk/src/installer/partition.c =================================================================== --- ipcop/trunk/src/installer/partition.c 2007-12-06 20:34:01 UTC (rev 836) +++ ipcop/trunk/src/installer/partition.c 2007-12-06 21:52:06 UTC (rev 837) @@ -642,20 +642,17 @@ */ void make_bootable(int selected_hd, int bootpartexist) { - char string[STRING_SIZE]; + char string[STRING_SIZE]; + char *device = harddisklist[selected_hd]; #if defined (__i386__) mysystem("/bin/cp -f /harddisk/boot/grub/grubbatch /harddisk/tmp"); - snprintf(string, STRING_SIZE, - "/bin/sed -i -e 's+DEVICE+%s+g' /harddisk/tmp/grubbatch", - harddisklist[selected_hd]); + snprintf(string, STRING_SIZE, "/bin/sed -i -e 's+DEVICE+%s+g' /harddisk/tmp/grubbatch", device); mysystem(string); /* replace the ROOT_DEV with the real device, partition 2 */ - snprintf(string, STRING_SIZE, - "/bin/sed -i -e 's+ROOT_DEV+%s2+g' /harddisk/boot/grub/grub.conf", - harddisklist[selected_hd]); + snprintf(string, STRING_SIZE, "/bin/sed -i -e 's+ROOT_DEV+%s2+g' /harddisk/boot/grub/grub.conf", device); mysystem(string); /* /boot is not a partition. Just correct grub load location */ @@ -670,8 +667,7 @@ mysystem("/bin/sed -i -e '/savedefault/d' /harddisk/boot/grub/grub.conf"); /* restore permissions */ - chmod("/harddisk/tmp/grubbatch", - S_IXUSR | S_IRUSR | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH); + chmod("/harddisk/tmp/grubbatch", S_IXUSR | S_IRUSR | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH); mysystem("/bin/chroot /harddisk /tmp/grubbatch"); #endif @@ -708,17 +704,14 @@ if(newworld) { fprintf(flog, "Configuring Open Firmware (NewWorld)\n"); - snprintf(string, STRING_SIZE, "/bin/chroot /harddisk /usr/sbin/mkofboot --force -b %s2", - harddisklist[selected_hd]); + snprintf(string, STRING_SIZE, "/bin/chroot /harddisk /usr/sbin/mkofboot --force -b %s2", device); mysystem(string); /* replace the ROOT_DEV with the real device, partition 2 */ - snprintf(string, STRING_SIZE, "/bin/sed -i -e 's+BOOTSTRAP_DEV+%s2+g' /harddisk/etc/yaboot.conf", - harddisklist[selected_hd]); + snprintf(string, STRING_SIZE, "/bin/sed -i -e 's+BOOTSTRAP_DEV+%s2+g' /harddisk/etc/yaboot.conf", device); mysystem(string); - snprintf(string, STRING_SIZE, "/bin/sed -i -e 's+ROOT_DEV+%s4+g' /harddisk/etc/yaboot.conf", - harddisklist[selected_hd]); + snprintf(string, STRING_SIZE, "/bin/sed -i -e 's+ROOT_DEV+%s4+g' /harddisk/etc/yaboot.conf", device); mysystem(string); fprintf(flog, "Running ybin\n"); @@ -726,8 +719,7 @@ mysystem(string); } else { fprintf(flog, "Configuring Open Firmware (OldWorld)\n"); - snprintf(string, STRING_SIZE, "/bin/chroot /harddisk /usr/local/bin/install-quik.sh %s3 %s4", - harddisklist[selected_hd],harddisklist[selected_hd]); + snprintf(string, STRING_SIZE, "/bin/chroot /harddisk /usr/local/bin/install-quik.sh %s3 %s4", device, device); mysystem(string); } #endif @@ -735,8 +727,7 @@ #if defined (__sparc__) || defined (__sparc64__) fprintf(flog, "Installing silo\n"); /* replace the ROOT_DEV with the real device, partition 2 */ - snprintf(string, STRING_SIZE, "/bin/sed -i -e 's+ROOT_DEV+%s2+g' /harddisk/etc/silo.conf", - harddisklist[selected_hd]); + snprintf(string, STRING_SIZE, "/bin/sed -i -e 's+ROOT_DEV+%s2+g' /harddisk/etc/silo.conf", device); mysystem(string); /* We need to mount /proc/openprom so we can rewrite the boot-device prom variable */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |