Adding the capability to update and depclean.

This commit is contained in:
Sergiotarxz 2023-10-01 07:57:36 +02:00
parent 7de3d81c04
commit 0c2a06934b

View File

@ -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) {