FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Red Hat Linux

 
 
LinkBack Thread Tools
 
Old 10-06-2010, 07:11 PM
Chris Lumens
 
Default Do a better job of explaining how much memory is required to install (#639056).

---
anaconda | 33 +++++++++++++++++----------------
loader/loader.c | 10 ++++++----
pyanaconda/storage/__init__.py | 13 +++++++++----
3 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/anaconda b/anaconda
index 89b791c..1e7de75 100755
--- a/anaconda
+++ b/anaconda
@@ -324,13 +324,14 @@ def gtk_warning(title, reason):
dialog.destroy()

def check_memory(anaconda, opts, display_mode=None):
- reason_strict = _('You do not have enough RAM to install %s '
- 'on this machine.
' % product.productName)
- reason_method = _('You do not have enough RAM to install %s '
- 'on this machine using this install method.
' %
- product.productName)
- reason_graphical = _('You do not have enough RAM to use the graphical '
- 'installer.')
+ reason_strict = _("%s requires %s MB of memory to install, but you only have "
+ "%s MB on this machine.
")
+ reason_method = _("%s requires %s MB of memory to install using this "
+ "installation method, but you only have %s MB on this "
+ "machine.
")
+ reason_graphical = _("The %s graphical installer requires %s MB of memory, but "
+ "you only have %s MB.")
+
reboot_extra = _('
'
'Press <return> to reboot your system.
')
livecd_title = _("Not enough RAM")
@@ -348,38 +349,38 @@ def check_memory(anaconda, opts, display_mode=None):
extra_ram += isys.URL_INSTALL_EXTRA_RAM
reason = reason_method

- total_ram = isys.total_memory()
- needed_ram = isys.MIN_RAM + extra_ram
+ total_ram = int(isys.total_memory() / 1024)
+ needed_ram = int((isys.MIN_RAM + extra_ram) / 1024)

if needed_ram > total_ram:
from snack import SnackScreen, ButtonChoiceWindow
if opts.liveinst:
- stdoutLog.warning(reason)
- gtk_warning(livecd_title, reason)
+ stdoutLog.warning(reason % (product.productName, needed_ram, total_ram))
+ gtk_warning(livecd_title, reason % (product.productName, needed_ram, total_ram))
else:
reason += reboot_extra
screen = SnackScreen()
ButtonChoiceWindow(screen, _('Fatal Error'),
- reason,
+ reason % (product.productName, needed_ram, total_ram),
buttons = (_("OK"),))
screen.finish()
sys.exit(1)

# override display mode if machine cannot nicely run X
if display_mode not in ('t', 'c') and not flags.usevnc:
- needed_ram += isys.GUI_INSTALL_EXTRA_RAM
+ needed_ram += int(isys.GUI_INSTALL_EXTRA_RAM / 1024)
reason = reason_graphical

if needed_ram > total_ram:
if opts.liveinst:
reason += livecd_extra
- stdoutLog.warning(reason)
+ stdoutLog.warning(reason % (product.productName, needed_ram, total_ram))
title = livecd_title
- gtk_warning(title, reason)
+ gtk_warning(title, reason % (product.productName, needed_ram, total_ram))
sys.exit(1)
else:
reason += nolivecd_extra
- stdoutLog.warning(reason)
+ stdoutLog.warning(reason % (product.productName, needed_ram, total_ram))
anaconda.displayMode = 't'
time.sleep(2)

diff --git a/loader/loader.c b/loader/loader.c
index b0c1cab..7758f2f 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1182,20 +1182,22 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,

/* make sure they have enough ram */
static void checkForRam(int install_method) {
- char *reason_none = _("You do not have enough RAM to install %s on this machine.");
- char *reason_method = _("You do not have enough RAM to install %s on this machine using this install method.");
+ char *reason_none = _("%s requires %d MB of memory, to install, but you only have %d MB.");
+ char *reason_method = _("%s requires %d MB of memory to install using this installation "
+ "method, but you only have %d MB on this machine.");

char* reason = reason_none;
int needed = MIN_RAM;
+ int installed = totalMemory();

if (install_method == METHOD_URL) {
needed += URL_INSTALL_EXTRA_RAM;
reason = reason_method;
}
-
+
if (totalMemory() < needed) {
char *buf;
- checked_asprintf(&buf, reason, getProductName());
+ checked_asprintf(&buf, reason, getProductName(), needed/1024, installed/1024);

startNewt();
newtWinMessage(_("Error"), _("OK"), buf);
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index c92b76d..cba443b 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1033,11 +1033,16 @@ class Storage(object):
errors.extend(self.anaconda.platform.checkBootRequ est(boot))

if not swaps:
- if iutil.memInstalled() < isys.EARLY_SWAP_RAM:
+ from pyanaconda.storage.size import Size
+
+ installed = Size(spec="%s kb" % iutil.memInstalled())
+ required = Size(spec="%s kb" % isys.EARLY_SWAP_RAM)
+
+ if installed < required:
errors.append(_("You have not specified a swap partition. "
- "Due to the amount of memory present, a "
- "swap partition is required to complete "
- "installation."))
+ "%s MB of memory is required to continue installation "
+ "without a swap partition, but you only have %s MB.")
+ % (int(required.convertTo(spec="MB")), int(installed.convertTo(spec="MB"))))
else:
warnings.append(_("You have not specified a swap partition. "
"Although not strictly required in all cases, "
--
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:06 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org