diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2021-02-14 21:32:32 +0000 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2021-02-14 21:33:09 +0000 |
commit | e4686b6185488e1e71fb9bbe2e25b3321b8e471b (patch) | |
tree | a11a84b2b56f6fb55955d6d804257e937c64e00b | |
parent | 6d1ee4b3046b49f4484d9d1a256f7d21547afc02 (diff) | |
download | draklive-install-e4686b6185488e1e71fb9bbe2e25b3321b8e471b.tar draklive-install-e4686b6185488e1e71fb9bbe2e25b3321b8e471b.tar.gz draklive-install-e4686b6185488e1e71fb9bbe2e25b3321b8e471b.tar.bz2 draklive-install-e4686b6185488e1e71fb9bbe2e25b3321b8e471b.tar.xz draklive-install-e4686b6185488e1e71fb9bbe2e25b3321b8e471b.zip |
On systems with low RAM, remove unwanted packages after install (mga#27872).
This avoids running out of space in the RAM overlay filesystem.
-rw-r--r-- | NEWS | 3 | ||||
-rwxr-xr-x | draklive-install | 16 |
2 files changed, 17 insertions, 2 deletions
@@ -1,3 +1,6 @@ +- on systems with low RAM, remove unwanted packages after install (mga#27872) + (this avoids running out of space in the RAM overlay filesystem) + 2.29 - revert generate report.bug.xz on exit diff --git a/draklive-install b/draklive-install index d508fa1..c084713 100755 --- a/draklive-install +++ b/draklive-install @@ -91,13 +91,20 @@ sub install_live() { my $persistent = -e '/run/mgalive/persistent'; + # Don't remove packages from a persistent live system, as they will no + # longer be available for future installs. Don't remove packages from + # a non-persistent live system with insufficient RAM to accomodate the + # changes that will be stored in the upper layer of the overlay file + # system (mga#27872). + my $remove_after_install = $persistent || ram_size_in_MB() < 750; + display_start_message(); init_hds($in, $all_hds, $fstab); ask_partitions_loop($in, $all_hds, $fstab, $copy_source); - remove_unused_packages($in, $copy_source) if !$persistent; + remove_unused_packages($in, $copy_source) if !$remove_after_install; prepare_root($in); copy_root($in, $copy_source); - remove_unused_packages($in, $::prefix) if $persistent; + remove_unused_packages($in, $::prefix) if $remove_after_install; complete_install($in, $all_hds); setup_bootloader($in, $all_hds, $fstab); install_updates($in); @@ -106,6 +113,11 @@ sub install_live() { $in->exit(0); } +sub ram_size_in_MB() { + my @mem_total = map { /(\d+)/ } grep { /^MemTotal:/ } cat_("/proc/meminfo"); + $mem_total[0] / 1024; +} + sub umount_all { my ($fstab, $o_except_swap) = @_; #- make sure nothing is mounted in the new root |