From 0c2a06934b5ee8050d5b39a0ef32d657e7fa5aa2 Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Sun, 1 Oct 2023 07:57:36 +0200 Subject: [PATCH] Adding the capability to update and depclean. --- prepare_system.pl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/prepare_system.pl b/prepare_system.pl index 40d4fbf..34081ea 100644 --- a/prepare_system.pl +++ b/prepare_system.pl @@ -36,9 +36,31 @@ sub main { if ($rebuild_bin && $package_use_changed || $make_conf_changed) { _rebuildBinaries($target_dir); } + _updateSystem($target_dir); + _depclean($target_dir); _installNeededPackages($target_dir, $packages); } +sub _depclean($target) { + _forkWait() or return; + _chroot($target); + my $return_code = system 'emerge', '--depclean'; + if ($return_code != 0) { + die 'Unable to depclean system.'; + } + exit 0; +} + +sub _updateSystem($target) { + _forkWait() or return; + _chroot($target); + my $return_code = system 'emerge', '-uUDN', '@world'; + if ($return_code != 0) { + die 'Unable to update the system.'; + } + exit 0; +} + sub _rebuildBinaries($target) { _forkWait() or return; _chroot($target); @@ -50,6 +72,7 @@ sub _rebuildBinaries($target) { if ($return_code != 0) { die 'Unable to rebuild binaries for world.'; } + exit 0; } sub _installNeededPackages($target, $packages) {